FindBugs is throwing NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE
in the return statement of the below method. Tried to put null check for every value but I'm still unable to fix.
public String toString() {
String filter = StringUtils.isBlank(this.filter) ? "NONE" : this.filter;
String res = "";
if (method != null && method.getName() != null){
res = method.getName();
}
return res;
}
Seems that FindBugs is not aware that two separate calls of the getName()
return the same value (analyzing this would be quite hard). Seems that your getName()
method actually sometimes returns null, so FindBugs internally marks this method return type as @CheckForNull
. To remove warning call the method only once. For example like this:
String res = null;
if (method != null)
res = method.getName();
if (res == null)
res = "";
return res;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With