[
https://issues.apache.org/jira/browse/GERONIMO-3953?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Davanum Srinivas updated GERONIMO-3953:
---------------------------------------
Description:
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)
======================================================================
Please see the uploaded diff to existing test case to demonstrate the issue.
was:
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
> 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: test.diff, 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)
> ======================================================================
> Please see the uploaded diff to existing test case to demonstrate the issue.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.