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/28 21:47:06 UTC

svn commit: r1776336 - /jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java

Author: pmouawad
Date: Wed Dec 28 21:47:06 2016
New Revision: 1776336

URL: http://svn.apache.org/viewvc?rev=1776336&view=rev
Log:
sonar: fix errors 

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java?rev=1776336&r1=1776335&r2=1776336&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java Wed Dec 28 21:47:06 2016
@@ -129,15 +129,17 @@ public class SampleResult implements Ser
     private static final boolean START_TIMESTAMP = 
             JMeterUtils.getPropDefault("sampleresult.timestamp.start", false);  // $NON-NLS-1$
 
-    // Allow read-only access from test code
-    private static final boolean USENANOTIME = 
+    /**
+     * Allow read-only access from test code
+     */
+    private static final boolean USE_NANO_TIME = 
             JMeterUtils.getPropDefault("sampleresult.useNanoTime", true);  // $NON-NLS-1$
     
     /**
      * How long between checks of nanotime; default 5000ms; set to <=0 to disable the thread
      */
     private static final long NANOTHREAD_SLEEP = 
-            JMeterUtils.getPropDefault("sampleresult.nanoThreadSleep", 5000);  // $NON-NLS-1$;
+            JMeterUtils.getPropDefault("sampleresult.nanoThreadSleep", 5000);  // $NON-NLS-1$
 
     static {
         if (START_TIMESTAMP) {
@@ -146,10 +148,10 @@ public class SampleResult implements Ser
             log.info("Note: Sample TimeStamps are END times");
         }
         log.info("sampleresult.default.encoding is set to " + DEFAULT_ENCODING);
-        log.info("sampleresult.useNanoTime="+USENANOTIME);
+        log.info("sampleresult.useNanoTime="+USE_NANO_TIME);
         log.info("sampleresult.nanoThreadSleep="+NANOTHREAD_SLEEP);
 
-        if (USENANOTIME && NANOTHREAD_SLEEP > 0) {
+        if (USE_NANO_TIME && NANOTHREAD_SLEEP > 0) {
             // Make sure we start with a reasonable value
             NanoOffset.nanoOffset = System.currentTimeMillis() - SampleResult.sampleNsClockInMs();
             NanoOffset nanoOffset = new NanoOffset();
@@ -182,8 +184,10 @@ public class SampleResult implements Ser
 
     private String requestHeaders = "";
 
-    // TODO timeStamp == 0 means either not yet initialised or no stamp available (e.g. when loading a results file)
-    /** the time stamp - can be start or end */
+    /**
+     * timeStamp == 0 means either not yet initialised or no stamp available (e.g. when loading a results file)
+     * the time stamp - can be start or end 
+     */
     private long timeStamp = 0;
 
     private long startTime = 0;
@@ -268,6 +272,8 @@ public class SampleResult implements Ser
     final long nanoThreadSleep;
     
     private long sentBytes;
+    
+    private URL location;
 
     /**
      * Cache for responseData as string to avoid multiple computations
@@ -275,7 +281,7 @@ public class SampleResult implements Ser
     private transient volatile String responseDataAsString;
 
     public SampleResult() {
-        this(USENANOTIME, NANOTHREAD_SLEEP);
+        this(USE_NANO_TIME, NANOTHREAD_SLEEP);
     }
 
     // Allow test code to change the default useNanoTime setting
@@ -1320,7 +1326,6 @@ public class SampleResult implements Ser
         this.timeStamp = timeStamp;
     }
 
-    private URL location;
 
     public void setURL(URL location) {
         this.location = location;
@@ -1414,6 +1419,7 @@ public class SampleResult implements Ser
 
     /**
      * @return the body size in bytes
+     * @deprecated replaced by getBodySizeAsLong()
      */
     @Deprecated
     public int getBodySize() {
@@ -1469,6 +1475,7 @@ public class SampleResult implements Ser
                 nanoOffset = clock - nano;
             } catch (InterruptedException ignore) {
                 // ignored
+                Thread.currentThread().interrupt();
             }
         }