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.
217
217
218
218
Solution:
219
219
* Do not use `StringBuffer` because it's thread-safe and usually this is not needed
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.
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).
221
221
* In all other cases:
222
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!
223
223
* Abstract the Strings into a DTO, join them together using a collection (or `StringJoiner`) or use Java's Streaming API instead
@@ -239,8 +239,8 @@ Solution:
239
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.
243
-
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.
244
244
It may also overwrite user defined options or properties.
245
245
246
246
Try to pass the value only to the place where it's really needed and use it there accordingly.
@@ -352,7 +352,8 @@ You can suppress this warning when you properly sanitized the name.
352
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).
353
353
Vulnerabilities are so common that there are [dedicated projects for exploit payload generation](https://github.com/frohoff/ysoserial).
354
354
355
-
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.
356
357
357
358
Use proven data interchange formats like JSON instead.
358
359
</description>
@@ -374,7 +375,8 @@ Use proven data interchange formats like JSON instead.
374
375
<rulename="VaadinNativeHTMLIsUnsafe"
375
376
language="java"
376
377
message="Unescaped native HTML is unsafe and will result in XSS vulnerabilities"
0 commit comments