<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:41 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-609] ObjectId equals(...) broken</title>
                <link>https://jira.mongodb.org/browse/JAVA-609</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;&lt;tt&gt;ObjectId&lt;/tt&gt;&apos;s &lt;tt&gt;equals(...)&lt;/tt&gt; method is implemented invalidly. &lt;tt&gt;equals(...)&lt;/tt&gt; methods need to be symmetrical, which means if &lt;tt&gt;A.equals(B)&lt;/tt&gt; is &lt;tt&gt;true&lt;/tt&gt;, &lt;tt&gt;B.equals(A)&lt;/tt&gt; needs to be &lt;tt&gt;true&lt;/tt&gt; as well. This is not the case as the implementation massages &lt;tt&gt;String&lt;/tt&gt; values into &lt;tt&gt;ObjectId&lt;/tt&gt; instances and thus surprisingly the following code succeeds:&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;ObjectId left = &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; ObjectId();&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;String right = left.toString();&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;&amp;nbsp;&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;assertThat(left, is(right)); &lt;/span&gt;&lt;span style=&quot;color: #008200; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;// succeeds&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;This breaks once you test for symmetry:&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;assertThat(right, is(left)); &lt;/span&gt;&lt;span style=&quot;color: #008200; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;// fails&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</description>
                <environment></environment>
        <key id="45256">JAVA-609</key>
            <summary>ObjectId equals(...) broken</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="oliver.gierke">Oliver Gierke</reporter>
                        <labels>
                    </labels>
                <created>Tue, 24 Jul 2012 18:40:25 +0000</created>
                <updated>Tue, 31 Mar 2015 20:10:06 +0000</updated>
                            <resolved>Tue, 25 Jun 2013 16:58:28 +0000</resolved>
                                    <version>2.7.3</version>
                                    <fixVersion>3.0.0</fixVersion>
                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="869521" author="jeff.yemin" created="Tue, 31 Mar 2015 20:10:06 +0000"  >&lt;p&gt;Closing all resolved 3.0.0 issues, as 3.0.0 has been tagged and released.&lt;/p&gt;</comment>
                            <comment id="348733" author="auto" created="Thu, 30 May 2013 11:41:40 +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: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-609&quot; title=&quot;ObjectId equals(...) broken&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-609&quot;&gt;&lt;del&gt;JAVA-609&lt;/del&gt;&lt;/a&gt;, &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-586&quot; title=&quot;ObjectId MachineId uses network interface names instead of mac address or something more unique&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-586&quot;&gt;&lt;del&gt;JAVA-586&lt;/del&gt;&lt;/a&gt;, &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-749&quot; title=&quot;Make ObjectId conform to specification&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-749&quot;&gt;&lt;del&gt;JAVA-749&lt;/del&gt;&lt;/a&gt;: Major changes to ObjectId class.  The major change is that ObjectId now conforms to the spec.  Instead of representing as 3 4-byte value, it now properly uses a 4-byte timestamp, 3-byte machine identifier, 2-byte process identifier, and 3-byte counter.&lt;/p&gt;

&lt;p&gt;The logic for generating machine identifier has changed.  Since we are java 6 minimum now, using NetworkInterface.getHardwareAddress() for more uniqueness.&lt;/p&gt;

&lt;p&gt;The logic for generating process identifier has changed.  It attempts to get the actual numeric process id from JMX, falling back to a string hash only if if it can&apos;t.  It looks for a pattern in the process name of &amp;lt;process_id&amp;gt;@&amp;lt;host_name&amp;gt;.  No longer using the classloader hash either, since each class loader will have a separate instance of NEXT_COUNTER, which is seeded with a random number and so is very unlikely to clash.&lt;/p&gt;

&lt;p&gt;Removed a bunch of stuff&lt;/p&gt;

&lt;p&gt; Removed support for &apos;babble&apos; format.&lt;br/&gt;
 Removed constructors that didn&apos;t conform to the spec (machine identifier only, instead of machine identifer and process identifier)&lt;br/&gt;
 Removed support for isNew/notNew.  I don&apos;t see a need for this.  It was only used in save method, and it seems the only purpose is to decide whether to do an insert of an upsert.  I don&apos;t see any harm in always doing an upsert.  This also has&lt;br/&gt;
 the nice property of making ObjectId immutable.&lt;br/&gt;
 Removed a bunch of poorly named methods: _flip(int), _inc(), _machine(), _time()&lt;br/&gt;
 Removed massageToObjectId(java.lang.Object)&apos; factory method&lt;/p&gt;

&lt;p&gt; Other non-backwards compatible changes:&lt;/p&gt;

&lt;p&gt;  equals method will no longer compare equal to anything but an ObjectId&lt;/p&gt;

&lt;p&gt; Additionally, added getters that conform to the spec: timestamp, machineIdentifier, processIdentifier, and counter.  Deprecated the old ones.&lt;br/&gt;
Branch: 3.0.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/aa4b4355c808e045ce00cc1dfbdd0bf78fb6901a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/aa4b4355c808e045ce00cc1dfbdd0bf78fb6901a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="157206" author="jeff.yemin" created="Mon, 27 Aug 2012 21:20:58 +0000"  >&lt;p&gt;This is incorrect behavior, but have to be careful since changing it could break existing clients who are relying on 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|hrghyf:</customfieldvalue>

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