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:35:50 UTC

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

Author: pmouawad
Date: Wed Dec 21 13:35:50 2016
New Revision: 1775416

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

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=1775416&r1=1775415&r2=1775416&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:35:50 2016
@@ -632,13 +632,12 @@ public final class JOrphanUtils {
         java.util.regex.Pattern pattern = caseSensitive ? 
                 java.util.regex.Pattern.compile(regex) :  
                 java.util.regex.Pattern.compile(regex, java.util.regex.Pattern.CASE_INSENSITIVE);
-        String previousText = null;
         String newText = source;
         replacement = Matcher.quoteReplacement(replacement);
         Matcher matcher = pattern.matcher(newText);
         int totalReplaced = 0;
-        while(!newText.equals(previousText)) {
-            previousText = newText;
+        while(true) {
+            String previousText = newText;
             newText = matcher.replaceFirst(replacement);
             matcher = pattern.matcher(newText);
             if(newText.equals(previousText)) {