FTP assumes that directory name do not have dot 
------------------------------------------------

                 Key: CAMEL-2362
                 URL: https://issues.apache.org/activemq/browse/CAMEL-2362
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-ftp
    Affects Versions: 2.1.0
            Reporter: Simon



See 
http://old.nabble.com/FTP-assume-directory-do-not-have-dot-td27153817.html#a27160086
(COpy paste)
>
> 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 ?
>
... [show rest of quote]

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.

[SIMON]
Windows directory can contains a dot... a good example is in your eclipse 
installation... example:
Directory name=org.eclipse.emf.teneo.jpox_1.0.1.v200902271808

Also I think that check is useless because you can still enter something 
without a dot and it is in fact a file... so the endpoint should verify that 
after the connection.

Simon 

Yeah good call

Do you mind creating a ticket in JIRA about this?
http://issues.apache.org/activemq/browse/CAMEL

-- 
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