Author: pmouawad
Date: Wed Oct  1 18:57:25 2014
New Revision: 1628809

URL: http://svn.apache.org/r1628809
Log:
Bug 56972 - Unable to Publish JMS Msg for Tibco EMS using Jmeter 
Publisher/Subscriber.
Fix java.lang.ArithmeticException: / by zero
Bugzilla Id: 56972

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/visualizers/TableSample.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/visualizers/TableSample.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/visualizers/TableSample.java?rev=1628809&r1=1628808&r2=1628809&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/visualizers/TableSample.java 
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/visualizers/TableSample.java Wed 
Oct  1 18:57:25 2014
@@ -62,9 +62,10 @@ public class TableSample implements Seri
         this.startTime = startTime;
         this.threadName = threadName;
         this.label = label;
-        this.elapsed = elapsed/sampleCount;
+        // SampleCount can be equal to 0, see SubscriberSampler#sample
+        this.elapsed = (sampleCount > 0) ? elapsed/sampleCount : 0;
+        this.bytes =  (sampleCount > 0) ? bytes/sampleCount : 0;
         this.success = success;
-        this.bytes = bytes/sampleCount;
         this.latency = latency;
     }
 
@@ -77,8 +78,8 @@ public class TableSample implements Seri
     public String getSampleNumberString(){
         StringBuilder sb = new StringBuilder();
         if (sampleCount > 1) {
-        sb.append(totalSamples-sampleCount+1);
-        sb.append('-');
+            sb.append(totalSamples-sampleCount+1);
+            sb.append('-');
         }
         sb.append(totalSamples);
         return sb.toString();


Reply via email to