Uploaded image for project: 'Geronimo'
  1. Geronimo
  2. GERONIMO-4144

ArrayIndexOutOfBoundsException on InternetHeaders.addHeaderLine

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 2.1.1
    • None
    • mail
    • Security Level: public (Regular issues)
    • None

    Description

      I get this one when parsing the attached message using this code:

      byte[] messageBytes = mailString.getBytes("US-ASCII");
      mm = new MimeMessage(null, new ByteArrayInputStream(
      messageBytes));

      (mailString contains the string contained in the txt attachment)

      java.lang.ArrayIndexOutOfBoundsException: -1
      at java.util.ArrayList.get(ArrayList.java:324)
      at javax.mail.internet.InternetHeaders.addHeaderLine(InternetHeaders.java:538)
      at javax.mail.internet.InternetHeaders.load(InternetHeaders.java:124)
      at javax.mail.internet.InternetHeaders.<init>(InternetHeaders.java:99)
      at javax.mail.internet.MimeMessage.createInternetHeaders(MimeMessage.java:1457)
      at javax.mail.internet.MimeMessage.parse(MimeMessage.java:265)
      at javax.mail.internet.MimeMessage.<init>(MimeMessage.java:153)
      at org.apache.james.imapserver.codec.decode.imap4rev1.AppendCommandParser.mimeMessage(AppendCommandParser.java:102)
      at org.apache.james.imapserver.codec.decode.imap4rev1.AppendCommandParser.decode(AppendCommandParser.java:123)
      at org.apache.james.imapserver.codec.decode.base.AbstractImapCommandParser.parse(AbstractImapCommandParser.java:112)
      at org.apache.james.imapserver.codec.decode.main.DefaultImapDecoder.decodeCommandNamed(DefaultImapDecoder.java:113)
      at org.apache.james.imapserver.codec.decode.main.DefaultImapDecoder.decodeCommandTagged(DefaultImapDecoder.java:81)
      at org.apache.james.imapserver.codec.decode.main.DefaultImapDecoder.decode(DefaultImapDecoder.java:60)
      at org.apache.james.experimental.imapserver.ImapRequestHandler.doProcessRequest(ImapRequestHandler.java:136)
      at org.apache.james.experimental.imapserver.ImapRequestHandler.handleRequest(ImapRequestHandler.java:99)
      at org.apache.james.experimental.imapserver.ExperimentalHostSystem$Session.readLine(ExperimentalHostSystem.java:247)
      at org.apache.james.test.functional.imap.ProtocolSession$ServerResponse.readLine(ProtocolSession.java:331)
      at org.apache.james.test.functional.imap.ProtocolSession$ServerResponse.checkResponse(ProtocolSession.java:295)
      at org.apache.james.test.functional.imap.ProtocolSession$ServerResponse.testProtocol(ProtocolSession.java:285)
      at org.apache.james.test.functional.imap.ProtocolSession.runSessions(ProtocolSession.java:86)
      at org.apache.james.test.functional.imap.AbstractProtocolTest.runSessions(AbstractProtocolTest.java:100)
      at org.apache.james.test.functional.imap.SimpleScriptedTestProtocol.scriptTest(SimpleScriptedTestProtocol.java:68)
      at org.apache.james.test.functional.imap.AbstractTestUidSearch.testSearchAtomsUS(AbstractTestUidSearch.java:33)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

      Attachments

        1. message.txt
          12 kB
          Stefano Bagnara
        2. TestAddHeader.java
          0.9 kB
          Richard McGuire

        Issue Links

          Activity

            People

              rickmcguire Richard McGuire
              bago Stefano Bagnara
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: