Wrong implementation of TempFileBinaryBody.writeTo
--------------------------------------------------

                 Key: MIME4J-37
                 URL: https://issues.apache.org/jira/browse/MIME4J-37
             Project: Mime4j
          Issue Type: Bug
            Reporter: Aljoscha Rittner


Message delegates writeTo to all Message-Entites.

With this design it's impossible to write a message in a valid rfc822 format. 

With binary content, the Multipart.writeTo writes a preamble in ascii, writes 
the boundary in ascii and the epilogue in ascii, but the binary content is 
complete decoded.

        writer.write(getPreamble() + "\r\n");

        for (int i = 0; i < bodyParts.size(); i++) {
            writer.write(boundary + "\r\n");
            ((BodyPart) bodyParts.get(i)).writeTo(out);
        }

        writer.write(getEpilogue() + "\r\n");
        writer.write(boundary + "--" + "\r\n");

bodyPart delegates the writeTo to TempFileBinaryBody.writeTo:

        IOUtils.copy(getInputStream(),out);

with this implementation I get mixed ascii/binary code in one outputstream. 
It's impossible to read the message.

So I can't see any usecase to delegate the writeTo from Message to all his 
parts, or(?) the writeTo - Method in TempFileBinaryBody is wrong.

The Documentation from Body.writeTo is:

"Writes this body to the given stream in MIME message format."

And in TempFileBinaryBody.writeTo:

@see org.apache.james.mime4j.message.Body#writeTo(java.io.OutputStream)

But TempFileBinaryBody.writeTo does not write the content in  MIME message 
format.

best regards,
  josh.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to