Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 63570 invoked from network); 2 Sep 2010 05:23:38 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 Sep 2010 05:23:38 -0000 Received: (qmail 92665 invoked by uid 500); 2 Sep 2010 05:23:38 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 92360 invoked by uid 500); 2 Sep 2010 05:23:36 -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 92352 invoked by uid 99); 2 Sep 2010 05:23:35 -0000 Received: from Unknown (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Sep 2010 05:23:35 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of willem.jiang@gmail.com designates 209.85.212.173 as permitted sender) Received: from [209.85.212.173] (HELO mail-px0-f173.google.com) (209.85.212.173) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Sep 2010 05:23:10 +0000 Received: by pxi12 with SMTP id 12so25085pxi.32 for ; Wed, 01 Sep 2010 22:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=M927OX89Mctq2AEyk6EWD3WeUf0ofwRPtUGmraM3gcQ=; b=UY7D4knk+YhS/tdqUPkQR0GWvfGH0rBiMwqAd5W13aWSYdAlTIg3kVQ5JuhFAeNbzL C27NKMN2fXdm9cZ4OfSu19AghvAI2CGu4oBFyW3zxAnynS3F+reK7FP1P+92b5G9QMIZ a/NayLnLnYioeA2MaVe8e7F2N4d5AtY48oJMA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=QJBeLj59ludYtqRtNLPb98f6Yc/dRkyEMwNr2PhmwhaAHfujd9z7+5Y0It0PikBFT4 PVCkbjG5FF3KNP31AZtmb50Q99hXuBTxD0cPUL50QGU3yzzKApHbznirS1xkyxs+E+Dx iDrQwpy7JeCiwhDx6h9o5FqCRICUoFr/aznJc= Received: by 10.115.77.17 with SMTP id e17mr9775709wal.108.1283404965543; Wed, 01 Sep 2010 22:22:45 -0700 (PDT) Received: from [192.168.0.158] ([125.34.10.228]) by mx.google.com with ESMTPS id k23sm138615waf.17.2010.09.01.22.22.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 01 Sep 2010 22:22:44 -0700 (PDT) Message-ID: <4C7F34A0.80505@gmail.com> Date: Thu, 02 Sep 2010 13:22:40 +0800 From: Willem Jiang User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: users@camel.apache.org Subject: Re: Skipping empty files, problem with simple language References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Bengt, I tried to reproduce you issue in Camel trunk, and found this bug[1]. BTW, If you just want to filter the zero length file, you can take a look this unit test file[2] and change the simple expression to "${file:length} == null" as in Camel 2.4.0, ${file:length} is null if the file.length is 0. [1]https://issues.apache.org/activemq/browse/CAMEL-3100 [2]https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerIntercepEmptyFileTest.java Willem Bengt Rodehav wrote: > I've developed a file transfer service (for file/ftp/ftps/sftp) that uses > Camel 2.4. I need to be able to skip transferring empty files and was hoping > to use an interceptor to accomplish this. Below is the relevant code: > > String skippedUri = "file://skipped/${date:now:yyyyMMdd}/${file:name}"; > interceptFrom().when(simple("${file:length}").isEqualTo(0)).to(skippedUri).end(); > > This compiles but in runtime a get the following exception when trying to > start the route: > > *java.lang.NoSuchMethodError: > se.digia.connect.services.skandia.filetransfer.FileTransferService$1.simple(Ljava/lang/String;)Lorg/apache/camel/builder/ValueBuilder; > * > * **at > se.digia.connect.services.skandia.filetransfer.FileTransferService$1.configure(FileTransferService.java:279) > * > * **at > org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:295) > * > * **at > org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:250) > * > * **at > org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:236) > * > * **at > org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:498) > * > * **at > se.digia.connect.core.service.RouteServiceBase.doStart(RouteServiceBase.java:42) > * > * **at se.digia.connect.core.service.ServiceBase.start(ServiceBase.java:49)* > * **at > se.digia.connect.services.skandia.filetransfer.FileTransferService.__start(FileTransferService.java:60) > * > * **at > se.digia.connect.services.skandia.filetransfer.FileTransferService.start(FileTransferService.java) > * > * **at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)* > * **at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > * > * **at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > * > * **at java.lang.reflect.Method.invoke(Method.java:597)* > * **at org.apache.felix.ipojo.util.Callback.call(Callback.java:235)* > * **at org.apache.felix.ipojo.util.Callback.call(Callback.java:191)* > * **at > org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86) > * > * **at > org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:162) > * > * **at > org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java) > * > * **at > org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:440)* > * **at > org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:321)* > * **at > org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:155) > * > * **at > org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:298) > * > * **at > org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:235) > * > * **at org.apache.felix.ipojo.IPojoFactory.updated(IPojoFactory.java:603)* > * **at > org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.run(ConfigurationManager.java:1279) > * > * **at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:88)* > > I've also tried the following: > > interceptFrom().when(simple("${file:length} == > 0")).to(skipped).end(); > > But it gives the following compilation error: > > *The method when(Predicate) in the type InterceptDefinition is not > applicable for the arguments (ValueBuilder)* > > What am I missing? This is the first time I'm using simple language and the > first time I'm using interceptors. I should also mention that I deploy the > camel route in Karaf 1.6.0 which means that OSGI could play a part I guess. > > /Bengt >