<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:05:53 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[KAFKA-227] NullPointerException when returning null from a custom WriteModelStrategy</title>
                <link>https://jira.mongodb.org/browse/KAFKA-227</link>
                <project id="16285" key="KAFKA">Kafka Connector</project>
                    <description>&lt;p&gt;Returning&#160;&lt;b&gt;&lt;tt&gt;null&lt;/tt&gt;&lt;/b&gt; from a custom &lt;b&gt;&lt;tt&gt;WriteModelStrategy&lt;/tt&gt;&lt;/b&gt; (as documented in &lt;a href=&quot;https://docs.mongodb.com/kafka-connector/current/kafka-sink-postprocessors/#:~:text=Return%20null%20to%20indicate%20no%20op&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/kafka-connector/current/kafka-sink-postprocessors/#:~:text=Return%20null%20to%20indicate%20no%20op&lt;/a&gt;) throws a &lt;b&gt;&lt;tt&gt;NullPointerException&lt;/tt&gt;&lt;/b&gt; when trying to wrap the returned value in a &lt;tt&gt;java.util.Optional&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;The fix seems trivial: Use &lt;tt&gt;&lt;b&gt;Optional.ofNullable(value)&lt;/b&gt;&lt;/tt&gt; instead of &lt;tt&gt;Optional.of(value)&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-kafka/blob/122cfbe5e7fb7b1949e7f2d1298e1e0c540e6a5d/src/main/java/com/mongodb/kafka/connect/sink/MongoProcessedSinkRecordData.java#L91&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-kafka/blob/122cfbe5e7fb7b1949e7f2d1298e1e0c540e6a5d/src/main/java/com/mongodb/kafka/connect/sink/MongoProcessedSinkRecordData.java#L91&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1759270">KAFKA-227</key>
            <summary>NullPointerException when returning null from a custom WriteModelStrategy</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="10300" iconUrl="https://jira.mongodb.org/images/icons/priorities/medium.svg">Unknown</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13201">Fixed</resolution>
                                        <assignee username="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="diegodiez.ddr@gmail.com">Diego D&#237;ez</reporter>
                        <labels>
                            <label>external-user</label>
                    </labels>
                <created>Thu, 27 May 2021 11:44:14 +0000</created>
                <updated>Sat, 28 Oct 2023 10:46:11 +0000</updated>
                            <resolved>Tue, 1 Jun 2021 12:54:47 +0000</resolved>
                                    <version>1.5.0</version>
                                    <fixVersion>1.5.1</fixVersion>
                                    <component>Sink</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3847462" author="xgen-internal-githook" created="Fri, 28 May 2021 13:32:10 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Diego D&#237;ez&apos;, &apos;email&apos;: &apos;diegodiez.ddr@gmail.com&apos;, &apos;username&apos;: &apos;didiez&apos;}
&lt;p&gt;Message: Wrap nullable value returned from WriteModelStrategy using Optional.ofNullable(value)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/KAFKA-227&quot; title=&quot;NullPointerException when returning null from a custom WriteModelStrategy&quot; class=&quot;issue-link&quot; data-issue-key=&quot;KAFKA-227&quot;&gt;&lt;del&gt;KAFKA-227&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: 1.5.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-kafka/commit/2f02129dfbc958fd12f77b05ac1be933965201b0&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-kafka/commit/2f02129dfbc958fd12f77b05ac1be933965201b0&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3847454" author="xgen-internal-githook" created="Fri, 28 May 2021 13:29:57 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Diego D&#237;ez&apos;, &apos;email&apos;: &apos;diegodiez.ddr@gmail.com&apos;, &apos;username&apos;: &apos;didiez&apos;}
&lt;p&gt;Message: fixes &lt;a href=&quot;https://jira.mongodb.org/browse/KAFKA-227&quot; title=&quot;NullPointerException when returning null from a custom WriteModelStrategy&quot; class=&quot;issue-link&quot; data-issue-key=&quot;KAFKA-227&quot;&gt;&lt;del&gt;KAFKA-227&lt;/del&gt;&lt;/a&gt;: Wrap nullable value returned from WriteModelStrategy using Optional.ofNullable(value)&lt;br/&gt;
Branch: 1.5.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-kafka/commit/604ba2ad6c109878ab17c291e7a0f7036edaac65&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-kafka/commit/604ba2ad6c109878ab17c291e7a0f7036edaac65&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3847447" author="xgen-internal-githook" created="Fri, 28 May 2021 13:28:24 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Diego D&#237;ez&apos;, &apos;email&apos;: &apos;diegodiez.ddr@gmail.com&apos;, &apos;username&apos;: &apos;didiez&apos;}
&lt;p&gt;Message: fixes &lt;a href=&quot;https://jira.mongodb.org/browse/KAFKA-227&quot; title=&quot;NullPointerException when returning null from a custom WriteModelStrategy&quot; class=&quot;issue-link&quot; data-issue-key=&quot;KAFKA-227&quot;&gt;&lt;del&gt;KAFKA-227&lt;/del&gt;&lt;/a&gt;: Wrap nullable value returned from WriteModelStrategy using Optional.ofNullable(value)&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-kafka/commit/2fecd65974ce005d142464b2e658262d73784171&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-kafka/commit/2fecd65974ce005d142464b2e658262d73784171&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3844928" author="JIRAUSER1259761" created="Thu, 27 May 2021 15:00:48 +0000"  >&lt;p&gt;Great!&lt;/p&gt;

&lt;p&gt;I forgot to comment here after sending the PR &lt;a href=&quot;https://github.com/mongodb/mongo-kafka/pull/70&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-kafka/pull/70&lt;/a&gt;&#160;with the fix.&lt;/p&gt;</comment>
                            <comment id="3844404" author="ross@10gen.com" created="Thu, 27 May 2021 12:55:28 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=diegodiez.ddr%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;diegodiez.ddr@gmail.com&quot;&gt;diegodiez.ddr@gmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thanks for the ticket, this will be fixed in the next release.&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hz2s1r:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>