<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:51:38 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-159] Issue with ObjectId.isValid method</title>
                <link>https://jira.mongodb.org/browse/JAVA-159</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>
&lt;p&gt;if you see the ObjectId.java (&lt;a href=&quot;http://github.com/mongodb/mongo-java-&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://github.com/mongodb/mongo-java-&lt;/a&gt;&lt;br/&gt;
driver/blob/master/src/main/org/bson/types/ObjectId.java)&lt;/p&gt;

&lt;p&gt;isValid(String) method it returns &quot;true&quot; for those strings whose&lt;br/&gt;
character length is between 18 and 24 and whose each character happens&lt;br/&gt;
to be a qualified hex character.&lt;/p&gt;

&lt;p&gt;And then if you see the constructor code, you would notice following&lt;br/&gt;
piece of code:&lt;/p&gt;

&lt;p&gt;byte b[] = new byte&lt;span class=&quot;error&quot;&gt;&amp;#91;12&amp;#93;&lt;/span&gt;;&lt;br/&gt;
       for ( int i=0; i&amp;lt;b.length; i++ )&lt;/p&gt;
{
           b[b.length-(i+1)] =
(byte)Integer.parseInt( s.substring( i*2 , i*2 + 2) , 16 );
       }

&lt;p&gt;Here it expects the string to be of 24 characters.&lt;/p&gt;

&lt;p&gt;Hence sometimes though isValid method returns true it cannot create a&lt;br/&gt;
valid ObjectId. It throws java.lang.StringIndexOutOfBoundsException:&lt;br/&gt;
String index out of range.&lt;/p&gt;

&lt;p&gt;This is an important issue as in some cases does not allow to store valid data.&lt;/p&gt;</description>
                <environment>All</environment>
        <key id="12950">JAVA-159</key>
            <summary>Issue with ObjectId.isValid method</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="eliot">Eliot Horowitz</assignee>
                                    <reporter username="mrgautamsam">Shyamantak</reporter>
                        <labels>
                    </labels>
                <created>Mon, 30 Aug 2010 17:50:03 +0000</created>
                <updated>Fri, 29 Oct 2010 02:49:59 +0000</updated>
                            <resolved>Tue, 28 Sep 2010 17:23:11 +0000</resolved>
                                    <version>2.0</version>
                    <version>2.1</version>
                                    <fixVersion>2.2</fixVersion>
                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="18733" author="mrgautamsam" created="Fri, 1 Oct 2010 10:59:19 +0000"  >&lt;p&gt;Excellent!! Thanks a lot Eliot for letting know about it.&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|hrhcwv:</customfieldvalue>

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