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 2014/10/28 22:12:30 UTC
svn commit: r1634990 -
/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
Author: pmouawad
Date: Tue Oct 28 21:12:30 2014
New Revision: 1634990
URL: http://svn.apache.org/r1634990
Log:
When HTTP Request contains an empty host, we get a NPE instead of a clear message.
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1634990&r1=1634989&r2=1634990&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java Tue Oct 28 21:12:30 2014
@@ -883,20 +883,23 @@ public class HTTPHC4Impl extends HTTPHCA
* @return the headers as a string
*/
private String getConnectionHeaders(HttpRequest method) {
- // Get all the request headers
- StringBuilder hdrs = new StringBuilder(100);
- Header[] requestHeaders = method.getAllHeaders();
- for(int i = 0; i < requestHeaders.length; i++) {
- // Exclude the COOKIE header, since cookie is reported separately in the sample
- if(!HTTPConstants.HEADER_COOKIE.equalsIgnoreCase(requestHeaders[i].getName())) {
- hdrs.append(requestHeaders[i].getName());
- hdrs.append(": "); // $NON-NLS-1$
- hdrs.append(requestHeaders[i].getValue());
- hdrs.append("\n"); // $NON-NLS-1$
+ if(method != null) {
+ // Get all the request headers
+ StringBuilder hdrs = new StringBuilder(100);
+ Header[] requestHeaders = method.getAllHeaders();
+ for(int i = 0; i < requestHeaders.length; i++) {
+ // Exclude the COOKIE header, since cookie is reported separately in the sample
+ if(!HTTPConstants.HEADER_COOKIE.equalsIgnoreCase(requestHeaders[i].getName())) {
+ hdrs.append(requestHeaders[i].getName());
+ hdrs.append(": "); // $NON-NLS-1$
+ hdrs.append(requestHeaders[i].getValue());
+ hdrs.append("\n"); // $NON-NLS-1$
+ }
}
+
+ return hdrs.toString();
}
-
- return hdrs.toString();
+ return ""; ////$NON-NLS-1$
}
/**