[ 
https://issues.apache.org/jira/browse/NET-574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebb resolved NET-574.
----------------------
    Resolution: Invalid

The correct response to a MLST request is as follows:

{noformat}
250-Start of list for test.txt
 
modify=20150616133640;perm=adfrw;size=83752220;type=file;unique=23U8FE039C;UNIX.group=32;UNIX.mode=0644;UNIX.owner=2005;
 /data/test.txt
250 End of list
{noformat}

i.e. the second line should start with a single space.

See https://tools.ietf.org/html/rfc3659#section-7.2

It looks to me as though the server is not following the RFC.

> FTPClient.mlistFile returns null timestamps in FTPFile.getTimestamp
> -------------------------------------------------------------------
>
>                 Key: NET-574
>                 URL: https://issues.apache.org/jira/browse/NET-574
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>    Affects Versions: 3.3
>         Environment: On Debian linux with proftpd server
>            Reporter: Nicolas Leclerc
>
> In FTPClient mlistFile("test.txt") :
> {code:title=FTPClient.java|borderStyle=solid}
>     public FTPFile mlistFile(String pathname) throws IOException
>     {
>         boolean success = 
> FTPReply.isPositiveCompletion(sendCommand(FTPCmd.MLST, pathname));
>         if (success){
>             String entry = getReplyStrings()[1].substring(1); // skip leading 
> space for parser
>             return MLSxEntryParser.parseEntry(entry);
>         } else {
>             return null;
>         }
>     }
> {code}
> getReplyStrings() return :
> 250-Start of list for test.txt
> 250-modify=20150616133640;perm=adfrw;size=83752220;type=file;unique=23U8FE039C;UNIX.group=32;UNIX.mode=0644;UNIX.owner=2005;
>  /data/test.txt
> 250 End of list
> So getReplyStrings()[1].substring(1) return 
> 50-modify=20150616133640;perm=adfrw;size=83752220;type=file;unique=23U8FE039C;UNIX.group=32;UNIX.mode=0644;UNIX.owner=2005;
>  /data/test.txt
> {code:title=MLSxEntryParser.java|borderStyle=solid}
> public FTPFile parseFTPEntry(String entry) {
>         String parts[] = entry.split(" ",2); // Path may contain space
>         if (parts.length != 2) {
>             return null;
>         }
>         FTPFile file = new FTPFile();
>         file.setRawListing(entry);
>         file.setName(parts[1]);
>         String[] facts = parts[0].split(";");
>         boolean hasUnixMode = 
> parts[0].toLowerCase(Locale.ENGLISH).contains("unix.mode=");
>         for(String fact : facts) {
>             String []factparts = fact.split("=");
> // Sample missing permission
> // drwx------   2 mirror   mirror       4096 Mar 13  2010 subversion
> // 
> modify=20100313224553;perm=;type=dir;unique=811U282598;UNIX.group=500;UNIX.mode=0700;UNIX.owner=500;
>  subversion
>             if (factparts.length != 2) {
>                 continue; // nothing to do here
>             }
>             String factname = factparts[0].toLowerCase(Locale.ENGLISH);
>             String factvalue = factparts[1];
>             String valueLowerCase = factvalue.toLowerCase(Locale.ENGLISH);
>             if ("size".equals(factname)) {
>                 file.setSize(Long.parseLong(factvalue));
>             }
>             else if ("sizd".equals(factname)) { // Directory size
>                 file.setSize(Long.parseLong(factvalue));
>             }
>             else if ("modify".equals(factname)) {
> (...)
> {code}
> 50-modify not correspond to modify, so the parser not find the date
> Possible patch :
> {code:title=FTPClient.java|borderStyle=solid}
>     public FTPFile mlistFile(String pathname) throws IOException
>     {
>         boolean success = 
> FTPReply.isPositiveCompletion(sendCommand(FTPCmd.MLST, pathname));
>         if (success){
>             String entry = getReplyStrings()[1].substring(4); // skip leading 
> (...)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to