You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2007/08/13 17:46:03 UTC

svn commit: r565384 - in /jakarta/jmeter/branches/rel-2-2: src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java xdocs/changes.xml

Author: sebb
Date: Mon Aug 13 08:46:02 2007
New Revision: 565384

URL: http://svn.apache.org/viewvc?view=rev&rev=565384
Log:
Fix possible NPE in HTTPSampler2 if 302 does not have Location header.

Modified:
    jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
    jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml

Modified: jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java?view=diff&rev=565384&r1=565383&r2=565384
==============================================================================
--- jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java (original)
+++ jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java Mon Aug 13 08:46:02 2007
@@ -834,7 +834,11 @@
 
 			res.setResponseHeaders(getResponseHeaders(httpMethod));
 			if (res.isRedirect()) {
-				res.setRedirectLocation(httpMethod.getResponseHeader(HEADER_LOCATION).getValue());
+				final Header headerLocation = httpMethod.getResponseHeader(HEADER_LOCATION);
+				if (headerLocation == null) { // HTTP protocol violation, but avoids NPE
+					throw new IllegalArgumentException("Missing location header");
+				}
+				res.setRedirectLocation(headerLocation.getValue());
 			}
 
             // If we redirected automatically, the URL may have changed

Modified: jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml?view=diff&rev=565384&r1=565383&r2=565384
==============================================================================
--- jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml (original)
+++ jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml Mon Aug 13 08:46:02 2007
@@ -39,6 +39,7 @@
 <li>Bug 43006 - NPE if icon.properties file not found</li>
 <li>Bug 42918 - Size Assertion now treats an empty response as having zero length</li>
 <li>Bug 43007 - Test ends before all threadgroups started</li>
+<li>Fix possible NPE in HTTPSampler2 if 302 does not have Location header.</li>
 </ul>
 
 <h3>Version 2.3RC3</h3>



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org