Hi Stefano,
I have tried
ByteArrayInputStream headersIn = new
SharedByteArrayInputStream(headers.toByteArray());
but it still runs out of heap.
Is it possible to store it into temporary file? Using more memory does not
guarantee the stability, unless the email size is limited. But this is not
practical since it reduces James scalability.
Thanks.
Regards,
Edward
On 12/30/05, Edward Tan <[EMAIL PROTECTED]> wrote:
>
> Yes!
>
> } catch(Throwable t) {
> System.out.println(t.getMessage());
> t.printStackTrace();
>
> ====>
>
> Java heap space
> java.lang.OutOfMemoryError: Java heap space
>
>
> On 12/30/05, Stefano Bagnara <[EMAIL PROTECTED]> wrote:
> >
> > Edward Tan wrote:
> > > The exception is caught somewhere, so I set at earlier calling
> > function
> > > stack.
> > > But
> > >
> > > message is null
> > >
> > > and it goes to finally.
> >
> > If it execute the finally, the message is null and the 2
> > System.out.printlm are not called then it could be a throwable (probably
> > an error, an out of memory error?)
> >
> > If you can reproduce you could add a
> > } catch (Throwable t) {
> > // some output code
> > throw t;
> > } finally ...
> >
> > Stefano
> >
> > > Somewhere the exception is caught and never thrown back.
> > >
> > > ------------------
> > > private synchronized void loadMessage() throws MessagingException
> > {
> > > if (message != null) {
> > > //Another thread has already loaded this message
> > > return;
> > > }
> > > InputStream in = null;
> > > try {
> > > in = source.getInputStream ();
> > > headers = new MailHeaders(in);
> > >
> > > ByteArrayInputStream headersIn
> > > = new ByteArrayInputStream(headers.toByteArray());
> > > in = new SequenceInputStream(headersIn, in);
> > >
> > > message = new MimeMessage(session, in);
> > > } catch (IOException ioe) {
> > > System.out.println(ioe);
> > > throw new MessagingException("Unable to parse stream: " +
> > > ioe.getMessage(), ioe);
> > > } catch (Exception e) {
> > > System.out.println(e);
> > > e.printStackTrace ();
> > > } finally {
> > > IOUtil.shutdownStream(in);
> > > }
> > > }
> > > ----------------------------
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>