Comments (7)
Also, the detector should not object to storing the String value of java.util.UUID
.
from fb-contrib.
If these are false positives, i'll live with them. I realize that examples are often quite fabricated in nature, but really the first one seems suspect to me. Likely, you'd want that 18n'ed so that would be wrong on that count, but even so, I'd rather the appending be done at the very last second possible (in getMessage). If I can push people to converting objects to strings at the fringes of their application, say in json serializers, jpa converters, etc, etc, i'd be happy fella.
As for the UUID, splitting hairs i suppose, but i'd rather people store the field as a UUID.
from fb-contrib.
The actual case for the first scenario was setting a status message in an object that would become a Freemarker template's data model. Doing the String formatting at the point of rendering isn't really feasible, since the status message is a generic field (included at the top of all pages) that can contain whatever message the application specifies, and Freemarker isn't really designed for this kind of arbitrary string interpolation (as a template language, it expects the structure to be known in advance).
Performance is not a concern in this context, so if String.format
will make the problem go away, it's probably a suitable workaround.
As for UUID, we use it to generate random IDs within Hibernate domain objects (not the actual @Id
field). We don't care about them as UUIDs after creation, so it's not really worth having a type converter, and toString
looks like the official method for obtaining the value.
from fb-contrib.
Bump.
Can this be ignored for java.util.UUID
, since toString
appears to be the canonical way of retrieving the value (https://docs.oracle.com/javase/7/docs/api/java/util/UUID.html)?
from fb-contrib.
Bump.
What about the possibility of ignoring this rule when the field is annotated as a JPA column?
from fb-contrib.
wouldn't you normally have @converter s on them?
from fb-contrib.
We could use a Converter
, but as previously mentioned, often we really don't care about the value after creation - we just use java.util.UUID
as a way of generating the ID - so constantly converting between String and UUID would be wasted effort for us. I think that if a field is a JPA column, then that is a reasonable excuse to store a String in it.
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.