You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Mark Daring <co...@chello.at> on 2003/09/12 14:30:15 UTC

ClassCastException in LocalDelivery.java

Hi,

I'm getting a ClassCastExeption in the LocalDelivery-Mailet of James v. 2.1.3 when a message from NotifySender.java is about to be delivered to a local sender of the original mail.
The Exception is thrown at this line:
"...
// Add qmail's de facto standard Delivered-To header
MimeMessage localMessage = new LocalMimeMessage(message);
..."

The stacktrace shows BodyPart.updateHeaders() as origin.
I guess this is a bug in the JavaMail-implementation v. 1.3 cause the sources of v. 1.2 assumes that a MIME-type of mulitpart is always an instance of Multipart.
Look at this lines of MimeBodypart.java:

"...
static void updateHeaders(MimePart part) throws MessagingException {
DataHandler dh = part.getDataHandler();
if (dh == null) // Huh ?
    return;
try {
    String type = dh.getContentType();
    boolean composite = false;
    ContentType cType = new ContentType(type);

    if (cType.match("multipart/*")) {
    // If multipart, recurse
        composite = true;
        Object o = dh.getContent();
        ((MimeMultipart)o).updateHeaders();
    }
..."

The mail I've sent was type of "multipart/alternative". The message that is created around my orignal mail in NotifySender  is type of "multipart/mixed" which causes no error, but when it comes to parse my original mail the exception is thrown.  It`s a wild guess but I believe that there's no DataHandler available for "multipart/alternative" at least not on my machine, so the object that returns from dh.getContent() in the code snippet above is an InputStream-object and not a Multipart-object.

I wanted to debug and looked for the source code of the JavaMail-API but I only found version 1.2 which is shipped with J2EE 1.3.1-SCSL along with JAF 1.0.1.

Has anybody the sources of JavaMail-1.3 and JAF-1.0.2 or does anybody know a DataHandler for "multipart/alternative"?

Mark Daring!

Re: ClassCastException in LocalDelivery.java

Posted by Mark Daring <co...@chello.at>.
----- Original Message -----
From: "Danny Angus" <da...@apache.org>
To: "James Developers List" <se...@james.apache.org>
Sent: Friday, September 12, 2003 3:56 PM
Subject: RE: ClassCastException in LocalDelivery.java


> Mark,
>
> Good guess,  but no cigar..
>
> multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed
>
> means that com.sun.mail.handlers.multipart_mixed is used for all multipart
> types.
>
> > Has anybody the sources of JavaMail-1.3 and JAF-1.0.2
>
> Not available :-(
>
> > or does
> > anybody know a DataHandler for "multipart/alternative"?
>
> See above.
>
>
> Suggestions..
>
> No idea at the moment.
>
> d.

Hi Danny,

my problem is solved. I didnt get a DataContentHandler from
MailcapCommandMap.createDataContentHandler(String s) for MIME-Type
"multipart/*" the first time i made a request. There must have been an
Exception thrown while loading the Class-File which is silently caught. I
decompiled and recompiled MailCapCommandMap.java and now everything is fine.
I still have no idea what caused the Exception.

Mark.


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


RE: ClassCastException in LocalDelivery.java

Posted by Danny Angus <da...@apache.org>.
Mark,

Good guess,  but no cigar..

multipart/*;;		x-java-content-handler=com.sun.mail.handlers.multipart_mixed

means that com.sun.mail.handlers.multipart_mixed is used for all multipart
types.

> Has anybody the sources of JavaMail-1.3 and JAF-1.0.2

Not available :-(

> or does
> anybody know a DataHandler for "multipart/alternative"?

See above.


Suggestions..

No idea at the moment.

d.


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org