Edward Tan wrote:
> I just found out the culprit, it is not James code. It is
> javax.mail.MimeMessage
> [...]
>     if (is instanceof SharedInputStream) {
>         SharedInputStream sis = (SharedInputStream)is;
>         contentStream = sis.newStream(sis.getPosition(), -1);
>     } else {
>         try {
>         content = ASCIIUtility.getBytes(is);
>         } catch (IOException ioex) {
>         throw new MessagingException("IOException", ioex);
>         }
>     }

I investigated a few months ago on using always
com.sun.mail.util.SharedByteArrayInputStream when loading message
sources to improve sun javamail performance.

I replaced the following line in MimeMessageWrapper.loadMessage()

ByteArrayInputStream headersIn = new
SharedByteArrayInputStream(headers.toByteArray());

And the following in MimeMessageJDBCSource.getInputStream():

InputStream in = new SharedByteArrayInputStream(headers);

But I've had no time to do more tests.

> -------------------------------------------
> 
> I traced that the
> 
> while ((len = is.read(buf, 0, size)) != -1)
>         bos.write(buf, 0, len);
> 
> causes the exception.
> -----------------------------------

Again, What is the real exception? ;-)

> With big attachment, this will crash. Any idea to avoid this?

If you are confortable with james building try the above change and let
us know if it solve the problem!

Stefano

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

Reply via email to