geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davanum Srinivas (JIRA)" <j...@apache.org>
Subject [jira] Updated: (GERONIMO-3953) ArrayIndexOutOfBoundsException reading MimeMultipart from a file with multiple attachments.
Date Tue, 08 Apr 2008 10:31:24 GMT

     [ https://issues.apache.org/jira/browse/GERONIMO-3953?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Davanum Srinivas updated GERONIMO-3953:
---------------------------------------

    Attachment: wmtom.bin

Here's the file as promised.

-- dims

> 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
>         Attachments: wmtom.bin
>
>
> 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.


Mime
View raw message