[JAVA-1030] ClassCastException inside DBPort.SaslAuthenticator when custom BSON decoder is used Created: 23/Oct/13  Updated: 23/Oct/13  Resolved: 23/Oct/13

Status: Closed
Project: Java Driver
Component/s: Authentication, BSON
Affects Version/s: 2.11.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Emil Goicovici Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The implementation inside the DBPort.SaslAuthenticator.authenticate() method is making some class casting assuming that a given field (e.g. res.get("payload") ) is an instance of the expected class ( e.g. byte[] ). However, when custom BSON decoder is used for example returns org.bson.types.Binary instances instead of byte[] ones, these assumptions made inside the SaslAuthenticator.authenticate() are wrong and a ClassCastException will occur.

Given these assumptions made inside the authenticate() method, it is necessary to change the sendSaslStart() call so that it uses the standard DefaultDBDecoder and not the user chosen one (which is set using a DBDecoderFactory).



 Comments   
Comment by Jeffrey Yemin [ 23/Oct/13 ]

OK, thanks. Resolving as a duplicate then.

Comment by Emil Goicovici [ 23/Oct/13 ]

I'm new to this issue tracker, so I don't know what workflow is used here. You can close this issue / mark it as duplicate.

Comment by Emil Goicovici [ 23/Oct/13 ]

No, I don't need backporting the fix because currently I've overcame this issue by patching the DBPort class and recompiling the MongoDB Java Driver. It sounds good if it has already been fixed on the 3.0 branch. Thank you.

Comment by Jeffrey Yemin [ 23/Oct/13 ]

This has been reported in JAVA-883 and fixed in the 3.0 branch. Can you work around this, or would you like us to consider backporting the fix?

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