Community
Participate
Working Groups
<sniplet> LOG.error("Can't log eventData: " + eventData, ex); //$NON-NLS-1$ // ^^^^^^^^^ if this is commented out, there is no subsequent warning if (eventData != null) // WARNING: The variable eventData cannot be null..... { /** log eventData to logger */ PDWLogger.PWD_FAILED_LOG.info(eventData); } </sniplet> It seems the compiler assumes string concatenation as a pointer dereference, but string concatenation accepts null values and prints "(null)" w/o any NullPointerException, so the subsequent check is reachable with a null value, and the check is ok and should not get warned.
String concatenation of null values is detected as a false posive, too. Object x = null; System.out.println( "x=" + x ); // Warning In this case it is often desired behaviour to get the output x=(null)
Added NullReferenceTest #126-127. *** This bug has been marked as a duplicate of 127919 ***