False Positive on "A NullPointerException" could be thrown

  • versions used (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube Version 6.7.6 (build 38781)
    sonar-maven-plugin 3.2

  • error observed
    Code variable is checked for null with (if !Utils.isNullOrEmpty(state)) condition but sonar flags that a NullPointerException could be thrown (see attached image)

  • potential workaround
    put inline, code from helper function
    !( str == null || “”.equals(str.trim()); )

Hi,

Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

xxx → 7.9.6 → 8.9.7 → 9.3 (last step optional)

You may find the Upgrade Guide and the LTS-to-LTS Upgrade Notes helpful. If you have questions about upgrading, feel free to open a new thread for that here.

If your issue persists after upgrade, please come back to us.