SonarLint 4.16.0.31
I got (14,52) A “NullPOinterException
” could be thrown; “params
” is nullable here. In my opinion ArrayUtils.isNotEmpty
checks for null, so the sonar should not report this warning. Miss i something, or is it really false positive.
Many thanks, Ondra
Here is the problematic code:
import org.apache.commons.lang3.ArrayUtils;
class TestClass {
private static void method(int params[]) {
if (params != null) {
// do something
}
if (ArrayUtils.isNotEmpty(params) && params[params.length - 1] == 1) {
// do something
}
}
}