[JAVA-782] Document Null pointer exception being thrown for BasicBSONObject.getLong() and .getInt() Created: 08/Mar/13  Updated: 08/Dec/17  Resolved: 08/Dec/17

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

Type: Improvement Priority: Major - P3
Reporter: Gianfranco Palumbo Assignee: Unassigned
Resolution: Won't Fix Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related

 Description   

Document that when the field is either not existent, or not a number, it throws an NullPointer exception

BasicDBObject dbo = new BasicDBObject();
System.out.println(dbo.get("A"));       // => null
System.out.println(dbo.getString("A")); // => null
System.out.println(dbo.getDate("A"));   // => null
System.out.println(dbo.getLong("A"));   // => throws NullPointer
System.out.println(dbo.getInt("A"));    // => throws NullPointer

links:
http://api.mongodb.org/java/2.0/org/bson/BasicBSONObject.html#getLong(java.lang.String)
http://api.mongodb.org/java/2.0/org/bson/BasicBSONObject.html#getInt(java.lang.String)



 Comments   
Comment by Jeffrey Yemin [ 08/Dec/17 ]

As the new CRUD API prefers Document class, we're not investing any more effort into DBObject.

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