Re-opening this as a new ticket since the original was close without any opportunity to respond. This references original ticket #3531425. In that ticket, wpugh stated:
"OK, I can't tell because you didn't give a full test case. I believe your
issue as in the attached example.
FindBugs isn't warning about a possible null dereference in that line.
Rather, on that line it sees that c is being tested for null, and further
down in your code it sees a dereference of c and is warning about a null
dereference there. The precondition call is the place where the value is
known to be null.
The problem is that FindBugs doesn't understand that Contract.precondition
will always throw an exception if the second argument is false. Such
analysis is rather difficult.
Is the Contract.precondition method you are calling one from a standard
FindBugs reports the "Possible null pointer dereference" as Critical for the following line of code:
Contract.precondition("dataset connection is not null" , c != null && c.isConnected());
The Contract.precondition throws an Exception if the statement is not true, but if c is null, it won't execute isConnected() and if c is non-null then it should be fine.
It is not clear why FindBugs reports this as a possible null pointer dereference.
Attached is a snapshot of actual code being violated according to FindBugs. There you will see that it IS complaining about the line of code mentioned above. Also, the test case attached to 3531425 is essentially what Contract.precondition is doing. It is not a public standard library but rather a private one used throughout our company. In the attached snapshot it would appear that FindBugs is complaining both about the call to conn.isConnected within the call to Contract.precondition and then also FURTHER DOWN THE LINE when the call conn.querySQL(sql) is called as well.
So, do you still think that FindBugs cannot analyze this properly?