You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2015/12/30 16:32:58 UTC

svn commit: r1722356 - /jmeter/trunk/src/core/org/apache/jmeter/report/core/Sample.java

Author: fschumacher
Date: Wed Dec 30 15:32:58 2015
New Revision: 1722356

URL: http://svn.apache.org/viewvc?rev=1722356&view=rev
Log:
Use constant instead of repeating the same string eight times.

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/report/core/Sample.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/report/core/Sample.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/core/Sample.java?rev=1722356&r1=1722355&r2=1722356&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/report/core/Sample.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/report/core/Sample.java Wed Dec 30 15:32:58 2015
@@ -31,6 +31,8 @@ import org.apache.jmeter.util.JMeterUtil
  */
 public class Sample {
 
+    private static final String ERROR_ON_SAMPLE = "Error on sample #";
+
     public final static String CONTROLLER_PATTERN = "Number of samples in transaction";
 
     private boolean storesStartTimeStamp;
@@ -101,7 +103,7 @@ public class Sample {
         try {
             return Integer.parseInt(data[metadata.indexOf(name)]);
         } catch (NumberFormatException ex) {
-            throw new SampleException("Error on sample #" + row, ex);
+            throw new SampleException(ERROR_ON_SAMPLE + row, ex);
         }
     }
 
@@ -118,7 +120,7 @@ public class Sample {
         try {
             return Integer.parseInt(data[i]);
         } catch (NumberFormatException ex) {
-            throw new SampleException("Error on sample #" + row, ex);
+            throw new SampleException(ERROR_ON_SAMPLE + row, ex);
         }
     }
 
@@ -136,7 +138,7 @@ public class Sample {
         try {
             return Long.parseLong(data[metadata.indexOf(name)]);
         } catch (NumberFormatException ex) {
-            throw new SampleException("Error on sample #" + row, ex);
+            throw new SampleException(ERROR_ON_SAMPLE + row, ex);
         }
     }
 
@@ -154,7 +156,7 @@ public class Sample {
         try {
             return Long.parseLong(data[i]);
         } catch (NumberFormatException ex) {
-            throw new SampleException("Error on sample #" + row, ex);
+            throw new SampleException(ERROR_ON_SAMPLE + row, ex);
         }
     }
 
@@ -172,7 +174,7 @@ public class Sample {
         try {
             return Float.parseFloat(data[metadata.indexOf(name)]);
         } catch (NumberFormatException ex) {
-            throw new SampleException("Error on sample #" + row, ex);
+            throw new SampleException(ERROR_ON_SAMPLE + row, ex);
         }
     }
 
@@ -189,7 +191,7 @@ public class Sample {
         try {
             return Float.parseFloat(data[i]);
         } catch (NumberFormatException ex) {
-            throw new SampleException("Error on sample #" + row, ex);
+            throw new SampleException(ERROR_ON_SAMPLE + row, ex);
         }
     }
 
@@ -207,7 +209,7 @@ public class Sample {
         try {
             return Double.valueOf(data[metadata.indexOf(name)]);
         } catch (NumberFormatException ex) {
-            throw new SampleException("Error on sample #" + row, ex);
+            throw new SampleException(ERROR_ON_SAMPLE + row, ex);
         }
     }
 
@@ -225,7 +227,7 @@ public class Sample {
         try {
             return Double.parseDouble(data[id]);
         } catch (NumberFormatException ex) {
-            throw new SampleException("Error on sample #" + row, ex);
+            throw new SampleException(ERROR_ON_SAMPLE + row, ex);
         }
     }