0
votes

I have the route "imap://%s@%s?password=%s&folderName=%s&unseen=true&delete=true&skipFailedMessage=true" to poll emails and skip failed ones. This property skipFailedMessage=true is not being honored or I am miss understanding the use of it.

I am reading emails from 5 different mailboxes with different placeholders but no emails get read when I encounter "org.apache.camel.RuntimeCamelException: Failed to extract body due to: BASE64Decoder: Error in encoded stream: found valid base64 character after a padding character (=)" on onw of the emails. I can only read all other emails on different mail boxes if the failing message is deleted. Please help. I tried versions 2.17.3 and 2.18 and both are behaving the same way.

Here is the stack trace:

org.apache.camel.RuntimeCamelException: Failed to extract body due to: BASE64Decoder: Error in encoded stream: found valid base64 character after a padding character (=), the 10 most recent characters were: "xmlns:v="u". Exchange: Exchange[]. Message: com.sun.mail.imap.IMAPMessage@7883ab8c at org.apache.camel.component.mail.MailBinding.extractBodyFromMail(MailBinding.java:278) at org.apache.camel.component.mail.MailMessage.createBody(MailMessage.java:105) at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47) at org.apache.camel.component.mail.MailConsumer.createExchanges(MailConsumer.java:354) at org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:128) at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175) at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: com.sun.mail.util.DecodingException: BASE64Decoder: Error in encoded stream: found valid base64 character after a padding character (=), the 10 most recent characters were: "xmlns:v="u" at com.sun.mail.util.BASE64DecoderStream.decode(BASE64DecoderStream.java:309) at com.sun.mail.util.BASE64DecoderStream.read(BASE64DecoderStream.java:144) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) at java.io.InputStreamReader.read(InputStreamReader.java:184) at com.sun.mail.handlers.text_plain.getContent(text_plain.java:98) at javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:795) at javax.activation.DataHandler.getContent(DataHandler.java:542) at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:1454) at org.apache.camel.component.mail.MailBinding.extractBodyFromMail(MailBinding.java:250) ... 13 common frames omitted

2
Add the stacktrace you see to the questions so people can better helpClaus Ibsen
I logged a ticket to catch wider exceptions in the mail component: issues.apache.org/jira/browse/CAMEL-10527Claus Ibsen
@user2215545 have you checked 2.17.5, 2.18.1, 2.19.0 ?rjdkolb

2 Answers

1
votes

The error is coming from JavaMail, probably due to an incorrectly formatted message. You can tell JavaMail to ignore such errors by setting the System property "mail.mime.base64.ignoreerrors" to "true".

1
votes

Thanks @Claus Ibsen for logging the issue. The problem was reported fixed in version 2.17.5, 2.18.1, 2.19.0

I verified that it was fixed on version 2.18.1.