jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1380840 - /jmeter/trunk/src/functions/org/apache/jmeter/functions/RegexFunction.java
Date Tue, 04 Sep 2012 20:04:05 GMT
Author: pmouawad
Date: Tue Sep  4 20:04:05 2012
New Revision: 1380840

URL: http://svn.apache.org/viewvc?rev=1380840&view=rev
Log:
Use Integer.toString instead of concat
Cascade exceptions
Remove catch on NumberFormatException

Modified:
    jmeter/trunk/src/functions/org/apache/jmeter/functions/RegexFunction.java

Modified: jmeter/trunk/src/functions/org/apache/jmeter/functions/RegexFunction.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/RegexFunction.java?rev=1380840&r1=1380839&r2=1380840&view=diff
==============================================================================
--- jmeter/trunk/src/functions/org/apache/jmeter/functions/RegexFunction.java (original)
+++ jmeter/trunk/src/functions/org/apache/jmeter/functions/RegexFunction.java Tue Sep  4 20:04:05
2012
@@ -88,7 +88,9 @@ public class RegexFunction extends Abstr
     @Override
     public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
             throws InvalidVariableException {
-        String valueIndex = "", defaultValue = "", between = ""; //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
+        String valueIndex = ""; //$NON-NLS-1$
+        String defaultValue = ""; //$NON-NLS-1$
+        String between = ""; //$NON-NLS-1$ 
         String name = ""; //$NON-NLS-1$
         String inputVariable = ""; //$NON-NLS-1$
         Pattern searchPattern;
@@ -124,7 +126,8 @@ public class RegexFunction extends Abstr
                 inputVariable = ((CompoundVariable) values[6]).execute();
             }
         } catch (MalformedCachePatternException e) {
-            throw new InvalidVariableException(e.toString());
+            log.error("Malformed cache pattern:"+values[0], e);
+            throw new InvalidVariableException("Malformed cache pattern:"+values[0], e);
         }
 
         // Relatively expensive operation, so do it once
@@ -158,12 +161,9 @@ public class RegexFunction extends Abstr
                 MatchResult match = matcher.getMatch();
                 collectAllMatches.add(match);
             }
-        } catch (NumberFormatException e) {//TODO: can this occur?
-            log.error("", e); //$NON-NLS-1$
-            return defaultValue;
         } finally {
             if (name.length() > 0){
-                vars.put(name + "_matchNr", "" + collectAllMatches.size()); //$NON-NLS-1$
//$NON-NLS-2$
+                vars.put(name + "_matchNr", Integer.toString(collectAllMatches.size()));
//$NON-NLS-1$
             }
         }
 



Mime
View raw message