commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Labicki (JIRA)" <j...@apache.org>
Subject [jira] Commented: (NET-144) FTP: Filenames containing leading and trailing spaces
Date Fri, 30 Mar 2007 10:36:25 GMT

    [ 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


Mime
View raw message