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

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27237

ArrayIndexOutOfBounds Exception on invalid content-length

           Summary: ArrayIndexOutOfBounds Exception on invalid content-
                    length
           Product: Commons
           Version: 2.0 Final
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: HttpClient
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


If the server returns an invalid (not parsable to int) content legnth the method
protected int getResponseContentLength() in HttpMethodBase walks off the
end of the Header[] array and throws the ArrayIndexOutOfBoundsException.

The loop at line 687 in HttpMethodBase.java:

   for (int i = headers.length - 1; i >= 0; i++) {

starts at the end of the array, but uses ++ intead of -- and so walks off the
end of the array on the next line if the header is invalid.  If the header is
valid the return statement in the try block succeeds so there is no error.

The fix is simply to change the line to be

   for (int i = headers.length -1; i>=0; i--) {

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

Reply via email to