[JAVA-1012] MongoException thrown for any document that has key named 'err' Created: 12/Oct/13 Updated: 13/Oct/13 Resolved: 13/Oct/13 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | 2.11.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Carl Sayres | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
I've found a bug in the mongo java driver (v.2.11.3). Any document containing a key 'err' or 'errmsg' will throw a MongoException when retrieved using findOne(). com.mongodb.MongoException: POSTAL_CODE_NOT_FOUND I traced the problem to com.mongodb.ServerError. public class ServerError { ServerError( DBObject o ) { _err = getMsg( o , null ); if ( _err == null ) throw new IllegalArgumentException( "need to have $err" ); _code = getCode( o ); }static String getMsg( BSONObject o , String def ) { Object e = o.get( "$err" ); if ( e == null ) e = o.get( "err" ); if ( e == null ) e = o.get( "errmsg" ); if ( e == null ) return def; return e.toString(); }Not sure why it would try to interpret an application level 'err' message as a reason to throw a MongoException: |
| Comments |
| Comment by Jeffrey Yemin [ 13/Oct/13 ] |
|
This has been fixed already as part of |