You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Norbert Seekircher (JIRA)" <ji...@apache.org> on 2006/11/28 14:07:21 UTC

[jira] Created: (NET-144) FTP: Filenames containing leading and trailing spaces

FTP: Filenames containing leading and trailing spaces
-----------------------------------------------------

                 Key: NET-144
                 URL: http://issues.apache.org/jira/browse/NET-144
             Project: Commons Net
          Issue Type: Bug
    Affects Versions: 1.4 Final
            Reporter: Norbert Seekircher


The FTPClient's listFiles() method seems to trim filenames removing leading and trailing spaces.

E. g.:
Create a directory "/parent" containing a file " test " (one leading and one trailing space) on an ftp server.

Then call this code:
        FTPClient ftp = new FTPClient();
        ftp.connect(SERVER_NAME);
        ftp.login(LOGIN, PASS);
        
        FTPFile[] files = ftp.listFiles("/parent");
        
        for (FTPFile file : files) {
            System.out.println("\"" + file.getName() + "\"");
        }

It will print out "test" instead of " test ".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (NET-144) FTP: Filenames containing leading and trailing spaces

Posted by "Michael Labicki (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/NET-144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12485469 ] 

Michael Labicki commented on NET-144:
-------------------------------------

Hi,
I resolved the problem on the UNIX System patching org.apache.commons.net.ftp.parser.UnixFTPEntryParser.java. 
By changing the regular expression string (private static final String
REGEX) in line 107:

I replaced
+ "(\\d+(?::\\d+)?)\\s+"

with
+ "(\\d+(?::\\d+)?)\\s{1}" 

(\\s{1} means, that it trims only the first leading space on the name)


It would be nice, if you could add this patch in your next apache.commons.net version.


> FTP: Filenames containing leading and trailing spaces
> -----------------------------------------------------
>
>                 Key: NET-144
>                 URL: https://issues.apache.org/jira/browse/NET-144
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Norbert Seekircher
>
> The FTPClient's listFiles() method seems to trim filenames removing leading and trailing spaces.
> E. g.:
> Create a directory "/parent" containing a file " test " (one leading and one trailing space) on an ftp server.
> Then call this code:
>         FTPClient ftp = new FTPClient();
>         ftp.connect(SERVER_NAME);
>         ftp.login(LOGIN, PASS);
>         
>         FTPFile[] files = ftp.listFiles("/parent");
>         
>         for (FTPFile file : files) {
>             System.out.println("\"" + file.getName() + "\"");
>         }
> It will print out "test" instead of " test ".

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Closed: (NET-144) FTP: Filenames containing leading and trailing spaces

Posted by "Rory Winston (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/NET-144?page=all ]

Rory Winston closed NET-144.
----------------------------

    Resolution: Won't Fix

We've discussed this issue before, and the consensus at the time was that we wouldnt add a fix specifically for this issue, as it seems to be an extreme edge case. If you disagree and you would like to have a go, feel free to submit a patch. 

> FTP: Filenames containing leading and trailing spaces
> -----------------------------------------------------
>
>                 Key: NET-144
>                 URL: http://issues.apache.org/jira/browse/NET-144
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 1.4 Final
>            Reporter: Norbert Seekircher
>
> The FTPClient's listFiles() method seems to trim filenames removing leading and trailing spaces.
> E. g.:
> Create a directory "/parent" containing a file " test " (one leading and one trailing space) on an ftp server.
> Then call this code:
>         FTPClient ftp = new FTPClient();
>         ftp.connect(SERVER_NAME);
>         ftp.login(LOGIN, PASS);
>         
>         FTPFile[] files = ftp.listFiles("/parent");
>         
>         for (FTPFile file : files) {
>             System.out.println("\"" + file.getName() + "\"");
>         }
> It will print out "test" instead of " test ".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org