You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Usually all cases where `StringBuilder` (or the outdated `StringBuffer`) is used are either due to confusing (legacy) logic or may be replaced by a simpler string concatenation.
216
+
Usually all cases where `StringBuilder` (or the outdated `StringBuffer`) is used are either due to confusing (legacy) logic or in situations where it may be easily replaced by a simpler string concatenation.
215
217
216
218
Solution:
217
219
* Do not use `StringBuffer` because it's thread-safe and usually this is not needed
218
-
* If `StringBuilder` is only used in a simple method (like `toString`) and is effectively inlined: Use a simpler string concatenation (`"a" + x + "b"`). This will be optimized by the Java compiler internally.
220
+
* If `StringBuilder` is only used in a simple method (like `toString`) and is effectively inlined: Use a simpler string concatenation (`"a" + x + "b"`). This will be [optimized by the Java compiler internally](https://docs.oracle.com/javase/specs/jls/se25/html/jls-15.html#jls-15.18.1).
219
221
* In all other cases:
220
222
* Check what is happening and if it makes ANY sense! If for example a CSV file is built here consider using a proper library instead!
221
223
* Abstract the Strings into a DTO, join them together using a collection (or `StringJoiner`) or use Java's Streaming API instead
@@ -237,8 +239,8 @@ Solution:
237
239
message="Setters of java.lang.System should not be called unless really needed"
Calling setters of java.lang.System usually indicates bad design and likely causes unexpected behavior.
241
-
For example, it may break when multiple Threads are setting the value.
242
+
Calling setters of `java.lang.System` usually indicates bad design and likely causes unexpected behavior.
243
+
For example, it may break when multiple Threads are working with the same value.
242
244
It may also overwrite user defined options or properties.
243
245
244
246
Try to pass the value only to the place where it's really needed and use it there accordingly.
@@ -350,7 +352,8 @@ You can suppress this warning when you properly sanitized the name.
350
352
Nearly every known usage of (Java) Object Deserialization has resulted in [a security vulnerability](https://cloud.google.com/blog/topics/threat-intelligence/hunting-deserialization-exploits?hl=en).
351
353
Vulnerabilities are so common that there are [dedicated projects for exploit payload generation](https://github.com/frohoff/ysoserial).
352
354
353
-
Java Object Serialization may also fail to deserialize when the underlying classes are changed.
355
+
Java Object Serialization may also fail to deserialize properly when the underlying classes are changed.
356
+
This can result in unexpected crashes when outdated data is deserialized.
354
357
355
358
Use proven data interchange formats like JSON instead.
356
359
</description>
@@ -372,7 +375,8 @@ Use proven data interchange formats like JSON instead.
372
375
<rulename="VaadinNativeHTMLIsUnsafe"
373
376
language="java"
374
377
message="Unescaped native HTML is unsafe and will result in XSS vulnerabilities"
0 commit comments