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!

Reply via email to