<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:51:43 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-200] ObjectId breaks Java equals() symmetric property</title>
                <link>https://jira.mongodb.org/browse/JAVA-200</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;equals() in Java must be symmetric, but an ObjectId might compare equal to a String, but (obviously) not the other way around.&lt;/p&gt;

&lt;p&gt;ObjectId obj = new ObjectId();&lt;br/&gt;
String str = obj.toString();&lt;br/&gt;
assertEquals(obj.equals(str), str.equals(obj);&lt;/p&gt;

&lt;p&gt;obj.equals(str) =&amp;gt; true&lt;br/&gt;
str.equals(obj) =&amp;gt; false&lt;/p&gt;

&lt;p&gt;This is because ObjectId.equals() calls massageToObjectId which will turn the String into an ObjectId (if it isValid); but String.equals() doesn&apos;t turn &quot;any object&quot; to its String representation.&lt;/p&gt;

&lt;p&gt;The fix is fortunately easy: implement equals() without calling massageToObjectId:&lt;br/&gt;
    public boolean equals( Object o ){&lt;br/&gt;
        if ( this == o )&lt;br/&gt;
            return true;&lt;/p&gt;

&lt;p&gt;        if ( o instanceof ObjectId )&lt;/p&gt;
{
            ObjectId other = (ObjectId)o;
            return 
                _time == other._time &amp;amp;&amp;amp; 
                _machine == other._machine &amp;amp;&amp;amp; 
                _inc == other._inc;
        }
&lt;p&gt;        return false;&lt;br/&gt;
    }&lt;/p&gt;</description>
                <environment></environment>
        <key id="13477">JAVA-200</key>
            <summary>ObjectId breaks Java equals() symmetric property</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="t.broyer">Thomas Broyer</reporter>
                        <labels>
                    </labels>
                <created>Sat, 23 Oct 2010 14:54:37 +0000</created>
                <updated>Fri, 29 Oct 2010 02:50:54 +0000</updated>
                            <resolved>Sat, 23 Oct 2010 21:10:00 +0000</resolved>
                                    <version>2.2</version>
                                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="19552" author="eliot" created="Sat, 23 Oct 2010 21:10:00 +0000"  >&lt;p&gt;The general consensus a while back was that this was the desired behavior.&lt;br/&gt;
Would have to get a big majority of people to want to change behavior.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10011"><![CDATA[Minor Change]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <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|hrhcov:</customfieldvalue>

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