From bd2aced4a33690641d8a35f48b4839b55e35920b Mon Sep 17 00:00:00 2001 From: Eryk Szymanski Date: Tue, 8 Nov 2022 18:22:50 +0100 Subject: [PATCH] Use replace instead of replaceAll in toCleanString MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java index 81a70af2d..4fec5da78 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java @@ -115,7 +115,7 @@ private static String toCleanString(List 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(); }