<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:55:04 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-1625] Document that MongoClient no longer throws UnknownHostException</title>
                <link>https://jira.mongodb.org/browse/JAVA-1625</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;&lt;a href=&quot;http://grepcode.com/file/repo1.maven.org/maven2/org.mongodb/mongo-java-driver/2.12.1/com/mongodb/ServerAddress.java#ServerAddress&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://grepcode.com/file/repo1.maven.org/maven2/org.mongodb/mongo-java-driver/2.12.1/com/mongodb/ServerAddress.java#ServerAddress&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;This code does not throw an UnknownHostException like older versions. There is no attempt to resolve an ip address of the host using the java library InetAddress.getByName like in 2.11 versions.&lt;/p&gt;</description>
                <environment></environment>
        <key id="179655">JAVA-1625</key>
            <summary>Document that MongoClient no longer throws UnknownHostException</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</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="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="kslepoy">Konrad Slepoy</reporter>
                        <labels>
                    </labels>
                <created>Tue, 20 Jan 2015 16:55:42 +0000</created>
                <updated>Tue, 26 Jan 2016 21:06:38 +0000</updated>
                            <resolved>Tue, 20 Jan 2015 22:38:53 +0000</resolved>
                                    <version>2.12.3</version>
                                    <fixVersion>2.13.0</fixVersion>
                    <fixVersion>3.0.0</fixVersion>
                                    <component>Documentation</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="818077" author="xgen-internal-githook" created="Fri, 30 Jan 2015 18:47:00 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jyemin&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: Removed errant declaration of UnknownHostException from some Mongo constructors&lt;br/&gt;
Remove errant Javadoc from MongoClient and Mongo constructors for UnknownHostException and MongoException&lt;br/&gt;
exceptions that are no longer thrown.&lt;/p&gt;

&lt;p&gt;     &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-1625&quot; title=&quot;Document that MongoClient no longer throws UnknownHostException&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-1625&quot;&gt;&lt;del&gt;JAVA-1625&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/13f3357885d34bd153efe0cbae78a424420e279b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/13f3357885d34bd153efe0cbae78a424420e279b&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="808735" author="xgen-internal-githook" created="Tue, 20 Jan 2015 20:06:19 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jyemin&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: Removed errant declaration of UnknownHostException from some Mongo constructors&lt;br/&gt;
Remove errant Javadoc from MongoClient and Mongo constructors for UnknownHostException and MongoException&lt;br/&gt;
exceptions that are no longer thrown.&lt;/p&gt;

&lt;p&gt;     &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-1625&quot; title=&quot;Document that MongoClient no longer throws UnknownHostException&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-1625&quot;&gt;&lt;del&gt;JAVA-1625&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: 3.0.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/13f3357885d34bd153efe0cbae78a424420e279b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/13f3357885d34bd153efe0cbae78a424420e279b&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="808729" author="xgen-internal-githook" created="Tue, 20 Jan 2015 20:02:13 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jyemin&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: Updated Javadoc for MongoClient, Mongo, and ServerAddress constructors to indicate that UnknownHostException and MongoException&lt;br/&gt;
are no longer thrown.&lt;/p&gt;

&lt;p&gt; &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-1625&quot; title=&quot;Document that MongoClient no longer throws UnknownHostException&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-1625&quot;&gt;&lt;del&gt;JAVA-1625&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/b8e38fec76e556a3503396a17ab2ec522151c130&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/b8e38fec76e556a3503396a17ab2ec522151c130&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="808683" author="jeff.yemin" created="Tue, 20 Jan 2015 19:33:07 +0000"  >&lt;p&gt;Yes, understood, so for 2.13 we will just update the Javadoc to say this:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;     * @throws UnknownHostException This exception is no longer thrown, but leaving in throws clause so as not to break source&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;     *                              compatibility.  The exception will be removed from the declaration in the next major release of the&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;     *                              driver.&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;and make sure it&apos;s removed entirely in 3.0.&lt;/p&gt;</comment>
                            <comment id="808669" author="kslepoy" created="Tue, 20 Jan 2015 19:24:15 +0000"  >&lt;p&gt;public MongoClient(String host,&lt;br/&gt;
           int port)&lt;br/&gt;
            throws UnknownHostException&lt;br/&gt;
Creates a Mongo instance based on a (single) mongodb node.&lt;br/&gt;
Parameters:&lt;br/&gt;
host - the database&apos;s host address&lt;br/&gt;
port - the port on which the database is running&lt;br/&gt;
Throws:&lt;br/&gt;
UnknownHostException - if the database host cannot be resolved&lt;br/&gt;
MongoException&lt;/p&gt;</comment>
                            <comment id="808657" author="kslepoy" created="Tue, 20 Jan 2015 19:18:03 +0000"  >&lt;p&gt;The method signature says that it throws it though. So since the method says throws UnknownHostException we thought that if we pass an invalid host name an exception will be thrown.&lt;/p&gt;</comment>
                            <comment id="808655" author="jeff.yemin" created="Tue, 20 Jan 2015 19:16:18 +0000"  >&lt;p&gt;It&apos;s a compiler error to catch a checked exception that isn&apos;t thrown.&lt;/p&gt;</comment>
                            <comment id="808643" author="kslepoy" created="Tue, 20 Jan 2015 19:09:27 +0000"  >&lt;p&gt;Sounds good to me. I think people might think that they are safe catching an exception that isn&apos;t thrown. Then an exception will pop up later and they&apos;ll be confused. I&apos;m just a basic software developer though so whatever you think.&lt;/p&gt;</comment>
                            <comment id="808625" author="jeff.yemin" created="Tue, 20 Jan 2015 18:57:08 +0000"  >&lt;p&gt;How about a comment on the @throws javadoc for those methods saying that the driver no longer throws them?&lt;/p&gt;</comment>
                            <comment id="808575" author="kslepoy" created="Tue, 20 Jan 2015 18:26:54 +0000"  >&lt;p&gt;Right that makes sense. I guess you can&apos;t be perfect there... is there any way to let people know who are using the method so they don&apos;t run into the same issue. It is definitely broken.&lt;/p&gt;</comment>
                            <comment id="808463" author="jeff.yemin" created="Tue, 20 Jan 2015 17:42:06 +0000"  >&lt;p&gt;I agree it&apos;s confusing, but there was a tradeoff involved.  Although removing a checked exception from a method signature does not break binary compatibility, it does break source compatibility, and we were loathe to do that in a minor release, which is why we are waiting until 3.0 to do it.&lt;/p&gt;</comment>
                            <comment id="808426" author="kslepoy" created="Tue, 20 Jan 2015 17:32:51 +0000"  >&lt;p&gt;I see, I see. I&apos;m still confused as to why the method still said throws UnknownHostException if there is no exception ever thrown. I don&apos;t think that the constructor should indicate that it throws an exception if it doesn&apos;t-- it&apos;s misleading.&lt;/p&gt;</comment>
                            <comment id="808391" author="jeff.yemin" created="Tue, 20 Jan 2015 17:14:25 +0000"  >&lt;p&gt;Hi Konrad,&lt;/p&gt;

&lt;p&gt;This in an intentional change in behavior, but one that in retrospect we should have documented better.   Note that in the 3.0.x branch neither ServerAddress nor MongoClient constructors throw this exception any longer.&lt;/p&gt;

&lt;p&gt;As a result, if there is a DNS issue with any members of the seed list, the driver won&apos;t throw an exception until the application attempts to use the MongoClient to perform an operation against the server, and in some cases you won&apos;t even get an exception whereas before you would have.  For example, let&apos;s say you call the MongoClient constructor like this:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; MongoClient(&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; MongoClientURI(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;mongodb://goodSeed,badSeed&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;))&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;So long as at least one member of the seed list resolves in DNS, the application will be able to connect to the cluster, whereas prior to 2.12 the driver would have thrown an UnknownHostException.  &lt;/p&gt;

&lt;p&gt;If you truly want fail-fast behavior, you&apos;ll have to implement it yourself by resolving each seed list member in the application by, for example, calling com.mongodb.ServerAddress#getSocketAddress.&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|hs5l7j:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>157678</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="371">Java Sprint 14</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>