What is the meaning of Possible null pointer dereference in findbug?

前端 未结 5 651
悲哀的现实
悲哀的现实 2021-02-07 11:00

I am using Sonar and I have got this kind of violation from it for a peace of my code:

 Correctness - Possible null pointer dereference  

Has a

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-07 11:22

    It says here

    NP: Possible null pointer dereference (NP_NULL_ON_SOME_PATH)
    

    There is a branch of statement that, if executed, guarantees that a null value will be dereferenced, which would generate a NullPointerException when the code is executed. Of course, the problem might be that the branch or statement is infeasible and that the null pointer exception can't ever be executed; deciding that is beyond the ability of FindBugs.

    If you would have posted some code it would be easier to answer.

    EDIT I don't see a lot of documentation but here is one example! Hope this helps!

提交回复
热议问题