I have a sonar signal for this call minRating.getRatgCaam()
The warning relates to the sonar rule: Null pointers should not be dereferenced.
Example:
AgencyRating minRating = null;
.......
if (!getRatingUtilities().isNR(minRating)) {
return minRating.getRatgCaam();
}
The method isNR(minRating)is a helper method that checks, among other things, if the minRating object is null
public boolean isNR(AgencyRating rating) {
return rating == null || isNR(rating.getRatgCaam());
}
When I added an unimportant check, as the sonar suggests. Sonar is fine.
if (minRating !=null && !getRatingUtilities().isNR(minRating)) {
return minRating.getRatgCaam();
}
Sonar cannot determine that the helper method has performed a null check. I do not need to perform this check again.
Is my case false?
source
share