DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38902>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38902

           Summary: Workaround for HTTPSampler when getReponseCode returns -
                    1
           Product: JMeter
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Main
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


In our own usage sometimes the call to conn.getResponseCode(); would return -1
for no apparent reason when in fact the responseCode was 200.  We could not pin
down the source of this problem and had to hadd the following lines to parse the
HTTP Response Message and use that as the response code.

      if(errorLevel == - 1) {
        try {
          int code = Integer.parseInt(res.getResponseMessage().substring(0, 3));
          res.setResponseCode(Integer.toString(code));
          res.setSuccessful(200 <= code && code <= 399);
        } catch (Exception e) {
          res.setSuccessful(false);
        }
      }

Obviously this is a hack, but I'm sending this out in case anyone else 
runs across this and wants to see how we worked around it.


FYI patch works on trunk and 2.1.1 branch as of this writing.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to