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 2015/02/15 14:31:45 UTC

svn commit: r1659922 - in /jmeter/trunk: src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java xdocs/changes.xml

Author: pmouawad
Date: Sun Feb 15 13:31:44 2015
New Revision: 1659922

URL: http://svn.apache.org/r1659922
Log:
Bug 57579 - NullPointerException error is raised on main sample if "RETURN_NO_SAMPLE" is used (default) and "Use Cache-Control / Expires header..." is checked in HTTP Cache Manager 
Bugzilla Id: 57579

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java?rev=1659922&r1=1659921&r2=1659922&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java Sun Feb 15 13:31:44 2015
@@ -168,7 +168,9 @@ public class AccessLogSampler extends HT
             }
             count = thisCount;
             res = sample();
-            res.setSampleLabel(toString());
+            if(res != null) {
+                res.setSampleLabel(toString());
+            }
         } catch (Exception e) {
             log.warn("Sampling failure", e);
             return errorResult(e, new HTTPSampleResult());

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=1659922&r1=1659921&r2=1659922&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java Sun Feb 15 13:31:44 2015
@@ -1142,7 +1142,9 @@ public abstract class HTTPSamplerBase ex
         SampleResult res = null;
         try {
             res = sample(getUrl(), getMethod(), false, 0);
-            res.setSampleLabel(getName());
+            if(res != null) {
+                res.setSampleLabel(getName());
+            }
             return res;
         } catch (Exception e) {
             return errorResult(e, new HTTPSampleResult());
@@ -1166,7 +1168,7 @@ public abstract class HTTPSamplerBase ex
      * @param depth
      *            Depth of this target in the frame structure. Used only to
      *            prevent infinite recursion.
-     * @return results of the sampling
+     * @return results of the sampling, can be null if u is in CacheManager
      */
     protected abstract HTTPSampleResult sample(URL u,
             String method, boolean areFollowingRedirect, int depth);
@@ -1483,7 +1485,13 @@ public abstract class HTTPSamplerBase ex
                 if (log.isDebugEnabled()) {
                     log.debug("Location as URL: " + url.toString());
                 }
-                lastRes = sample(url, method, true, frameDepth);
+                HTTPSampleResult tempRes = sample(url, method, true, frameDepth);
+                if(tempRes != null) {
+                    lastRes = tempRes;
+                } else {
+                    // Last url was in cache so tempRes is null
+                    break;
+                }
             } catch (MalformedURLException e) {
                 errorResult(e, lastRes);
                 // The redirect URL we got was not a valid URL

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1659922&r1=1659921&r2=1659922&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sun Feb 15 13:31:44 2015
@@ -143,6 +143,7 @@ See  <bugzilla>56357</bugzilla> for deta
 <h3>HTTP Samplers and Test Script Recorder</h3>
 <ul>
 <li><bug>57385</bug>Getting empty thread name in xml result for HTTP requests with "Follow Redirects" set. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
+<li><bug>57579</bug>NullPointerException error is raised on main sample if "RETURN_NO_SAMPLE" is used (default) and "Use Cache-Control / Expires header..." is checked in HTTP Cache Manager</li>
 </ul>
 
 <h3>Other Samplers</h3>