Make sure to read this post before raising a thread here:
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…
Then tell us:
S5164
SonarQube - Community Edition Version 8.9.7 (build 52159)
class FpS5164
{
private static final ThreadLocal<JsonNode> TL = new ThreadLocal<>();
void clean()
{
TL.remove();
}
}
The false positive disappears by changing ThreadLocal type from JsonNode to String.
com.fasterxml.jackson.databind.JsonNode
ganncamp
(G Ann Campbell)
March 9, 2023, 4:05pm
2
Hi,
Welcome to the community and thanks for this report!
The current LTS is 9.9. Could you upgrade and see if this is replicable?
Thx,
Ann
Hi,
We currently have no way to upgrade the version to LTS 9.9.
Are there any other options to check this case for an issue?
Thanks,
Alex
ganncamp
(G Ann Campbell)
March 14, 2023, 11:14am
4
Hi Alex,
If you’re on the latest version of SonarLint and not in connected mode, you’ll run the most up-to-date implementation of the rule. So that would be another way to check. And you probably wanted SonarLint in your IDE anyway, didn’t you?
Ann
Hi Ann,
Thanks for the quick response.
I have ran the analyze in the latest version of SonarLint and the issue was not detected.
Does this mean that rule S5164 has incorrect behavior for this case in SonarQube version 8.9.7?
Thanks,
Alex
ganncamp
(G Ann Campbell)
March 14, 2023, 12:25pm
6
Hi Alex,
Yes, that’s what it means. And once you upgrade, you’ll get the correct behavior.
Ann