Null Pointer not detected

Basic Information :

  • versions :
  • error observed : Null Pointer not detected
  • steps to reproduce : Nothing to report
  • potential workaround : Nothing to report


I have a bug with Sonar.
During an Java analysis, Sonar did not detect a null pointer exception on this code :

 public MyClass(MyObject o) {
        if(o.getGlobalStatus() != null && o.getSpecificStatus().getStatus() != null) {
            this.nameStatus = o.getGlobalStatus().getStatus().getName();


Indeed, it is possible to have a null pointer exception on the call to getStatus() if getSpecificStatus() return null.

You can easily imagine that the mistake is that we want to put getGlobalStatus() instead of getSpecificStatus(). I believe that Sonar reflected as we did during the analysis and did not see our mistake.

Sorry for my english

Have a good day

Could you specify which version of sonarjava is installed on your sonarqube instance ?
What is the code of the method getSpecificStatus() ? more specifically is it annotated with @CheckForNull or any annotation making it explicit that it can return null ?