commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antony Riley (JIRA)" <j...@apache.org>
Subject [jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"
Date Fri, 29 Feb 2008 14:02:54 GMT

    [ https://issues.apache.org/jira/browse/NET-188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573746#action_12573746
] 

Antony Riley commented on NET-188:
----------------------------------

I'm not in a position to ship the a 3rd party library from subversion as part of our companies
product, and this bug is critical for me.

I need a  workaround for this, unfortunately my attempts are getting more and more hacky,
my original attempt involved using the deprecated API to create my own subclass of UnixFTPEntryParser,
and then I overrode parseTimestamp() to simply return null as for my purposes I do not need
the timestamp.

Unfortunately the code in UnixFTPEntryParser.parseFTPEntry(...) calls super.parseTimestamp(...)
which makes this approach fail.

I'm also quite perturbed that the API to plug in your own parser has been deprecated and no
alternative method to provide your own parser has been implemented, it's naive to say the
least to assume that the commons-net implementation will support all possible list formats
in existence.

> FTPClient#listFiles returns null element when file's timestamp is "02/29"
> -------------------------------------------------------------------------
>
>                 Key: NET-188
>                 URL: https://issues.apache.org/jira/browse/NET-188
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: HONMA Hirotaka
>
> This issue has same cause as VALIDATOR-221.
> org.apache.commons.net.ftp.parser.FTPTimestampParserImpl#parseTimestamp throws ParseException
with timestampStr = "Feb 29 11:22".
> FTP Server status:
> {code}
> [root@localhost test-commonsnet]# pwd
> /tmp/test-commonsnet
> [root@localhost test-commonsnet]# ls -l
> total 0
> -rw-r--r--  1 root root 0 Dec 19  2006 aaa.txt
> -rw-r--r--  1 root root 0 Feb 29 11:22 bbb.txt
> {code}
> test code:
> {code}
> public void testCommonsNetLeapDay() throws Exception {
>     final FTPClient ftp = new FTPClient();
>     ftp.connect(host);
>     ftp.login(user, password);
>     final FTPFile[] listFiles = ftp.listFiles("/tmp/test-commonsnet");
>     for (int i = 0; i < listFiles.length; i++) {
>         System.out.println("[" + i + "] " + listFiles[i]);
>     }
>     ftp.disconnect();
> }
> {code}
> results bellow.
> {code}
> [0] -rw-r--r--    1 0        0               0 Dec 18  2006 aaa.txt
> [1] null
> {code}
> Second element(bbb.txt) should not be null.

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


Mime
View raw message