Address some issues discover by SonarQube analysis:
"String#replace" should be preferred to "String#replaceAll" java:S5361
The underlying implementation of String::replaceAll calls the java.util.regex.Pattern.compile() method each time it is called even if the first argument is not a regular expression. This has a significant performance cost and therefore should be used with care.
Child class fields should not shadow parent class fields java:S2387
e.g: "log" is the name of a field in "SvrProcess"
Should use || instead of | and should use && instead of &
Try-with-resources should be used java:S2093
This syntax is safer than the traditional method using try, catch, and finally and hence should be preferred.
Instance methods should not write to "static" fields java:S2696
Not thread safe update of static variable in non-static method
Insecure temporary file creation methods should not be used java:S5445
Use "Files.createTempDirectory" to create this directory instead
Double-checked locking should not be used java:S2168
Environment
None
Activity
Show:
Carlos Ruiz March 6, 2025 at 10:15 PM
Hi - I think peer review will be easier if we do a ticket per each Sonar rule.
Address some issues discover by SonarQube analysis:
"String#replace" should be preferred to "String#replaceAll" java:S5361
The underlying implementation of String::replaceAll calls the java.util.regex.Pattern.compile() method each time it is called even if the first argument is not a regular expression. This has a significant performance cost and therefore should be used with care.
Child class fields should not shadow parent class fields java:S2387
e.g: "log" is the name of a field in "SvrProcess"
Should use || instead of | and should use && instead of &
Try-with-resources should be used java:S2093
This syntax is safer than the traditional method using try, catch, and finally and hence should be preferred.
Instance methods should not write to "static" fields java:S2696
Not thread safe update of static variable in non-static method
Insecure temporary file creation methods should not be used java:S5445
Use "Files.createTempDirectory" to create this directory instead
Double-checked locking should not be used java:S2168