[JAVA-2197] toJson() method in ByteBufBsonDocument throws exception if called more than once Created: 30/May/16  Updated: 19/Oct/16  Resolved: 06/Jun/16

Status: Closed
Project: Java Driver
Component/s: BSON
Affects Version/s: 3.1.0
Fix Version/s: 0.8

Type: Bug Priority: Major - P3
Reporter: Anton Musikhin Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

toString() (toJson()) method in ByteBufBsonDocument object breaks this object, therefore it is impossible to use more than one CommandListener. If event.getCommand().toJson() in second listener is called than an "org.bson.BsonSerializationException: While decoding a BSON document 4 bytes were required, but only 0 remain" will be occured.



 Comments   
Comment by Githook User [ 13/Jun/16 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-2197: In ByteBufBsonDocument use internal Finder interface to implement the size method
Branch: 3.2.x
https://github.com/mongodb/mongo-java-driver/commit/017a2e0f9258fefcfc1accdcba9cf63bb5bd81fc

Comment by Githook User [ 07/Jun/16 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-2197: In ByteBufBsonDocument use internal Finder interface to implement the size method
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/79a6e9366139a40129015c041f1bc25aad784343

Comment by Githook User [ 03/Jun/16 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-2197: Always duplicate the internal ByteBuf of ByteBufBsonDocument before use.
Branch: 3.2.x
https://github.com/mongodb/mongo-java-driver/commit/4694694094d6fda7cfd5279197dd0c978a5d1238

Comment by Githook User [ 03/Jun/16 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-2197: Always duplicate the internal ByteBuf of ByteBufBsonDocument before use.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/d98c9cd0db486f3c4e63998a6bf0b4b9c12ded16

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