You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Shenavai, Manuel" <ma...@sap.com> on 2019/03/20 15:55:57 UTC

IMAP: No content

Hi camel users,

 

we are using the camel mail component to fetch mails from a mailserver. For
some mails the polling fails due to a IOException (see below). 

 

I attached the mail that causes the problem to this mail (slightly changed).
The mail has an empty body, so one could argue the exception is correct. But
for other mails with empty body there is no exception thrown. 

 

I found this post which seems to be the same problem, but without a
solution:

http://camel.465427.n5.nabble.com/IMAP-No-content-td5725535.html

 

Anyone else came across this problem?

 

Thanks in advance

Best regards,

Manuel

 

 

Caused by: java.io.IOException: No content

                at
javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.jav
a:115)

                at
com.sun.mail.handlers.text_plain.getContent(text_plain.java:80)

                at
javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:79
5)

                at
javax.activation.DataHandler.getContent(DataHandler.java:542)

                at
javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:657)

                at
org.apache.camel.component.mail.MailBinding.extractHeadersFromMail(MailBindi
ng.java:614)

                at
com.sap.esb.camel.mail.endpoint.configurator.mail.binding.CustomMailBinding.
extractHeadersFromMail(CustomMailBinding.java:24)

                at
com.sap.esb.camel.security.cms.smime.SMimeMailBinding.extractHeadersFromMail
(SMimeMailBinding.java:292)

                at
com.sap.esb.camel.mail.endpoint.configurator.mail.impl.trace.TraceMailBindin
gWithDelegation.extractHeadersFromMail(TraceMailBindingWithDelegation.java:4
2)

                at
org.apache.camel.component.mail.MailMessage.populateInitialHeaders(MailMessa
ge.java:116)

                ... 27 common frames omitted

Caused by: javax.mail.MessagingException: No content

                at
com.sun.mail.imap.IMAPBodyPart.getContentStream(IMAPBodyPart.java:206)

                at
javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.jav
a:99)

                ... 36 common frames omitted

 


Re: IMAP: No content

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Ah okay, yeah you are welcome to provide a proposed fix as a github PR
https://github.com/apache/camel/

On Wed, Mar 27, 2019 at 12:19 PM Shenavai, Manuel
<ma...@sap.com> wrote:
>
> Hi Claus,
>
> thanks for your prompt reply. We are currently running on Camel 2.17.4. Updating to a newer version is currently no solution. Also from my current understanding, this error is caused due to NIL-response from the mailserver, which might also happen in newer version, right?
>
> In the logs I found the following (see attached trace):
> A17 FETCH 165 (BODY.PEEK[1.1])
> * 165 FETCH (BODY[1.1] NIL)
>
> Regarding the proposal to just return an empty string: We faced this problem with another mail where (I think) the content was actually not empty (SMIME mail). So returning an empty string would be wrong. Unfortunately I'm not able to reproduce the problem and validate this statement.
>
> A possible workaround that I found is to copy the whole Message via CopyConstructor of MimeMessage, as suggested here:
> https://javaee.github.io/javamail/FAQ.html#imapserverbug
>
> A possible fix for this problem could be done in the MailConsumer:
> - if a mail fails due to no-content exception, the above fix could be applied and the mail could be retried
>
> What do you think?
>
> Best regards,
> Manuel Shenavai
>
> -----Original Message-----
> From: Claus Ibsen <cl...@gmail.com>
> Sent: Donnerstag, 21. März 2019 08:05
> To: users@camel.apache.org
> Subject: Re: IMAP: No content
>
> Hi
>
> What version of Camel are you using?
>
> And we could likely consider adding a check for this kind of exception
> with "No content" error message as in the stacktraces and regard the
> message as empty. Mind that the message is in english so we can only
> check for that and not for other languages.
>
> Also have you tried upgrading Camel and/or javax mail? It may work
> better on newer versions.
>
> On Wed, Mar 20, 2019 at 4:56 PM Shenavai, Manuel
> <ma...@sap.com> wrote:
> >
> > Hi camel users,
> >
> >
> >
> > we are using the camel mail component to fetch mails from a mailserver. For some mails the polling fails due to a IOException (see below).
> >
> >
> >
> > I attached the mail that causes the problem to this mail (slightly changed). The mail has an empty body, so one could argue the exception is correct. But for other mails with empty body there is no exception thrown.
> >
> >
> >
> > I found this post which seems to be the same problem, but without a solution:
> >
> > http://camel.465427.n5.nabble.com/IMAP-No-content-td5725535.html
> >
> >
> >
> > Anyone else came across this problem?
> >
> >
> >
> > Thanks in advance
> >
> > Best regards,
> >
> > Manuel
> >
> >
> >
> >
> >
> > Caused by: java.io.IOException: No content
> >
> >                 at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:115)
> >
> >                 at com.sun.mail.handlers.text_plain.getContent(text_plain.java:80)
> >
> >                 at javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:795)
> >
> >                 at javax.activation.DataHandler.getContent(DataHandler.java:542)
> >
> >                 at javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:657)
> >
> >                 at org.apache.camel.component.mail.MailBinding.extractHeadersFromMail(MailBinding.java:614)
> >
> >                 at com.sap.esb.camel.mail.endpoint.configurator.mail.binding.CustomMailBinding.extractHeadersFromMail(CustomMailBinding.java:24)
> >
> >                 at com.sap.esb.camel.security.cms.smime.SMimeMailBinding.extractHeadersFromMail(SMimeMailBinding.java:292)
> >
> >                 at com.sap.esb.camel.mail.endpoint.configurator.mail.impl.trace.TraceMailBindingWithDelegation.extractHeadersFromMail(TraceMailBindingWithDelegation.java:42)
> >
> >                 at org.apache.camel.component.mail.MailMessage.populateInitialHeaders(MailMessage.java:116)
> >
> >                 ... 27 common frames omitted
> >
> > Caused by: javax.mail.MessagingException: No content
> >
> >                 at com.sun.mail.imap.IMAPBodyPart.getContentStream(IMAPBodyPart.java:206)
> >
> >                 at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:99)
> >
> >                 ... 36 common frames omitted
> >
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

RE: IMAP: No content

Posted by "Shenavai, Manuel" <ma...@sap.com>.
Hi Claus,

thanks for your prompt reply. We are currently running on Camel 2.17.4. Updating to a newer version is currently no solution. Also from my current understanding, this error is caused due to NIL-response from the mailserver, which might also happen in newer version, right?

In the logs I found the following (see attached trace):
A17 FETCH 165 (BODY.PEEK[1.1])
* 165 FETCH (BODY[1.1] NIL)

Regarding the proposal to just return an empty string: We faced this problem with another mail where (I think) the content was actually not empty (SMIME mail). So returning an empty string would be wrong. Unfortunately I'm not able to reproduce the problem and validate this statement.

A possible workaround that I found is to copy the whole Message via CopyConstructor of MimeMessage, as suggested here:
https://javaee.github.io/javamail/FAQ.html#imapserverbug

A possible fix for this problem could be done in the MailConsumer: 
- if a mail fails due to no-content exception, the above fix could be applied and the mail could be retried

What do you think?

Best regards,
Manuel Shenavai

-----Original Message-----
From: Claus Ibsen <cl...@gmail.com> 
Sent: Donnerstag, 21. März 2019 08:05
To: users@camel.apache.org
Subject: Re: IMAP: No content

Hi

What version of Camel are you using?

And we could likely consider adding a check for this kind of exception
with "No content" error message as in the stacktraces and regard the
message as empty. Mind that the message is in english so we can only
check for that and not for other languages.

Also have you tried upgrading Camel and/or javax mail? It may work
better on newer versions.

On Wed, Mar 20, 2019 at 4:56 PM Shenavai, Manuel
<ma...@sap.com> wrote:
>
> Hi camel users,
>
>
>
> we are using the camel mail component to fetch mails from a mailserver. For some mails the polling fails due to a IOException (see below).
>
>
>
> I attached the mail that causes the problem to this mail (slightly changed). The mail has an empty body, so one could argue the exception is correct. But for other mails with empty body there is no exception thrown.
>
>
>
> I found this post which seems to be the same problem, but without a solution:
>
> http://camel.465427.n5.nabble.com/IMAP-No-content-td5725535.html
>
>
>
> Anyone else came across this problem?
>
>
>
> Thanks in advance
>
> Best regards,
>
> Manuel
>
>
>
>
>
> Caused by: java.io.IOException: No content
>
>                 at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:115)
>
>                 at com.sun.mail.handlers.text_plain.getContent(text_plain.java:80)
>
>                 at javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:795)
>
>                 at javax.activation.DataHandler.getContent(DataHandler.java:542)
>
>                 at javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:657)
>
>                 at org.apache.camel.component.mail.MailBinding.extractHeadersFromMail(MailBinding.java:614)
>
>                 at com.sap.esb.camel.mail.endpoint.configurator.mail.binding.CustomMailBinding.extractHeadersFromMail(CustomMailBinding.java:24)
>
>                 at com.sap.esb.camel.security.cms.smime.SMimeMailBinding.extractHeadersFromMail(SMimeMailBinding.java:292)
>
>                 at com.sap.esb.camel.mail.endpoint.configurator.mail.impl.trace.TraceMailBindingWithDelegation.extractHeadersFromMail(TraceMailBindingWithDelegation.java:42)
>
>                 at org.apache.camel.component.mail.MailMessage.populateInitialHeaders(MailMessage.java:116)
>
>                 ... 27 common frames omitted
>
> Caused by: javax.mail.MessagingException: No content
>
>                 at com.sun.mail.imap.IMAPBodyPart.getContentStream(IMAPBodyPart.java:206)
>
>                 at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:99)
>
>                 ... 36 common frames omitted
>
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: IMAP: No content

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

What version of Camel are you using?

And we could likely consider adding a check for this kind of exception
with "No content" error message as in the stacktraces and regard the
message as empty. Mind that the message is in english so we can only
check for that and not for other languages.

Also have you tried upgrading Camel and/or javax mail? It may work
better on newer versions.

On Wed, Mar 20, 2019 at 4:56 PM Shenavai, Manuel
<ma...@sap.com> wrote:
>
> Hi camel users,
>
>
>
> we are using the camel mail component to fetch mails from a mailserver. For some mails the polling fails due to a IOException (see below).
>
>
>
> I attached the mail that causes the problem to this mail (slightly changed). The mail has an empty body, so one could argue the exception is correct. But for other mails with empty body there is no exception thrown.
>
>
>
> I found this post which seems to be the same problem, but without a solution:
>
> http://camel.465427.n5.nabble.com/IMAP-No-content-td5725535.html
>
>
>
> Anyone else came across this problem?
>
>
>
> Thanks in advance
>
> Best regards,
>
> Manuel
>
>
>
>
>
> Caused by: java.io.IOException: No content
>
>                 at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:115)
>
>                 at com.sun.mail.handlers.text_plain.getContent(text_plain.java:80)
>
>                 at javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:795)
>
>                 at javax.activation.DataHandler.getContent(DataHandler.java:542)
>
>                 at javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:657)
>
>                 at org.apache.camel.component.mail.MailBinding.extractHeadersFromMail(MailBinding.java:614)
>
>                 at com.sap.esb.camel.mail.endpoint.configurator.mail.binding.CustomMailBinding.extractHeadersFromMail(CustomMailBinding.java:24)
>
>                 at com.sap.esb.camel.security.cms.smime.SMimeMailBinding.extractHeadersFromMail(SMimeMailBinding.java:292)
>
>                 at com.sap.esb.camel.mail.endpoint.configurator.mail.impl.trace.TraceMailBindingWithDelegation.extractHeadersFromMail(TraceMailBindingWithDelegation.java:42)
>
>                 at org.apache.camel.component.mail.MailMessage.populateInitialHeaders(MailMessage.java:116)
>
>                 ... 27 common frames omitted
>
> Caused by: javax.mail.MessagingException: No content
>
>                 at com.sun.mail.imap.IMAPBodyPart.getContentStream(IMAPBodyPart.java:206)
>
>                 at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:99)
>
>                 ... 36 common frames omitted
>
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2