markmclaren / java-gmail-imap

Automatically exported from code.google.com/p/java-gmail-imap
0 stars 0 forks source link

Multipart ClassCast Exception #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Open up gmail connection
2. Try to view a multipart messsage

java.lang.ClassCastException: com.google.code.com.sun.mail.imap.IMAPInputStream 
cannot be cast to com.google.code.javax.mail.Multipart

Using trunk build

I am trying to better understand the problem and see if I can fix myself.

FYI: If I instead view the stream this is what I get:

Content Typemultipart/ALTERNATIVE; 
    boundary="----_=_NextPart_001_01C87ECD.9FF943C2"
Read: This is a multi-part message in MIME format.

------_=_NextPart_001_01C87ECD.9FF943C2
Content-Type: text/plain;
    charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

... contents of text/plain part ...

------_=_NextPart_001_01C87ECD.9FF943C2
Content-Type: text/html;
    charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

... contents of text/html part ...

------_=_NextPart_001_01C87ECD.9FF943C2--

Original issue reported on code.google.com by johnbett...@gmail.com on 18 Oct 2011 at 10:03

GoogleCodeExporter commented 9 years ago
Woops forgot to add what I was doing!

Multipart mp = (Multipart) message.getContent();

Original comment by johnbett...@gmail.com on 18 Oct 2011 at 10:16

GoogleCodeExporter commented 9 years ago
Thanks John.  I've added a version of the mailcap properties file that is 
adjusted to point at the classes in this project rather than the JavaMail 
classes.  I think this fixes your ClassCastException issues. The latest Jar 
download (java-gmail-imap-1.4.4-gm-ext-0.2.jar) now also contains this file.

Many Thanks

Original comment by mark.mcl...@gmail.com on 29 Oct 2011 at 10:25