jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1785049 - /jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java
Date Wed, 01 Mar 2017 21:51:00 GMT
Author: pmouawad
Date: Wed Mar  1 21:51:00 2017
New Revision: 1785049

URL: http://svn.apache.org/viewvc?rev=1785049&view=rev
Log:
Avoid exception is duration is empty

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java

Modified: jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java?rev=1785049&r1=1785048&r2=1785049&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java Wed Mar  1 21:51:00
2017
@@ -22,6 +22,7 @@ import java.util.HashSet;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.jmeter.config.ConfigTestElement;
 import org.apache.jmeter.samplers.AbstractSampler;
 import org.apache.jmeter.samplers.Entry;
@@ -107,10 +108,15 @@ public class TestAction extends Abstract
     private void pause(String timeInMillis) {
         long millis;
         try {
-            millis=Long.parseLong(timeInMillis);
+            if(!StringUtils.isEmpty(timeInMillis)) {
+                millis=Long.parseLong(timeInMillis);
+            } else {
+                log.warn("Duration value is empty, defaulting to 0");
+                millis=0L;
+            }
         } catch (NumberFormatException e){
             log.warn("Could not parse number: '{}'", timeInMillis);
-            millis=0;
+            millis=0L;
         }
         try {
             pauseThread = Thread.currentThread();



Mime
View raw message