[JAVA-399] bad bson decode/encode Created: 21/Jul/11  Updated: 25/Jun/13  Resolved: 28/Apr/12

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: 2.6
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: hadar Assignee: Unassigned
Resolution: Duplicate Votes: 1
Labels: bson
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

linux ubuntu 10+


Issue Links:
Duplicate
duplicates JAVA-521 JSON parser parses longs as ints Closed

 Description   

bad decoding of bson long numbers.
this bug happens on our remote ubuntu servers. i wasn't able to reproduce this on my desktop ubuntu in eclipse debugging mode.
is this related to some dependencies?machine 32/64bit configuration??
this doesn't happen with 2.5 and older.

byte[] bsonobj1 = BSON.encode(new BasicDBObject("test", -6155364211098656392l));
DBObject longdecode = (DBObject) JSON.parse(BSON.decode(bsonobj1).toString());
System.out.println(longdecode);

{ "test" : -833625736}

 Comments   
Comment by Jeffrey Yemin [ 28/Apr/12 ]

The bug is actually in JsonParser. Numbers < Integer.MAX_VALUE were being turned into integers, including numbers Integer.MIN_VALUE.

Comment by Jeffrey Yemin [ 28/Apr/12 ]

Duplicate of JAVA-521

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