<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:02:26 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>[JAVA-4575] Driver code should catch Exception instead of RuntimeException even if no checked exception is declared</title>
                <link>https://jira.mongodb.org/browse/JAVA-4575</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Due to Kotlin not supporting checked exceptions, it is possible to break expectations we have in Java, and throw a checked exception from a method that does not declare throwing checked exceptions. See the discussion in &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/pull/881&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/pull/881&lt;/a&gt; for more details. In order to work around this problem, we should do the following:&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;Treat any method as being able to throw checked exception even it is not declared (despite this not being true for all methods, for simplicity and robustness it is better to treat all of them this way).&lt;/li&gt;
	&lt;li&gt;Replace all &lt;tt&gt;catch&lt;/tt&gt; blocks that catch &lt;tt&gt;RuntimeException&lt;/tt&gt; s (or subclasses, but those are harder to find) with blocks that catch &lt;tt&gt;Exception&lt;/tt&gt;.&lt;/li&gt;
	&lt;li&gt;Explicitly look at the known places were the driver may execute user-provided code and add code that wraps checked exceptions in unchecked ones. &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jeff.yemin%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;jeff.yemin@mongodb.com&quot;&gt;jeff.yemin@mongodb.com&lt;/a&gt; came up with the following list
	&lt;ol&gt;
		&lt;li&gt;withTransaction&lt;/li&gt;
		&lt;li&gt;authenticator-related callbacks&lt;/li&gt;
		&lt;li&gt;any event listener&lt;/li&gt;
		&lt;li&gt;Bson.toBsonDocument (in case someone has gone to the trouble to implement the Bson interface)&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/li&gt;
&lt;/ol&gt;
</description>
                <environment></environment>
        <key id="2024280">JAVA-4575</key>
            <summary>Driver code should catch Exception instead of RuntimeException even if no checked exception is declared</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="9">Done</resolution>
                                        <assignee username="maxim.katcharov@mongodb.com">Maxim Katcharov</assignee>
                                    <reporter username="valentin.kovalenko@mongodb.com">Valentin Kavalenka</reporter>
                        <labels>
                    </labels>
                <created>Wed, 13 Apr 2022 15:10:05 +0000</created>
                <updated>Thu, 7 Jul 2022 15:57:18 +0000</updated>
                            <resolved>Thu, 7 Jul 2022 15:57:18 +0000</resolved>
                                                    <fixVersion>4.7.0</fixVersion>
                                    <component>Error Handling</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="4663447" author="xgen-internal-githook" created="Thu, 7 Jul 2022 14:56:06 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Maxim Katcharov&apos;, &apos;email&apos;: &apos;maxim.katcharov@mongodb.com&apos;, &apos;username&apos;: &apos;katcharov&apos;}
&lt;p&gt;Message: Replace RuntimeException in catch with Exception to support Kotlin (#971)&lt;/p&gt;

&lt;p&gt;Kotlin does not support checked exceptions, so our handlers will use Exception. All handlers are replaced, even those obviously unaffected, for the sake of a consistent noticeable pattern.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-4575&quot; title=&quot;Driver code should catch Exception instead of RuntimeException even if no checked exception is declared&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-4575&quot;&gt;&lt;del&gt;JAVA-4575&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/79512417f2990c3b795d228ba35bf48a3cfbd9bb&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/79512417f2990c3b795d228ba35bf48a3cfbd9bb&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4480398" author="xgen-internal-githook" created="Wed, 13 Apr 2022 15:14:40 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Emanuele Sabellico&apos;, &apos;email&apos;: &apos;emasab@gmail.com&apos;, &apos;username&apos;: &apos;emasab&apos;}
&lt;p&gt;Message: Abort transaction in all cases (#881)&lt;/p&gt;

&lt;p&gt;See &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-4575&quot; title=&quot;Driver code should catch Exception instead of RuntimeException even if no checked exception is declared&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-4575&quot;&gt;&lt;del&gt;JAVA-4575&lt;/del&gt;&lt;/a&gt; for more details.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/ebada8e17c18e9a8574393fd2bdc9c5231290f58&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/ebada8e17c18e9a8574393fd2bdc9c5231290f58&lt;/a&gt;&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|hr3mmh:040000093r</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>