If Java HTTP sampler sees null ResponseMessage, replace with HTTP header

git-svn-id: https://svn.apache.org/repos/asf/jakarta/jmeter/branches/rel-2-2@573250 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2007-09-06 13:11:01 +00:00
parent 360ce2c33e
commit ce30129dc9
3 changed files with 11 additions and 3 deletions

View File

@ -147,6 +147,11 @@
</li>
<li >
If Java HTTP sampler sees null ResponseMessage, replace with HTTP header
</li>
</ul>
<h4 >
Improvements
@ -545,7 +550,6 @@ has been removed.
</p>
<p >
Control-Z no longer used for Remote Start All - this now uses Control+Shift+R
</p>

View File

@ -493,9 +493,9 @@ public class HTTPSampler extends HTTPSamplerBase {
int errorLevel = conn.getResponseCode();
String respMsg = conn.getResponseMessage();
String hdr=conn.getHeaderField(0);
if (hdr == null) hdr="(null)"; // $NON-NLS-1$
if (errorLevel == -1){// Bug 38902 - sometimes -1 seems to be returned unnecessarily
String hdr=conn.getHeaderField(0);
if (hdr == null) hdr="(null)"; // $NON-NLS-1$
if (respMsg != null) {// Bug 41902 - NPE
try {
errorLevel = Integer.parseInt(respMsg.substring(0, 3));
@ -515,6 +515,9 @@ public class HTTPSampler extends HTTPSamplerBase {
}
res.setSuccessful(isSuccessCode(errorLevel));
if (respMsg == null) {// has been seen in a redirect
respMsg=hdr; // use header (if possible) if no message found
}
res.setResponseMessage(respMsg);
String ct = conn.getContentType();

View File

@ -34,6 +34,7 @@
<h4>Bug fixes</h4>
<ul>
<li>Fix NPE in SampleResultConverter - XStream PrettyPrintWriter cannot handle nulls</li>
<li>If Java HTTP sampler sees null ResponseMessage, replace with HTTP header</li>
</ul>
<h4>Improvements</h4>