<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:51:57 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-299] MongoUri does not work accoring to documentation</title>
                <link>https://jira.mongodb.org/browse/JAVA-299</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I tried using the documented format for the URI :&lt;/p&gt;


&lt;p&gt;But got an &quot;String index out of range&quot; error in line 69 of MongoUri-class. Upon examining the code, I see the problem :&lt;/p&gt;

&lt;p&gt;            if ( serverPart.indexOf( &quot;@&quot; ) &amp;gt; 0 )&lt;/p&gt;
{
                int idx = serverPart.indexOf( &quot;@&quot; );
                _username = serverPart.substring( 0 , idx );
                serverPart = serverPart.substring( idx + 1 );

                idx = serverPart.indexOf( &quot;:&quot; );
Line 69 :   _password = serverPart.substring( 0 , idx ).toCharArray(); 
                serverPart = serverPart.substring( idx + 1 );
            }

&lt;p&gt;In the above, I am guessing the problem is two-fold. &lt;/p&gt;

&lt;p&gt;1) In retrieving the password, you are using &quot;serverPart&quot; instead of &quot;_username&quot; . But now the &quot;serverPart&quot; parameter holds everything behind &quot;@&quot;.&lt;br/&gt;
2) No check that idx&amp;gt;0. Which may be right, since this would after all be a fault on the developer (maybe, depending upon the usage).&lt;/p&gt;

&lt;p&gt;In the above code, using &quot;serverPart&quot; instead of &quot;_username&quot;, the correct usage would be :&lt;/p&gt;

&lt;p&gt;mongodb://&amp;lt;username&amp;gt;@&amp;lt;password&amp;gt;:&amp;lt;server&amp;gt;/&amp;lt;db-name&amp;gt;.&amp;lt;db-collection&amp;gt;&lt;/p&gt;

&lt;p&gt;But I am guessing this is wrong. I have tried the above, and see that this does not throw an exception.&lt;/p&gt;</description>
                <environment>Windows 7, Spring 3, Java.</environment>
        <key id="15173">JAVA-299</key>
            <summary>MongoUri does not work accoring to documentation</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="scotthernandez">Scott Hernandez</assignee>
                                    <reporter username="ragnaraas">Ragnar Aas</reporter>
                        <labels>
                    </labels>
                <created>Fri, 18 Mar 2011 13:31:37 +0000</created>
                <updated>Tue, 16 Nov 2021 17:36:32 +0000</updated>
                            <resolved>Thu, 21 Apr 2011 00:03:12 +0000</resolved>
                                    <version>2.5</version>
                                    <fixVersion>2.6</fixVersion>
                                    <component>API</component>
                                        <votes>1</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="29412" author="auto" created="Thu, 21 Apr 2011 00:02:55 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;login&apos;: u&apos;rcugut&apos;, u&apos;name&apos;: u&apos;Radu Cugut&apos;, u&apos;email&apos;: u&apos;rcugut@gmail.com&apos;}
&lt;p&gt;Message: Bugfix: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-299&quot; title=&quot;MongoUri does not work accoring to documentation&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-299&quot;&gt;&lt;del&gt;JAVA-299&lt;/del&gt;&lt;/a&gt; - MongoURI does not parse URIs as specified in the documentation (&lt;a href=&quot;http://www.mongodb.org/display/DOCS/Connections&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.mongodb.org/display/DOCS/Connections&lt;/a&gt;)&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/1cb8f5cb57dc8d457f0fe1b4ec061876c99c98c2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/1cb8f5cb57dc8d457f0fe1b4ec061876c99c98c2&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="29276" author="JIRAUSER1253297" created="Tue, 19 Apr 2011 14:24:29 +0000"  >&lt;p&gt;Same problem with our code. Using 2.5.3. We hacked it to use the form user@pass:hostname. But recently, we took advantage of the fact this is an open-source project and fixed it in the code and pushed a maven artifact in our private repo &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;There is a pull-request on github that fixes this&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/pull/30&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/pull/30&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|hrhcdr:</customfieldvalue>

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