You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Thierry Frossard (JIRA)" <ji...@apache.org> on 2015/10/08 11:23:26 UTC

[jira] [Commented] (CAMEL-9107) Exception thrown when reading a mail with an attached file, which name contains a semicolon

    [ https://issues.apache.org/jira/browse/CAMEL-9107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14948359#comment-14948359 ] 

Thierry Frossard commented on CAMEL-9107:
-----------------------------------------

Hello Claus,

Thank you for your response. I've exactly the same problem within a simple unit test using Sun JDK 1.7.0_75 and Sun javamail. Here is the stacktrace :
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.RuntimeCamelException: Error populating the initial mail message attachments
	at org.apache.camel.component.mail.MailMessage.populateInitialAttachments(MailMessage.java:131) ~[camel-mail-2.15.2.jar:2.15.2]
	at org.apache.camel.impl.DefaultMessage.createAttachments(DefaultMessage.java:216) ~[camel-core-2.15.2.jar:2.15.2]
	at org.apache.camel.impl.DefaultMessage.getAttachments(DefaultMessage.java:281) ~[camel-core-2.15.2.jar:2.15.2]
	at ch.gma.nova.eip.mailtoindexation.processors.MailReader.process(MailReader.java:45) ~[classes/:na]
	at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63) ~[camel-core-2.15.2.jar:2.15.2]
	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448) ~[camel-core-2.15.2.jar:2.15.2]
	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191) [camel-core-2.15.2.jar:2.15.2]
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:118) [camel-core-2.15.2.jar:2.15.2]
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:80) [camel-core-2.15.2.jar:2.15.2]
	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191) [camel-core-2.15.2.jar:2.15.2]
	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109) [camel-core-2.15.2.jar:2.15.2]
	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87) [camel-core-2.15.2.jar:2.15.2]
	at org.apache.camel.component.mail.MailConsumer.processExchange(MailConsumer.java:359) [camel-mail-2.15.2.jar:2.15.2]
	at org.apache.camel.component.mail.MailConsumer.processBatch(MailConsumer.java:220) [camel-mail-2.15.2.jar:2.15.2]
	at org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:121) [camel-mail-2.15.2.jar:2.15.2]
	at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) [camel-core-2.15.2.jar:2.15.2]
	at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) [camel-core-2.15.2.jar:2.15.2]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_75]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) [na:1.7.0_75]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_75]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.7.0_75]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_75]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_75]
	at java.lang.Thread.run(Thread.java:745) [na:1.7.0_75]
Caused by: javax.mail.MessagingException: Unable to load BODYSTRUCTURE
	at com.sun.mail.imap.IMAPMessage.loadBODYSTRUCTURE(IMAPMessage.java:1306) ~[mail-1.4.7.jar:1.4.7]
	at com.sun.mail.imap.IMAPMessage.getDataHandler(IMAPMessage.java:639) ~[mail-1.4.7.jar:1.4.7]
	at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:1395) ~[thinclient-8.5.0.jar:na]
	at org.apache.camel.component.mail.MailBinding.extractAttachmentsFromMail(MailBinding.java:291) ~[camel-mail-2.15.2.jar:2.15.2]
	at org.apache.camel.component.mail.MailMessage.populateInitialAttachments(MailMessage.java:128) ~[camel-mail-2.15.2.jar:2.15.2]
	... 23 common frames omitted



> Exception thrown when reading a mail with an attached file, which name contains a semicolon
> -------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-9107
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9107
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-mail
>    Affects Versions: 2.15.2
>            Reporter: Thierry Frossard
>            Priority: Minor
>
> Hi, 
> I posted this issue in Camel users forum but unfortunately got no response.
> I'm using Camel 2.15.2 with JDK 1.7 under Windows 7 and Eclipse 4.2.2 as development tool. 
> My route reads from an IMAP server (IBM Lotus Notes). I have one big problem : when the route handles an email, which contains a PDF attached file with a semicolon in his name (for exemple my;pdf.pdf), then the route always throws this exception : 
> Failed to extract body due to: Unable to load BODYSTRUCTURE. 
> 4.08.15 15:10:11:313 CEST] 00000172 SystemOut     O [15:10:11.313] WARN  [Camel (Mail vers Indexation) thread #0 - imap://myimapserver.ch] org.apache.camel.util.CamelLogger.log:224 : Caused by: [org.apache.camel.RuntimeCamelException - Failed to extract body due to: Unable to load BODYSTRUCTURE. Exchange: Exchange[MailMessage@0x862446e3]. Message: com.sun.mail.imap.IMAPMessage@16e6c70e] 
> org.apache.camel.RuntimeCamelException: Failed to extract body due to: Unable to load BODYSTRUCTURE. Exchange: Exchange[MailMessage@0x862446e3]. Message: com.sun.mail.imap.IMAPMessage@16e6c70e 
>         at org.apache.camel.component.mail.MailBinding.extractBodyFromMail(MailBinding.java:275) ~[camel-mail-2.15.2.jar:2.15.2] 
>         at org.apache.camel.component.mail.MailMessage.createBody(MailMessage.java:103) ~[camel-mail-2.15.2.jar:2.15.2] 
>         at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:41) ~[camel-core-2.15.2.jar:2.15.2] 
>         at org.apache.camel.component.mail.MailConsumer.createExchanges(MailConsumer.java:326) ~[camel-mail-2.15.2.jar:2.15.2] 
>         at org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:121) ~[camel-mail-2.15.2.jar:2.15.2] 
>         at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) [camel-core-2.15.2.jar:2.15.2] 
>         at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) [camel-core-2.15.2.jar:2.15.2] 
>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:482) [na:1.7.0] 
>         at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:315) [na:1.7.0] 
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:189) [na:1.7.0] 
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [na:1.7.0] 
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156) [na:1.7.0] 
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:626) [na:1.7.0] 
>         at java.lang.Thread.run(Thread.java:804) [na:1.7.0] 
> Caused by: javax.mail.MessagingException: Unable to load BODYSTRUCTURE 
>         at com.sun.mail.imap.IMAPMessage.loadBODYSTRUCTURE(IMAPMessage.java:1261) ~[com.ibm.ws.prereq.javamail.jar:na] 
>         at com.sun.mail.imap.IMAPMessage.getDataHandler(IMAPMessage.java:597) ~[com.ibm.ws.prereq.javamail.jar:na] 
>         at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:1395) ~[com.ibm.ws.prereq.javamail.jar:na] 
>         at org.apache.camel.component.mail.MailBinding.extractBodyFromMail(MailBinding.java:247) ~[camel-mail-2.15.2.jar:2.15.2] 
>         ... 13 common frames omitted 
> Here is the route (very simple) : 
>   @Override 
>   public void configure() throws Exception { 
>     from(getPropertiesUri()) 
>     /**/.to("log:dummy"); 
>   } 
>   protected String getPropertiesUri() { 
>     String prefix = Constants.MAIL.concat(provider); 
>     StringBuilder uri = new StringBuilder(); 
>     uri.append(getContext().getProperties().get(prefix.concat(".protocol"))).append("://"); 
>     uri.append(getContext().getProperties().get(prefix.concat(".host"))).append("?"); 
>     uri.append("username=").append(getContext().getProperties().get(prefix.concat(".user"))); 
>     uri.append("&password=").append(getContext().getProperties().get(prefix.concat(".password"))); 
>     uri.append("&folderName=").append(getContext().getProperties().get(prefix.concat(".folder"))); 
>     uri.append("&unseen=").append(getContext().getProperties().get(prefix.concat(".unseen"))); 
>     uri.append("&consumer.delay=").append(getContext().getProperties().get(prefix.concat(".consuming.delay"))); 
>     uri.append("&delete=").append(getContext().getProperties().get(prefix.concat(".delete"))); 
>     String options = getContext().getProperties().get(prefix.concat(".options")); 
>     if (StringUtils.isNotBlank(options)) { 
>       uri.append("&").append(getContext().getProperties().get(prefix.concat(".options"))); 
>     } 
>     return uri.toString(); 
>   } 
> and the uri used to retrieve the mail : 
> imap://myimapserver.ch?username=username&password=password&folderName=IMAP&unseen=true&consumer.delay=30000&delete=true 
> I didn't find anywhere a similar problem with Camel mail component so I don't know if it's a bug or if I'm doing something wrong. 
> Kind regards and thanks a lot for helping. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)