You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Raphaël Luta (JIRA)" <ji...@apache.org> on 2010/09/21 22:00:40 UTC

[jira] Created: (CAMEL-3144) camel-ftp: fileExist=Fail not honored when producer works in FTP root path

camel-ftp: fileExist=Fail not honored when producer works in FTP root path
--------------------------------------------------------------------------

                 Key: CAMEL-3144
                 URL: https://issues.apache.org/activemq/browse/CAMEL-3144
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-core, camel-ftp
    Affects Versions: 2.4.0
         Environment: Camel on Linux; IIS FTP server 
            Reporter: Raphaël Luta
         Attachments: FileUtil.patch

when using a route with ftp producer such as :

 <to uri="ftp://user@host/?fileExist=Fail&fileName=test&password=mypass" />

The route will not correctly fail if the fileName already exists.

It will work in any sub-directory:

 <to uri="ftp://user@host/mydir?fileExist=Fail&fileName=test&password=mypass" />

The root cause of the bug is an incorrect test in org.apache.camel.util.FileUtil.onlyPath() in component camel-core.
This method returns null when the parameter string is "/". It should return "/".

The attached patch fixes the issue.


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


[jira] Commented: (CAMEL-3144) camel-ftp: fileExist=Fail not honored when producer works in FTP root path

Posted by "Hadrian Zbarcea (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61977#action_61977 ] 

Hadrian Zbarcea commented on CAMEL-3144:
----------------------------------------

Patch applied with minor changes and checkstyle fixes. Thanks Raphael for spotting this.

> camel-ftp: fileExist=Fail not honored when producer works in FTP root path
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-3144
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3144
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-ftp
>    Affects Versions: 2.4.0
>         Environment: Camel on Linux; IIS FTP server 
>            Reporter: Raphaël Luta
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>         Attachments: FileUtil.patch
>
>
> when using a route with ftp producer such as :
>  <to uri="ftp://user@host/?fileExist=Fail&fileName=test&password=mypass" />
> The route will not correctly fail if the fileName already exists.
> It will work in any sub-directory:
>  <to uri="ftp://user@host/mydir?fileExist=Fail&fileName=test&password=mypass" />
> The root cause of the bug is an incorrect test in org.apache.camel.util.FileUtil.onlyPath() in component camel-core.
> This method returns null when the parameter string is "/". It should return "/".
> The attached patch fixes the issue.

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


[jira] Assigned: (CAMEL-3144) camel-ftp: fileExist=Fail not honored when producer works in FTP root path

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-3144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-3144:
----------------------------------

    Assignee: Claus Ibsen

> camel-ftp: fileExist=Fail not honored when producer works in FTP root path
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-3144
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3144
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-ftp
>    Affects Versions: 2.4.0
>         Environment: Camel on Linux; IIS FTP server 
>            Reporter: Raphaël Luta
>            Assignee: Claus Ibsen
>         Attachments: FileUtil.patch
>
>
> when using a route with ftp producer such as :
>  <to uri="ftp://user@host/?fileExist=Fail&fileName=test&password=mypass" />
> The route will not correctly fail if the fileName already exists.
> It will work in any sub-directory:
>  <to uri="ftp://user@host/mydir?fileExist=Fail&fileName=test&password=mypass" />
> The root cause of the bug is an incorrect test in org.apache.camel.util.FileUtil.onlyPath() in component camel-core.
> This method returns null when the parameter string is "/". It should return "/".
> The attached patch fixes the issue.

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


[jira] Commented: (CAMEL-3144) camel-ftp: fileExist=Fail not honored when producer works in FTP root path

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61980#action_61980 ] 

Claus Ibsen commented on CAMEL-3144:
------------------------------------

Btw the patch is buggy. It should return null if there is no path, but it returns the name of the file. I have fixed that as well.
Running full tests before committing fixes and additional unit tests.

Hadrian we should take time to add tests for patches when they discover a bug in which we don't have an unit test for.

> camel-ftp: fileExist=Fail not honored when producer works in FTP root path
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-3144
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3144
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-ftp
>    Affects Versions: 2.4.0
>         Environment: Camel on Linux; IIS FTP server 
>            Reporter: Raphaël Luta
>            Assignee: Hadrian Zbarcea
>             Fix For: 2.5.0
>
>         Attachments: FileUtil.patch
>
>
> when using a route with ftp producer such as :
>  <to uri="ftp://user@host/?fileExist=Fail&fileName=test&password=mypass" />
> The route will not correctly fail if the fileName already exists.
> It will work in any sub-directory:
>  <to uri="ftp://user@host/mydir?fileExist=Fail&fileName=test&password=mypass" />
> The root cause of the bug is an incorrect test in org.apache.camel.util.FileUtil.onlyPath() in component camel-core.
> This method returns null when the parameter string is "/". It should return "/".
> The attached patch fixes the issue.

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


[jira] Commented: (CAMEL-3144) camel-ftp: fileExist=Fail not honored when producer works in FTP root path

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61978#action_61978 ] 

Claus Ibsen commented on CAMEL-3144:
------------------------------------

Hadrian I am adding additional unit test for this in camel-core and camel-ftp

> camel-ftp: fileExist=Fail not honored when producer works in FTP root path
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-3144
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3144
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-ftp
>    Affects Versions: 2.4.0
>         Environment: Camel on Linux; IIS FTP server 
>            Reporter: Raphaël Luta
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>         Attachments: FileUtil.patch
>
>
> when using a route with ftp producer such as :
>  <to uri="ftp://user@host/?fileExist=Fail&fileName=test&password=mypass" />
> The route will not correctly fail if the fileName already exists.
> It will work in any sub-directory:
>  <to uri="ftp://user@host/mydir?fileExist=Fail&fileName=test&password=mypass" />
> The root cause of the bug is an incorrect test in org.apache.camel.util.FileUtil.onlyPath() in component camel-core.
> This method returns null when the parameter string is "/". It should return "/".
> The attached patch fixes the issue.

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


[jira] Updated: (CAMEL-3144) camel-ftp: fileExist=Fail not honored when producer works in FTP root path

Posted by "Raphaël Luta (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-3144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raphaël Luta updated CAMEL-3144:
--------------------------------

    Attachment: FileUtil.patch

> camel-ftp: fileExist=Fail not honored when producer works in FTP root path
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-3144
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3144
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-ftp
>    Affects Versions: 2.4.0
>         Environment: Camel on Linux; IIS FTP server 
>            Reporter: Raphaël Luta
>         Attachments: FileUtil.patch
>
>
> when using a route with ftp producer such as :
>  <to uri="ftp://user@host/?fileExist=Fail&fileName=test&password=mypass" />
> The route will not correctly fail if the fileName already exists.
> It will work in any sub-directory:
>  <to uri="ftp://user@host/mydir?fileExist=Fail&fileName=test&password=mypass" />
> The root cause of the bug is an incorrect test in org.apache.camel.util.FileUtil.onlyPath() in component camel-core.
> This method returns null when the parameter string is "/". It should return "/".
> The attached patch fixes the issue.

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


[jira] Commented: (CAMEL-3144) camel-ftp: fileExist=Fail not honored when producer works in FTP root path

Posted by "Raphaël Luta (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61982#action_61982 ] 

Raphaël Luta commented on CAMEL-3144:
-------------------------------------

You're right, the patch is buggy. I should have tested it with more use cases than my own before attaching, sorry about this.

Actually, I'm not even sure it is the correct fix because other components may depend on the FileUtil.onlyPath("/") == null behavior for correct operation.
I'm unsure of the expected semantics of the operation in root directory on a file system rather than remote file system.

An alternate fix with less potential side effects would be to directly fix FtpOperations to better handle a return null from onlyPath(), something like:

--- FtpOperations.java	2010-09-22 09:16:25.000000000 +0200
+++ FtpOperations.java.patched	2010-09-22 09:18:51.000000000 +0200
@@ -381,7 +381,7 @@
         // check whether a file already exists
         String directory = FileUtil.onlyPath(name);
         if (directory == null) {
-            return false;
+	    directory = "/";
         }
 
         String onlyName = FileUtil.stripPath(name);


> camel-ftp: fileExist=Fail not honored when producer works in FTP root path
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-3144
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3144
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-ftp
>    Affects Versions: 2.4.0
>         Environment: Camel on Linux; IIS FTP server 
>            Reporter: Raphaël Luta
>            Assignee: Hadrian Zbarcea
>             Fix For: 2.5.0
>
>         Attachments: FileUtil.patch
>
>
> when using a route with ftp producer such as :
>  <to uri="ftp://user@host/?fileExist=Fail&fileName=test&password=mypass" />
> The route will not correctly fail if the fileName already exists.
> It will work in any sub-directory:
>  <to uri="ftp://user@host/mydir?fileExist=Fail&fileName=test&password=mypass" />
> The root cause of the bug is an incorrect test in org.apache.camel.util.FileUtil.onlyPath() in component camel-core.
> This method returns null when the parameter string is "/". It should return "/".
> The attached patch fixes the issue.

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


[jira] Commented: (CAMEL-3144) camel-ftp: fileExist=Fail not honored when producer works in FTP root path

Posted by "Raphaël Luta (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=62031#action_62031 ] 

Raphaël Luta commented on CAMEL-3144:
-------------------------------------

I've created a test environment using camel-2.5-SNAPSHOT artefacts and could not reproduce the bug.

A tcpdump trace shows that camel-ftp now correctly tries to list the target directory before attempting to write the file.

> camel-ftp: fileExist=Fail not honored when producer works in FTP root path
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-3144
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3144
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-ftp
>    Affects Versions: 2.4.0
>         Environment: Camel on Linux; IIS FTP server 
>            Reporter: Raphaël Luta
>            Assignee: Hadrian Zbarcea
>             Fix For: 2.5.0
>
>         Attachments: FileUtil.patch
>
>
> when using a route with ftp producer such as :
>  <to uri="ftp://user@host/?fileExist=Fail&fileName=test&password=mypass" />
> The route will not correctly fail if the fileName already exists.
> It will work in any sub-directory:
>  <to uri="ftp://user@host/mydir?fileExist=Fail&fileName=test&password=mypass" />
> The root cause of the bug is an incorrect test in org.apache.camel.util.FileUtil.onlyPath() in component camel-core.
> This method returns null when the parameter string is "/". It should return "/".
> The attached patch fixes the issue.

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


[jira] Commented: (CAMEL-3144) camel-ftp: fileExist=Fail not honored when producer works in FTP root path

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61981#action_61981 ] 

Claus Ibsen commented on CAMEL-3144:
------------------------------------

Okay unit test added and file util fixed as well.

> camel-ftp: fileExist=Fail not honored when producer works in FTP root path
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-3144
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3144
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-ftp
>    Affects Versions: 2.4.0
>         Environment: Camel on Linux; IIS FTP server 
>            Reporter: Raphaël Luta
>            Assignee: Hadrian Zbarcea
>             Fix For: 2.5.0
>
>         Attachments: FileUtil.patch
>
>
> when using a route with ftp producer such as :
>  <to uri="ftp://user@host/?fileExist=Fail&fileName=test&password=mypass" />
> The route will not correctly fail if the fileName already exists.
> It will work in any sub-directory:
>  <to uri="ftp://user@host/mydir?fileExist=Fail&fileName=test&password=mypass" />
> The root cause of the bug is an incorrect test in org.apache.camel.util.FileUtil.onlyPath() in component camel-core.
> This method returns null when the parameter string is "/". It should return "/".
> The attached patch fixes the issue.

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


[jira] Commented: (CAMEL-3144) camel-ftp: fileExist=Fail not honored when producer works in FTP root path

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61983#action_61983 ] 

Claus Ibsen commented on CAMEL-3144:
------------------------------------

Raphael can you test source from trunk as I also modified camel-ftp as well.

> camel-ftp: fileExist=Fail not honored when producer works in FTP root path
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-3144
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3144
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-ftp
>    Affects Versions: 2.4.0
>         Environment: Camel on Linux; IIS FTP server 
>            Reporter: Raphaël Luta
>            Assignee: Hadrian Zbarcea
>             Fix For: 2.5.0
>
>         Attachments: FileUtil.patch
>
>
> when using a route with ftp producer such as :
>  <to uri="ftp://user@host/?fileExist=Fail&fileName=test&password=mypass" />
> The route will not correctly fail if the fileName already exists.
> It will work in any sub-directory:
>  <to uri="ftp://user@host/mydir?fileExist=Fail&fileName=test&password=mypass" />
> The root cause of the bug is an incorrect test in org.apache.camel.util.FileUtil.onlyPath() in component camel-core.
> This method returns null when the parameter string is "/". It should return "/".
> The attached patch fixes the issue.

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


[jira] Resolved: (CAMEL-3144) camel-ftp: fileExist=Fail not honored when producer works in FTP root path

Posted by "Hadrian Zbarcea (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-3144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hadrian Zbarcea resolved CAMEL-3144.
------------------------------------

    Resolution: Fixed

> camel-ftp: fileExist=Fail not honored when producer works in FTP root path
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-3144
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3144
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-ftp
>    Affects Versions: 2.4.0
>         Environment: Camel on Linux; IIS FTP server 
>            Reporter: Raphaël Luta
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>         Attachments: FileUtil.patch
>
>
> when using a route with ftp producer such as :
>  <to uri="ftp://user@host/?fileExist=Fail&fileName=test&password=mypass" />
> The route will not correctly fail if the fileName already exists.
> It will work in any sub-directory:
>  <to uri="ftp://user@host/mydir?fileExist=Fail&fileName=test&password=mypass" />
> The root cause of the bug is an incorrect test in org.apache.camel.util.FileUtil.onlyPath() in component camel-core.
> This method returns null when the parameter string is "/". It should return "/".
> The attached patch fixes the issue.

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


[jira] Assigned: (CAMEL-3144) camel-ftp: fileExist=Fail not honored when producer works in FTP root path

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-3144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-3144:
----------------------------------

    Assignee: Hadrian Zbarcea  (was: Claus Ibsen)

> camel-ftp: fileExist=Fail not honored when producer works in FTP root path
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-3144
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3144
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-ftp
>    Affects Versions: 2.4.0
>         Environment: Camel on Linux; IIS FTP server 
>            Reporter: Raphaël Luta
>            Assignee: Hadrian Zbarcea
>             Fix For: 2.5.0
>
>         Attachments: FileUtil.patch
>
>
> when using a route with ftp producer such as :
>  <to uri="ftp://user@host/?fileExist=Fail&fileName=test&password=mypass" />
> The route will not correctly fail if the fileName already exists.
> It will work in any sub-directory:
>  <to uri="ftp://user@host/mydir?fileExist=Fail&fileName=test&password=mypass" />
> The root cause of the bug is an incorrect test in org.apache.camel.util.FileUtil.onlyPath() in component camel-core.
> This method returns null when the parameter string is "/". It should return "/".
> The attached patch fixes the issue.

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


[jira] Commented: (CAMEL-3144) camel-ftp: fileExist=Fail not honored when producer works in FTP root path

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=62033#action_62033 ] 

Claus Ibsen commented on CAMEL-3144:
------------------------------------

Ah this is great news. Thanks for testing Raphael.

> camel-ftp: fileExist=Fail not honored when producer works in FTP root path
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-3144
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3144
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-ftp
>    Affects Versions: 2.4.0
>         Environment: Camel on Linux; IIS FTP server 
>            Reporter: Raphaël Luta
>            Assignee: Hadrian Zbarcea
>             Fix For: 2.5.0
>
>         Attachments: FileUtil.patch
>
>
> when using a route with ftp producer such as :
>  <to uri="ftp://user@host/?fileExist=Fail&fileName=test&password=mypass" />
> The route will not correctly fail if the fileName already exists.
> It will work in any sub-directory:
>  <to uri="ftp://user@host/mydir?fileExist=Fail&fileName=test&password=mypass" />
> The root cause of the bug is an incorrect test in org.apache.camel.util.FileUtil.onlyPath() in component camel-core.
> This method returns null when the parameter string is "/". It should return "/".
> The attached patch fixes the issue.

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


[jira] Updated: (CAMEL-3144) camel-ftp: fileExist=Fail not honored when producer works in FTP root path

Posted by "Hadrian Zbarcea (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-3144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hadrian Zbarcea updated CAMEL-3144:
-----------------------------------

    Fix Version/s: 2.5.0

> camel-ftp: fileExist=Fail not honored when producer works in FTP root path
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-3144
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3144
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-ftp
>    Affects Versions: 2.4.0
>         Environment: Camel on Linux; IIS FTP server 
>            Reporter: Raphaël Luta
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>         Attachments: FileUtil.patch
>
>
> when using a route with ftp producer such as :
>  <to uri="ftp://user@host/?fileExist=Fail&fileName=test&password=mypass" />
> The route will not correctly fail if the fileName already exists.
> It will work in any sub-directory:
>  <to uri="ftp://user@host/mydir?fileExist=Fail&fileName=test&password=mypass" />
> The root cause of the bug is an incorrect test in org.apache.camel.util.FileUtil.onlyPath() in component camel-core.
> This method returns null when the parameter string is "/". It should return "/".
> The attached patch fixes the issue.

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