[JAVA-905] BasicBSONObject.equals doesn't handle Number values correctly Created: 30/Jul/13  Updated: 31/Mar/15  Resolved: 19/Aug/13

Status: Closed
Project: Java Driver
Component/s: BSON
Affects Version/s: 2.11.2
Fix Version/s: 2.11.3, 3.0.0

Type: Bug Priority: Major - P3
Reporter: Jon Hoffman Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Number.doubleValue is compared, but that will drop precision from a large Long value and falsely consider two different Numbers to be equal.

Pull request here: https://github.com/mongodb/mongo-java-driver/pull/133



 Comments   
Comment by Jeffrey Yemin [ 31/Mar/15 ]

Closing all resolved 3.0.0 issues, as 3.0.0 has been tagged and released.

Comment by auto [ 12/Sep/13 ]

Author:

{u'username': u'trnl', u'name': u'Uladzimir Mihura', u'email': u'trnl.me@gmail.com'}

Message: Merge pull request #133 from foursquare/bsonequals

JAVA-905: BasicBSONObject.equals doesn't handle Number values correctly
Branch: 2.11.x
https://github.com/mongodb/mongo-java-driver/commit/1afd29ace35effd25431984a66f74be19b3d6ea3

Comment by auto [ 12/Sep/13 ]

Author:

{u'username': u'trnl', u'name': u'Uladzimir Mihura', u'email': u'trnl.me@gmail.com'}

Message: Merge pull request #133 from foursquare/bsonequals

JAVA-905: BasicBSONObject.equals doesn't handle Number values correctly
Branch: 2.11.x
https://github.com/mongodb/mongo-java-driver/commit/e051f612fe07c93ea10198b9dfa41ee56b073ef4

Comment by auto [ 16/Aug/13 ]

Author:

{u'username': u'trnl', u'name': u'Uladzimir Mihura', u'email': u'trnl.me@gmail.com'}

Message: fix(driver-compat) JAVA-905: BasicBSONObject.equals doesn't handle Number values correctly
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/9ca989aa0dd0214be42740865099000f915e242a

Comment by auto [ 16/Aug/13 ]

Author:

{u'username': u'trnl', u'name': u'Uladzimir Mihura', u'email': u'trnl.me@gmail.com'}

Message: Merge pull request #133 from foursquare/bsonequals

JAVA-905: BasicBSONObject.equals doesn't handle Number values correctly
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/401490a9be25d0183b23bc04d4a12afb28abc255

Comment by Uladzimir Mihura [ 16/Aug/13 ]

Thank you Jon for your ticket and pull request.

I'm going to merge it, but actually I think that it was a bad idea to compare Number subclasses to each other.

Generated at Thu Feb 08 08:53:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.