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

Marco Crivellaro commented on CAMEL-2153:
-----------------------------------------

I've tried the same route with a bunch of FTP Server, in some cases it works 
(no issues on org.apache.camel.component.file.remote.FtpOperations.existsFile).

When directory where to place the file is empty or doesn't exist
client.listNames(directory); returns an empty array in some ftp servers or null 
in some others
when client.listNames returns null the camel runs in NullPointerException

here is the piece of code where the exception is raised:

            String[] names = client.listNames(directory);
            for (String existing : names) {
                if (existing.equals(onlyName)) {
                    return true;
                }
            }

I guess you should just return false in case names is null.


> FTP Component issue with tempPrefix or tempFileName
> ---------------------------------------------------
>
>                 Key: CAMEL-2153
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2153
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-ftp
>    Affects Versions: 2.1.0
>         Environment: OS: Windows XP where application runs, Windows 2003 is 
> the FTP server.
>            Reporter: Marco Crivellaro
>            Assignee: Claus Ibsen
>             Fix For: 2.1.0
>
>
> using FTP component to push files via FTP I am facing issues pushing a file 
> on subfolder when using tempPrefix or tempFileName. 
> route sample: 
> from("direct:start").to("ftp://usern...@ipaddress?password=mypass&fileName=./camel/test/message.txt&tempFileName=${file:name.noext}.tmp";);
> no errors are raised if the final destination file doesn't exists, if it 
> exists following error is raised: 
> Exception in thread "main" org.apache.camel.CamelExecutionException: 
> Exception occurred during execution on the exchange: Exchange[Message: 
> Message content] 
>         at 
> org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1055)
>  
>         at 
> org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:446)
>  
>         at 
> org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:431)
>  
>         at 
> org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:427)
>  
>         at 
> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:112)
>  
>         at 
> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:117)
>  
>         at com.opta.camel.test.FTPTester.main(FTPTester.java:30) 
> Caused by: java.lang.NullPointerException 
>         at 
> org.apache.camel.component.file.remote.FtpOperations.existsFile(FtpOperations.java:372)
>         at 
> org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:92)
>  
>         at 
> org.apache.camel.component.file.remote.RemoteFileProducer.process(RemoteFileProducer.java:52)
>  
>         at 
> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:86)
>  
>         at 
> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:84)
>  
>         at 
> org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146) 
>         at 
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:83) 
>         at 
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>  
>         at 
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>  
>         at 
> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>  
>         at 
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:85)
>  
>         at 
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>  
>         at 
> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:232)
>  
>         at 
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:162)
>  
>         at 
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
>  
>         at 
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>  
>         at 
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:201) 
>         at 
> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>  
>         at 
> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>  
>         at 
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>  
>         at 
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:45)
>  
>         at 
> org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:179) 
>         at 
> org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:161) 
>         at 
> org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146) 
>         at 
> org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:160) 
>         at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:98) 
>         at 
> org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:97)
>  
>         at 
> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:110)
>  
>         ... 2 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to