I think this is false positive for provided java code sample:
public void getName(final ActionEvent event) {
Model server = getModel() == null
? null
: getModel().getServer();
try {
....
Sonar had a false positive error in line nr 4:
A "NullPointerException" could be thrown; "getModel()" can return null.
Colin
(Colin)
April 9, 2024, 2:16pm
2
I’ve moved your post to the section on reporting false-positives.
Can you update your post with the information requested in this post?
Hey SonarSource Community!
False-positives happen , as do false-negatives, and we’re eager to fix them. We are thrilled when our users report problems, so we can make our products better.
What is a false-positive (FP)?
A false-positive is when an issue is raised unexpectedly on code that should not trigger an issue, or where the suggested action doesn’t make any sense for the code.
What is a false-negative (FN)?
A false-negative is when an issue should be raised on a piece of code, but isn’t.
…