You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2016/12/21 13:37:33 UTC

svn commit: r1775417 - /jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java

Author: pmouawad
Date: Wed Dec 21 13:37:33 2016
New Revision: 1775417

URL: http://svn.apache.org/viewvc?rev=1775417&view=rev
Log:
Bug 54525 - Search Feature : Enhance it with ability to replace
Part 1 : create replace that counts number of replacements
Fix sonar code smell
Bugzilla Id: 54525

Modified:
    jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java

Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java?rev=1775417&r1=1775416&r2=1775417&view=diff
==============================================================================
--- jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java (original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java Wed Dec 21 13:37:33 2016
@@ -633,12 +633,12 @@ public final class JOrphanUtils {
                 java.util.regex.Pattern.compile(regex) :  
                 java.util.regex.Pattern.compile(regex, java.util.regex.Pattern.CASE_INSENSITIVE);
         String newText = source;
-        replacement = Matcher.quoteReplacement(replacement);
+        final String replacementQuoted = Matcher.quoteReplacement(replacement);
         Matcher matcher = pattern.matcher(newText);
         int totalReplaced = 0;
         while(true) {
             String previousText = newText;
-            newText = matcher.replaceFirst(replacement);
+            newText = matcher.replaceFirst(replacementQuoted);
             matcher = pattern.matcher(newText);
             if(newText.equals(previousText)) {
                 break;