Getting NP_LOAD_OF_KNOWN_NULL_VALUE raised with the following code:
public class FbNullCheck {
public void test(final boolean test) {
String s = null;
try {
if (test) {
return;
}
throw new IllegalStateException("Illegal Exception");
} catch (final Exception e) {
s = "test";
throw new RuntimeException("Runtime Exception", e);
} finally {
method(s);
}
}
private void method (final String method) {
}
}
When method() is called s can be a not null value if test=false so that the IllegalStateException is raise, caught by the catch and s assigned.
This detector relies on Line Number debug info during the analysis of finally blocks. Are you compiling with debug information? It's always recommended to switch on the debug information when using FindBugs.
thanks. Fixed.