Quentin
(Quentin Jaquier)
June 12, 2023, 3:14pm
2
Hello @Cyrille_Mortier and welcome to the Sonar Community.
I invite you to have a look at this post, answering a similar issue:
Hello @Bhuvana
The analyzer assumes that two consecutive method calls do not necessarily return the same value.
It means that a null check on the first call to getBody() is not enough to avoid a NPE. You should extract the method call into a variable to not have an issue.
In a way, this is a limitation of the analyzer, it is not able to detect if a method always returns the same value or not, so it reports an issue anyway, taking the risk to report false positives. If you are confident your c…
I hope it clarifies the situation.
Best,
Quentin