Use replace instead of replaceAll in toCleanString

This is from SonarLint (rule.java:S4348)
Regex patterns should not be created needlessly:

When String::replaceAll is used, the first argument should be a real
regular expression. If it’s not the case, String::replace does exactly
the same thing as String::replaceAll without the performance drawback of
the regex.

Change-Id: I00ba967ff4a27eeeb6fccf9373f6df2c94ecd823
This commit is contained in:
Eryk Szymanski 2022-11-08 18:22:50 +01:00 committed by Matthias Sohn
parent 3a49749308
commit bd2aced4a3
1 changed files with 1 additions and 1 deletions

View File

@ -115,7 +115,7 @@ private static String toCleanString(List<String> list) {
for (String v : list) {
if (s.length() > 0)
s.append(',');
s.append(v.replaceAll("\n", "").trim()); //$NON-NLS-1$ //$NON-NLS-2$
s.append(v.replace("\n", "").trim()); //$NON-NLS-1$ //$NON-NLS-2$
}
return s.toString();
}