I have a simple method:
public String getValue(String tag) {
if (StringUtils.isBlank(tag)) {
return null;
}
return tag.substring(tag.lastIndexOf('/') + 1).trim();
}
Which is then called later on like this:
String tag = node.getNodeValue(); <-- from org.w3c.dom.Node
String value = getValue(tag);
String price = getAttribute(param1, param2, getValue(value));
SonarQube is warning me about a NullPointerException:
"NullPointerException" will be thrown when invoking method "getValue()" <-- the second call
However, I fail to see how. The method by itself is null-proof. What is happening ? Is SonarQube unable to go down the StringUtils.isBlank
method ? Or is it the getAttribute()
method that will give me the NullPointerException, and the error message can seem misleading ?