[ http://issues.apache.org/jira/browse/AXIS-2027?page=all ]
     
Tom Jordahl closed AXIS-2027:
-----------------------------

     Resolution: Fixed
    Fix Version: 1.2.1

Checked in a modified version that adds the defensive code and throws an error 
if there is a missing content-Type.

Thanks.
Tom

> org.apache.axis.transport.HTTPSender throws ArrayIndexOutOfBoundsException
> --------------------------------------------------------------------------
>
>          Key: AXIS-2027
>          URL: http://issues.apache.org/jira/browse/AXIS-2027
>      Project: Axis
>         Type: Bug
>     Versions: 1.2
>  Environment: Windows XP Professional
> Tomcat 4.1.31
> Java 1.4.2_04-b05
>     Reporter: Martin Genhart
>      Fix For: 1.2.1
>  Attachments: 2027.patch
>
> While requesting a webservice through HTTP POST, I'm getting an 
> ArrayIndexOutOfBoundsException. Debugging into this, it turned out that there 
> is a bug in org.apache.axis.transport.HTTPSender.writeToSocket(...).
> On line 331 there is a code sequence like this:
>         if (posting) {
>                 String contentType;
>             if (mimeHeaders.getHeader(HTTPConstants.HEADER_CONTENT_TYPE) != 
> null) {
>                 contentType = 
> mimeHeaders.getHeader(HTTPConstants.HEADER_CONTENT_TYPE)[0];
>             } else {
>                 contentType = 
> reqMessage.getContentType(msgContext.getSOAPConstants());
>             }
>             header2.append(HTTPConstants.HEADER_CONTENT_TYPE)
>                     .append(": ")
>                     .append(contentType)
>                     .append("\r\n");
>         }
> In my case mimeHeaders.getHeader(...) returned an empty String array, which 
> causes the bug on the next line. Changeing that code to test for empty sting 
> arrays as well fixes the problem:
>         if (posting) {
>             String contentType;
>             Object[] test = 
> mimeHeaders.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
>             if (test != null && test.length > 0) {
>                 contentType = 
> mimeHeaders.getHeader(HTTPConstants.HEADER_CONTENT_TYPE)[0];
>             } else {
>                 contentType = 
> reqMessage.getContentType(msgContext.getSOAPConstants());
>             }
>             header2.append(HTTPConstants.HEADER_CONTENT_TYPE)
>                     .append(": ")
>                     .append(contentType)
>                     .append("\r\n");
>         }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to