[JAVA] FP: A "NullPointerException" could be thrown

473 views
Skip to first unread message

Julien Herr

unread,
Aug 5, 2017, 3:57:35 PM8/5/17
to SonarQube
Hi,

I think something is missing in the flow analyze of NPE:

https://sonarcloud.io/project/issues?id=org.testng%3Atestng&open=AV1GDm51NAVDjyrgWoft&resolved=false&severities=MAJOR&sinceLeakPeriod=true&types=BUG



Step 2: if stack is null, "getTestRoot" return -1
Step 4: it won't be reached if "stack" is "null" because -1 < 0

Regards,
Julien

Tibor Blenessy

unread,
Sep 5, 2017, 12:46:12 PM9/5/17
to Julien Herr, SonarQube
Hello Julien,

sorry for the late answer, unfortunately, the link is dead now. Do you by chance remember the file where issue was detected?

Best regards

Tibor


--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/aaad3a71-8473-4e4c-9174-4200747ecfb2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Tibor Blenessy | SonarSource

SonarJava Developer

http://sonarsource.com 

Julien Herr

unread,
Sep 5, 2017, 3:05:30 PM9/5/17
to SonarQube, jul...@herr.fr


Le mardi 5 septembre 2017 18:46:12 UTC+2, Tibor Blenessy a écrit :
Hello Julien,

sorry for the late answer, unfortunately, the link is dead now.

No prob! :)
 
Do you by chance remember the file where issue was detected?

Tibor Blenessy

unread,
Sep 22, 2017, 5:15:40 AM9/22/17
to Julien Herr, SonarQube
Hello Julien,

sorry again for the late answer. Indeed this is a false positive, because data flow engine in SonarJava doesn't yet understand arithmetic expressions like -1 < 0 , so it is unable to detect that condition is impossible. We definitely want to implement this feature, but I for the time being can't provide you any timeframe nor concrete JIRA ticket. 

Thank you for reporting the issue, it's always good to have user feedback on which features are needed.

Cheers,

Tibor


For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages