On Thu, Jan 14, 2010 at 12:25 AM, sjmcduf <[email protected]> wrote:
>
> I have the following error:
>
> Caused by: java.lang.IllegalArgumentException: Only directory is supported.
> Endpoint must be configured with a valid directory: ftp.test
>        at
> org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:68)
>        at
> org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:31)
>        at
> org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:60)
>        at
> org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:83)
>        at org.apache.camel.impl.RouteService.doStart(RouteService.java:123)
>        at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:55)
>        at
> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:906)
>        ... 1 more
>
> By looking at the source code I saw the following :
>        // we assume its a file if the name has a dot in it (eg foo.txt)
>        if (configuration.getDirectory().contains(".")) {
>            throw new IllegalArgumentException("Only directory is supported.
> Endpoint must be configured with a valid directory: "
>                    + configuration.getDirectory());
>        }
>
> I remove that code and my code is working!! :-)
>
> I think the above code should not assume that.....
> What do you think ?
>

Its really a bad habit having a dot in a directory name.
On windows will that not often be considered a file?.

And since its a remote path we cannot on startup determine if its a
path or file.

The check was made in the transition from 1.x to 2.x where in 1.x you
could define a starting file or directory.
In 2.x you must specify a directory only.

We could relax the check but then people may still enter a filename
and think Camel will pickup that file.


> (using : camel 2.1.0)
>
> Simon
> --
> View this message in context: 
> http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27153817.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to