Uploaded image for project: 'Axis'
  1. Axis
  2. AXIS-2027

org.apache.axis.transport.HTTPSender throws ArrayIndexOutOfBoundsException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2
    • 1.2.1
    • None
    • None
    • Windows XP Professional
      Tomcat 4.1.31
      Java 1.4.2_04-b05

    Description

      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");
      }

      Attachments

        1. 2027.patch
          0.8 kB
          Jayachandra Sekhara Rao Sunkara

        Activity

          People

            Unassigned Unassigned
            mgenhart Martin Genhart
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: