Y made a workaround putting a XML in the mail body.
It works fine.
Then I got another error "NullPointerException"  in line 156 of
DefaultMailMarshaler. This is because Multipart messages are always treated
as Attachments.
There is a bug in DefaultMailMarshaler where DataHandler referenced in line
157 I think is wrong.
I made this patch. Plase feel free to do any comment.
Regards



On Mon, Aug 10, 2009 at 4:38 PM, FuinhaAzul <[email protected]> wrote:

>
> Gert, did you tried some example of receive mail message?
>
> If I read a file, then all works fine, but with mail component, that
> message
> "content not alowed in prolog" still shows.
>
> Any sugestion?
>
>
>
>
>
>
> Gert Vanthienen wrote:
> >
> > L.S.,
> >
> > I think the DefaultMailMarshaler might be trying to add the message
> > content to the JBI MessageExchange as well.  Could you try enabling
> > DEBUG logging and sending us the output from the logging, so we can
> > find out where/when the exception occurs?  Also, could you paste us
> > the full stack trace?  If my guess is correct, adding some XML content
> > to the message (provided it is a text/plain message) should be a
> > workaround, but I'll give things a go here as well to see if I can
> > reproduce this locally.
> >
> > Regards,
> >
> > Gert Vanthienen
> > ------------------------
> > Open Source SOA: http://fusesource.com
> > Blog: http://gertvanthienen.blogspot.com/
> >
> >
> >
> > 2009/8/4 FuinhaAzul <[email protected]>:
> >>
> >> Hey guys!
> >>
> >> I´m still tring to receive the message and write de attachment to a file
> >> (the atachment is a xml), but: "The content is not allowed in prolog".
> >>
> >> I tried DefaultFIleMarshaler and BinaryFileMarsaler, but the error is
> the
> >> same.
> >>
> >> The email is succefuly received, but when I forward to file endpoint,
> >> then
> >> the exception is throw.
> >>
> >> Any Ideas? (I think this is the last question to make this sample work.)
> >> http://www.nabble.com/file/p24801223/nl-mailtofile-sa.zip
> >> nl-mailtofile-sa.zip
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Almost-making-%28Mail-to-file%29-tp24801223p24801223.html
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > -----
> > ---
> > Gert Vanthienen
> > http://gertvanthienen.blogspot.com
> >
>
> --
> View this message in context:
> http://www.nabble.com/Almost-making-%28Mail-to-file%29-tp24801223p24905919.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>
Index: bindings/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/DefaultMailMarshaler.java
===================================================================
--- bindings/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/DefaultMailMarshaler.java	(revision 798962)
+++ bindings/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/DefaultMailMarshaler.java	(working copy)
@@ -151,9 +151,10 @@
                     // Create another body part
                     messageBodyPart = new MimeBodyPart();
                     // Set the data handler to the attachment
-                    messageBodyPart.setDataHandler(new DataHandler(new FileDataSource(f)));
+                    DataHandler fileDataHandler = new DataHandler(new FileDataSource(f));
+                    messageBodyPart.setDataHandler(fileDataHandler);
                     // Set the filename
-                    messageBodyPart.setFileName(dh.getDataSource().getName());
+                    messageBodyPart.setFileName(fileDataHandler.getDataSource().getName());
                     // Set Disposition
                     messageBodyPart.setDisposition(Part.ATTACHMENT);
                     // Add part to multipart

Reply via email to