Return-Path: Delivered-To: apmail-geronimo-dev-archive@www.apache.org Received: (qmail 79762 invoked from network); 8 Apr 2008 03:48:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Apr 2008 03:48:09 -0000 Received: (qmail 16426 invoked by uid 500); 8 Apr 2008 03:48:07 -0000 Delivered-To: apmail-geronimo-dev-archive@geronimo.apache.org Received: (qmail 16376 invoked by uid 500); 8 Apr 2008 03:48:07 -0000 Mailing-List: contact dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list dev@geronimo.apache.org Received: (qmail 16365 invoked by uid 99); 8 Apr 2008 03:48:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Apr 2008 20:48:07 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Apr 2008 03:47:34 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id ED799234C0C4 for ; Mon, 7 Apr 2008 20:45:24 -0700 (PDT) Message-ID: <806757761.1207626324971.JavaMail.jira@brutus> Date: Mon, 7 Apr 2008 20:45:24 -0700 (PDT) From: "Davanum Srinivas (JIRA)" To: dev@geronimo.apache.org Subject: [jira] Created: (GERONIMO-3953) ArrayIndexOutOfBoundsException reading MimeMultipart from a file with multiple attachments. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org ArrayIndexOutOfBoundsException reading MimeMultipart from a file with multiple attachments. ------------------------------------------------------------------------------------------- Key: GERONIMO-3953 URL: https://issues.apache.org/jira/browse/GERONIMO-3953 Project: Geronimo Issue Type: Bug Security Level: public (Regular issues) Components: mail Reporter: Davanum Srinivas Here's the stack trace : ====================================================================== java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0 at java.util.Vector.get(Vector.java:710) at javax.mail.Multipart.getBodyPart(Multipart.java:93) at javax.mail.internet.MimeMultipart.getBodyPart(MimeMultipart.java:110) at javax.mail.internet.MimeMultipartTest.testMIMEWriting(MimeMultipartTest.java:107) ====================================================================== Here's the code snippet to recreate the issue : ============================================== C:\Apache\geronimo-javamail_1.4_spec>svn diff Index: src/test/java/javax/mail/internet/MimeMultipartTest.java =================================================================== --- src/test/java/javax/mail/internet/MimeMultipartTest.java (revision 645758) +++ src/test/java/javax/mail/internet/MimeMultipartTest.java (working copy) @@ -26,6 +26,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.FileInputStream; import java.util.Properties; import javax.mail.BodyPart; import javax.mail.MessagingException; @@ -95,6 +96,23 @@ assertEquals("This is a preamble\r\n", ((MimeMultipart)newMessage.getContent()).getPreamble()); } + public void testMIMEWriting() throws IOException, MessagingException { + FileInputStream inStream = new FileInputStream("src/test/resources/wmtom.bin"); + Properties props = new Properties(); + javax.mail.Session session = javax.mail.Session + .getInstance(props, null); + MimeMessage mimeMessage = new MimeMessage(session, inStream); + DataHandler dh = mimeMessage.getDataHandler(); + MimeMultipart multiPart = new MimeMultipart(dh.getDataSource()); + MimeBodyPart mimeBodyPart0 = (MimeBodyPart) multiPart.getBodyPart(0); + Object object0 = mimeBodyPart0.getContent(); + assertNotNull(object0); + MimeBodyPart mimeBodyPart1 = (MimeBodyPart) multiPart.getBodyPart(1); + Object object1 = mimeBodyPart1.getContent(); + assertNotNull(object1); + assertEquals(multiPart.getCount(), 2); + } + protected void writeToSetUp() throws Exception { defaultMap = CommandMap.getDefaultCommandMap(); MailcapCommandMap myMap = new MailcapCommandMap(); i'll upload wmtom.bin as an attachment -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.