Comments (6)
Yeah, that's an unfortunate false positive.
So lets see. Why is that a valid case. Well it's because you are not using the result of getText() again. So I guess really we should look to see if the thing that is being trimmed, and thrown away, is being used again.
What this would mean is that the trim() call is probably in a conditional expression, and doesn't show up again in the if or else of the conditional.
Ok, that seems right. Let's see what can be done.
from fb-contrib.
The issue is of course the trim() may be called on a string that is produced thru a long chain of methods, (yours is a chain, albeit not too long). Finding that pattern again is probably hard, which is probably why the FP exists today. Maybe it's good enough to look for the last method that produces the string to be trimmed, in this case, look for a call to WebElement.getText() regardless of what web element it was called on. sure that is broken too, but probably reduces the false positives to close to 0 (in exchange for a higher FN rate).
from fb-contrib.
Well, in this case, there's just a void method call and then return; is that a useful pattern for distinguishing false positives?
Maybe, if there is no further string access (no access to string variables, no method calls returning string) in one branch of the conditional, then it's considered legitimate? I guess that might still mask actual errors in the case where someone should have persisted the trimmed version, but didn't...although that should only matter for instance/static variables.
from fb-contrib.
yes that would be good enough to rule out, although, there would still be possible FPs. But that would be better.
from fb-contrib.
@ThrawnCA could you see if that resolves your issue?
from fb-contrib.
Well, it broke the FindBugs check, which is only enforced in the Maven build :D. But it was a deliberate thing (switch fall-through), so I just added a suppression annotation. The trim false positive is fixed :).
from fb-contrib.
Related Issues (20)
- false-positive in EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS when rethrowing exception HOT 2
- 7.6.0.sb is missing from maven central HOT 2
- NullPointerException HOT 1
- Regressoin of BAS_BLOATED_ASSIGNMENT_SCOPE after update from 7.6.0 to 7.6.1 HOT 1
- WOC_WRITE_ONLY_COLLECTION_LOCAL false positive if collection is read in lambda HOT 1
- Why not just rename repo to 'sb-contrib' and stop deploying 'fb-contrib' HOT 5
- WOC_WRITE_ONLY_COLLECTION_FIELD for constant collections HOT 1
- Couldn't find "findbugs.xml" in plugin PluginLoader
- Show the GitHub repository clearly on the official website, so that more people can learn about fb.
- `IncorrectInternalClassUse` throws a `ClassFormatException` after upgrading to Spotbugs 6.0.3 HOT 5
- Thoughts on donating this project to spotbugs as its so frequently used with spotbugs HOT 4
- False positives due to ignoring field accesses from inner classes
- False positive FCBL_FIELD_COULD_BE_LOCAL for private field of nested class
- False-positive MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR for method reference HOT 2
- False positives for try-with-resources (NP_LOAD_OF_KNOWN_NULL_VALUE, RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE) HOT 2
- Code compiled with target 11 (and not 1.8) does not find all bug warnings
- False-positive in OPM_OVERLY_PERMISSIVE_METHOD for equals HOT 1
- `FII_USE_FUNCTION_IDENTITY` false-positive
- BCEL errors with fb-contrib 7.6.4 HOT 1
- FII_USE_FUNCTION_IDENTITY false positive HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fb-contrib.