[JAVA-3883] Coverity analysis defect 116580: Dereference null return value Created: 05/Nov/20  Updated: 27/Oct/23  Resolved: 25/Nov/20

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

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Unassigned
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Dereference null return value

If the function actually returns a null value, a NullPointerException will be thrown. Return value of function which returns null is dereferenced without checking
/bson/src/main/org/bson/codecs/pojo/PojoCodecImpl.java:102: NULL_RETURNS 116580 Assigning: "instanceCreator" = "null" return value from "getInstanceCreator".
/bson/src/main/org/bson/codecs/pojo/PojoCodecImpl.java:104: NULL_RETURNS 116580 Calling a method on null object "instanceCreator".



 Comments   
Comment by Jeffrey Yemin [ 25/Nov/20 ]

In practice the instance creator will never be null, so this can safely be ignored.

Comment by Coverity Collector User [ 05/Nov/20 ]

A new defect has been detected and assigned to milkie in Coverity Connect.
http://coverity.mongodb.com/query/defects.htm?project=Java+Driver&cid=116580
The defect was flagged by checker NULL_RETURNS in
file /bson/src/main/org/bson/codecs/pojo/PojoCodecImpl.java
function org.bson.codecs.pojo.PojoCodecImpl.decode(org.bson.BsonReader, org.bson.codecs.DecoderContext)
and this ticket was created by milkie

Generated at Thu Feb 08 09:00:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.