Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0015511E18 for ; Fri, 4 Jul 2014 03:29:55 +0000 (UTC) Received: (qmail 35335 invoked by uid 500); 4 Jul 2014 03:29:55 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 35287 invoked by uid 500); 4 Jul 2014 03:29:55 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 35275 invoked by uid 99); 4 Jul 2014 03:29:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jul 2014 03:29:54 +0000 X-ASF-Spam-Status: No, hits=2.3 required=5.0 tests=FREEMAIL_REPLY,RCVD_IN_DNSWL_NONE,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of willem.jiang@gmail.com designates 209.85.192.174 as permitted sender) Received: from [209.85.192.174] (HELO mail-pd0-f174.google.com) (209.85.192.174) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jul 2014 03:29:52 +0000 Received: by mail-pd0-f174.google.com with SMTP id y10so1249911pdj.33 for ; Thu, 03 Jul 2014 20:29:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :content-type:content-transfer-encoding:content-disposition; bh=f0SasDszwDL076zX1OSfwUgt6b9F+UdHqvovPjcCb0M=; b=sIlEC2ctnAITkhXCYc4Cf4+jMOQsqS8vRzuffxkwNsiCsu0C3AU46PO1Akp8FrKUo5 s2Wawpuu9kyutJtOJF1hgTwKDHgWTwtqqvIeNi98P+R0TzsC6CZpNV45pLtsm0/NLLPo 9QGpFhGPCEM9Faby5U0gXtuACnPPZwNy1ifVdRi9bcaCsw7RSKB8Spt0fH1miiOnJQqH Py36AloEiscdeq/YaeaBVgO1Jogl4k1hLpAfvW+8tRR5R46CJjn4cs8Yz0xuqMvVA1t7 ho0cPwksX94hFJFcarXVJzvJI8kn7+yaIlq7C2UNUSvyuzTATyGLnKyFnH04Vaex3bnv Refg== X-Received: by 10.66.252.35 with SMTP id zp3mr8484108pac.40.1404444567796; Thu, 03 Jul 2014 20:29:27 -0700 (PDT) Received: from dhcp-17-73.nay.redhat.com ([203.114.244.88]) by mx.google.com with ESMTPSA id y9sm6849687pdj.52.2014.07.03.20.29.24 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Jul 2014 20:29:25 -0700 (PDT) Date: Fri, 4 Jul 2014 11:29:13 +0800 From: Willem Jiang To: users@camel.apache.org Message-ID: In-Reply-To: References: <1404387768672-5753283.post@n5.nabble.com> Subject: Re: Attachments are Lost using Bean Language X-Mailer: Airmail (237) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org After did some patch work, I have to take my world back. I don=E2=80=99t = think we need to copy the attachment back in the InvokeProcessor. =46or BeanExpression, we are not supposed to modify the exchange or the m= essage in the evaluation processor, camel just want to know the result of= the evaluation. If you want to change the message attachment header, you can use bean pro= cess to do that kind of job. I just commit an unit test=5B1=5D to show ho= w to set the attachment in the bean processor. =5B1=5Dhttp://git-wip-us.apache.org/repos/asf/camel/commit/a749cefe=C2=A0= -- =20 Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang =20 Weibo: =E5=A7=9C=E5=AE=81willem On July 3, 2014 at 10:18:08 PM, Willem Jiang (willem.jiang=40gmail.com) w= rote: > Yeah, we need to copy the attachments back. > I just filled a JIRA=5B1=5D for it. > =20 > =5B1=5Dhttps://issues.apache.org/jira/browse/CAMEL-7575 > =20 > -- > Willem Jiang > =20 > Red Hat, Inc. > Web: http://www.redhat.com > Blog: http://willemjiang.blogspot.com (English) > http://jnn.iteye.com (Chinese) > Twitter: willemjiang > Weibo: =E5=A7=9C=E5=AE=81willem > =20 > =20 > =20 > On July 3, 2014 at 8:00:24 PM, sabri.bousselmi (infosabri=40yahoo.fr) w= rote: > > I think there is a serious issue when evaluatiog Bean language expres= sion. it > > seems like attachments are not copied from the resulting exchage. > > very simple case: invoke a methode where you add an attachment to the= > > exchange, when the evaluation is ending the value of the exchange wil= l be > > null. > > I debuged in camel source code, the method process Line n:174 did not= copie > > the attachment, below the source code: > > ------------------------------- > > // copy the original exchange to avoid side effects on it > > Exchange resultExchange =3D exchange.copy(); > > // remove any existing exception in case we do OGNL on the > > exception > > resultExchange.setException(null); > > > > // force to use InOut to retrieve the result on the OUT > > message > > resultExchange.setPattern(ExchangePattern.InOut); > > processor.process(resultExchange); > > result =3D resultExchange.getOut().getBody(); > > > > // propagate properties and headers from result > > if (resultExchange.hasProperties()) =7B > > > > exchange.getProperties().putAll(resultExchange.getProperties()); > > =7D > > if (resultExchange.getOut().hasHeaders()) =7B > > > > exchange.getIn().getHeaders().putAll(resultExchange.getOut().getHeade= rs()); =20 > > =7D > > > > // propagate exceptions > > if (resultExchange.getException() =21=3D null) =7B > > exchange.setException(resultExchange.getException()); > > =7D > > ---------------------------------------------------------------------= ---- =20 > > can you please approve the issue. > > > > > > > > -- > > View this message in context: http://camel.465427.n5.nabble.com/Attac= hments-are-Lost-using-Bean-Language-tp5753283.html =20 > > Sent from the Camel - Users mailing list archive at Nabble.com. > > > =20 > =20