public static String s2583Fail(String a) {
try {
int length = a.length(); // after this, a cannot be null but if a == null it will throw a
// NullPointerException
return a + length;
} catch (Exception e) {
return a == null ? "No a: " + e.toString() : a; // SonarLint warns about S2583, but 'a' *can* be null
}
}
public static void main(String[] args) {
LOGGER.info(s2583Fail(null)); // S2259: SonarLint says a NPE will be thrown here, which it won't
}
--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/5014d8b7-0b74-49d8-a2fb-f0664b3e073f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.