Re: Re: Exception in IMAPBodyPart
Cedric Hyppolite <[email protected]> Tue, 2 May 2006 19:58:42 +0200
| Newsgroups | gmane.comp.java.classpath.extensions.discuss |
|---|---|
| Message-ID | <[email protected]> |
Hi Chris,
You were right, it happened again:
I got an exception in the code:
if (pkey.equals(section))
{
System.out.println("Code class " + code.get(i=20
+1).getClass());
content =3D (byte[]) code.get(i + 1);
}
else
{
throw new MessagingException("Unexpected section =20=
number: " +
pkey);
}
Because the cast occurs on a String whereas it expects a byte[]
The API calls look like this:
Multipart multiPart =3D (Multipart)message.getContent(); =
=09
for (int j =3D 0 ; j < multiPart.getCount() ; j++) {
Part part =3D multiPart.getBodyPart(j);
MimeBodyPart mimeBodyPart =3D (MimeBodyPart)part;
}
mimeBodyPart.getContent() // Exception
The log is as follows:
Code class class java.lang.String
2006-05-02 19:10:00,664 [main] ERROR =20
org.humannetwork.net.mail.connection.MailConnection.retrieveMessages=20
(MailConnection.java:408) - Error while fetching content of message =20
Id: http://hn.org/platform/info/info#7c3cc9d0-d9fe-11da-b788-=20
f9cb0bddeddf
Type: http://hn.org/platform/info/info
ParentId: http://hn.org/platform/info/info#3567819c-d9fd-11da-b788-=20
f9cb0bddeddf
Info List:
Properties
key: http://hn.org/net/mail/readMessageFlag value: false
key: http://hn.org/net/javaMail/fromAddress value: =20
[email protected]
key: http://hn.org/net/javaMail/subject value: MIME Message5 =20
1146588060926
key: http://hn.org/net/mail/MessageIdHeader value: =20
<18038.1146588172776.JavaMail.cedric@cag06-3-82-243-160-243.fbx.proxad.n=20=
et>
key: http://hn.org/net/javaMail/sentDate value: Tue May 02 18:42:50 =20
CEST 2006
key: http://hn.org/net/javaMail/toAddress value: =20
[email protected]
java.lang.ClassCastException
at =
gnu.mail.providers.imap.IMAPBodyPart.update(IMAPBodyPart.java:189)
at =
gnu.mail.providers.imap.IMAPBodyPart.fetch(IMAPBodyPart.java:129)
at gnu.mail.providers.imap.IMAPBodyPart.fetchContent=20
(IMAPBodyPart.java:107)
at gnu.mail.providers.imap.IMAPBodyPart.getDataHandler=20
(IMAPBodyPart.java:247)
at =
javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:683)
at =
gnu.mail.providers.imap.IMAPBodyPart.getContent(IMAPBodyPart.java:=20
261)
I'll send you the TCP dumps directly.
The message generating the error is =20
18038.1146588172776.JavaMail.cedric@cag06-3-82-243-160-243.fbx.proxad.ne=20=
t with title 'MIME Message5 1146588060926'
Good luck,
Cedric
Le 28 avr. 06 =C3=A0 16:52, Chris Burdess a =C3=A9crit :
> Cedric Hyppolite wrote:
>>> I can't reproduce the problem with my IMAP server, so it seems =20
>>> likely it's down to an odd server-specific response to the FETCH. =20=
>>> If you could send tcpdump transcripts of the IMAP conversation I =20
>>> should be able to work out what's going on.
>
>> Actually I can't reproduce it either after I deleted all the mails =20=
>> sent with the previous version of JavaMail.
>> I guess, it was a side effect of the other bug.
>
> I don't think so. But if you do manage to reproduce it at some =20
> point, please try and capture the TCP packets and let us know.
> --=20
> =E7=8A=AC Chris Burdess
> "They that can give up essential liberty to obtain a little safety
> deserve neither liberty nor safety." - Benjamin Franklin
>
>
>
>