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

Kamil commented on CAMEL-13560:
-------------------------------

[~davsclaus], It seems that the reason is Java version, not OSGi.

In class: org.apache.camel.component.mail.MailBinding in line 297:
{code:java}
Object content = message.getContent();
{code}
When I run Apache Karaf using JDK8, "content" is of class 
javax.mail.internet.MimeMultipart and attachments are found just fine. 
In exactly the same Apache Karaf instance with the same app run on JDK11 
"content" is of class com.sun.mail.imap.IMAPInputStream and attachments are not 
found

> Mail component is not reading attachments in OSGi
> -------------------------------------------------
>
>                 Key: CAMEL-13560
>                 URL: https://issues.apache.org/jira/browse/CAMEL-13560
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-mail
>    Affects Versions: 2.24.0
>            Reporter: Kamil
>            Priority: Minor
>
> I have such route (taken from 
> [documentation|https://camel.apache.org/mail.html]):
> {code:java}
>   @Override
>   public void configure() throws Exception {    
>     from("imaps://login@host:993?password=pass&debugMode=true")
>       .process(new Processor() {
>         @Override
>         public void process(final Exchange exchange) throws Exception {
>           final Message in = exchange.getIn();
>       
>           Map<String, DataHandler> attachments = in.getAttachments();
>           System.out.println("ATTACHMENTS: "+attachments.size());
>         }
>       });
>   }
> {code}
> When I sent email with images.jpg attachment, email is read, but attachment 
> Map is empty.
> Debug shows:
> {code:java}
> DEBUG: setDebug: JavaMail version 1.6.1
> DEBUG: getProvider() returning 
> javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle,1.6.1]
> DEBUG IMAPS: mail.imap.fetchsize: 16384
> DEBUG IMAPS: mail.imap.ignorebodystructuresize: false
> DEBUG IMAPS: mail.imap.statuscachetimeout: 1000
> DEBUG IMAPS: mail.imap.appendbuffersize: -1
> DEBUG IMAPS: mail.imap.minidletime: 10
> DEBUG IMAPS: closeFoldersOnStoreFailure
> DEBUG IMAPS: trying to connect to host "XXXXXX.com", port 993, isSSL true
> * OK IMAP4 ready
> A0 CAPABILITY
> * CAPABILITY IMAP4rev1 UIDPLUS LITERAL+ CHILDREN NAMESPACE XLIST IDLE MOVE 
> XAOL-MOVE AUTH=PLAIN
> A0 OK completed
> DEBUG IMAPS: AUTH: PLAIN
> DEBUG IMAPS: protocolConnect login, host=XXXXXX.com, user=XXXXXXX, 
> password=<non-null>
> DEBUG IMAPS: AUTHENTICATE PLAIN command trace suppressed
> DEBUG IMAPS: AUTHENTICATE PLAIN command result: A1 OK Login completed
> A2 CAPABILITY
> * CAPABILITY IMAP4rev1 UIDPLUS LITERAL+ CHILDREN NAMESPACE XLIST ID IDLE MOVE 
> XAOL-MOVE
> A2 OK CAPABILITY completed
> A3 LIST "" INBOX
> * LIST (\Noinferiors) "/" "INBOX"
> A3 OK List completed
> DEBUG IMAPS: connection available -- size: 1
> A4 SELECT INBOX
> * 13 EXISTS
> * 0 RECENT
> * OK [UNSEEN 13] UIDs valid
> * OK [UIDVALIDITY 1549376878] UIDs valid
> * OK [UIDNEXT 36] Predicted next UID
> * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
> * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft)]
> * OK [NOMODSEQ] Sorry, this mailbox format doesn't support modsequences
> A4 OK [READ-WRITE] SELECT completed
> A5 SEARCH UNSEEN 1:13
> * SEARCH 13
> A5 OK Search completed
> A6 FETCH 13 (BODY.PEEK[HEADER.FIELDS (Message-ID)])
> * 13 FETCH (BODY[HEADER.FIELDS (Message-ID)] {65}
> Message-ID: <[email protected]>
> )
> A6 OK Fetch completed
> A7 FETCH 13 (FLAGS)
> * 13 FETCH (FLAGS ())
> A7 OK Fetch completed
> A8 FETCH 13 (BODYSTRUCTURE)
> * 13 FETCH (BODYSTRUCTURE (("text" "plain" ("charset" "utf-8" "format" 
> "flowed") NIL NIL "7bit" 10 3 NIL NIL NIL)("image" "jpeg" ("name" 
> "images.jpg") NIL NIL "base64" 16794 NIL ("attachment" ("filename" 
> "images.jpg")) NIL) "mixed" ("boundary" 
> "------------53A9AD932142735A4433B153") NIL NIL))
> A8 OK Fetch completed
> A9 FETCH 13 (BODY.PEEK[HEADER])
> * 13 FETCH (BODY[HEADER] {3286}
> Return-Path: <[email protected]>
> Delivered-To: [email protected]
> Received: (wp-smtpd mx.XXXXXX.com 31103 invoked from network); 22 May 2019 
> 16:14:00 +0200
> Received: from mail-XXX.google.com ([209.85.167.54])
>           (envelope-sender <[email protected]>)
>           by mx.tlen.pl (WP-SMTPD) with ECDHE-RSA-AES256-GCM-SHA384 encrypted 
> SMTP
>           for <[email protected]>; 22 May 2019 16:14:00 +0200
> Received: by mail-XXX.google.com with SMTP id d8so1XXXb.8
>         for <[email protected]>; Wed, 22 May 2019 07:14:00 -0700 (PDT)
> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
>         d=XXX.gappssmtp.com; s=XXX;
>         h=to:from:subject:message-id:date:user-agent:mime-version
>          :content-language;
>         bh=8Bw7uLBuofXm3FHknjhDSjXXX=;
>         b=kqcK74fTrzyDas7Wsn7EJfSxJuXXX==
> X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
>         d=1e100.net; s=20161025;
>         h=x-gm-message-state:to:from:subject:message-id:date:user-agent
>          :mime-version:content-language;
>         bh=8Bw7uLBuofXmXXXX6oDyAiCFLfHU=;
>         b=F1EsLfk3qaiJXiNX0XXXXXXX==
> X-Gm-Message-State: APXXXXXX=
> X-Google-Smtp-Source: APXvXXXXXWYQ==
> X-Received: by 2002:a19:c517:: with SMTP id w23mr27342169lfe.73.1558534439904;
>         Wed, 22 May 2019 07:13:59 -0700 (PDT)
> Return-Path: <[email protected]>
> Received: from [XXXXXX] (host-XXXXXX.com. [XXXXXX])
>         by smtp.gmail.com with ESMTPSA id XXXX
>         for <[email protected]>
>         (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
>         Wed, 22 May 2019 07:13:59 -0700 (PDT)
> To: [email protected]
> From: =?UTF-8?Q?XXX=c5=9bXX?= <[email protected]>
> Subject: Test attachment
> Message-ID: <[email protected]>
> Date: Wed, 22 May 2019 16:13:58 +0200
> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101
>  Thunderbird/60.6.1
> MIME-Version: 1.0
> Content-Type: multipart/mixed;
>  boundary="------------53A9AD932142735A4433B153"
> Content-Language: pl
> X-WP-DKIM-Status: good (id: XXXXXX.com.gappssmtp.c)
> X-WP-MailID: 3f705f51c9402ad04c3cda34f72497b2
> X-WP-SPAM: NO (U9) 0W0001A [0QMk]
> )
> A9 OK Fetch completed
> ATTACHMENTS: 0
> {code}
> I've check all: imap, imaps, pop3 and pop3s



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to