[ http://issues.apache.org/jira/browse/AXIS-2027?page=all ]
Jayachandra Sekhara Rao Sunkara updated AXIS-2027: -------------------------------------------------- Attachment: 2027.patch HTTP POST request mandates contentType header, so we shouldn't be allowing null or empty string as its value. Created a patch (as a cvs diff -u format) and am attaching the same. 'ant all-tests' ran fine. Thanks Jayachandra > 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 > 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