[jira] Created: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

classic Classic list List threaded Threaded
71 messages Options
1234
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
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 testCommonsNetBug() throws Exception {
    final FTPClient ftp = new FTPClient();
    ftp.addProtocolCommandListener(new LoggingCommandListener());
    ftp.connect(host);
    final boolean login = ftp.login(user, password);
    assertEquals(true, login);
    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.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org

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

HONMA Hirotaka updated NET-188:
-------------------------------

    Description:
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.


  was:
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.addProtocolCommandListener(new LoggingCommandListener());
    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.



> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

HONMA Hirotaka updated NET-188:
-------------------------------

    Description:
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.addProtocolCommandListener(new LoggingCommandListener());
    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.


  was:
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 testCommonsNetBug() throws Exception {
    final FTPClient ftp = new FTPClient();
    ftp.addProtocolCommandListener(new LoggingCommandListener());
    ftp.connect(host);
    final boolean login = ftp.login(user, password);
    assertEquals(true, login);
    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.



> 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.addProtocolCommandListener(new LoggingCommandListener());
>     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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Rory Winston commented on NET-188:
----------------------------------

Hmmm. This is a tough one. With no year information in the date string, SimpleDateFormat clears the internal Calendar and sets the YEAR field to 1970, the epoch  (the default). Normally, this will have no impact on date parsing, *except* when the year in question is a leap year, as 1970 wasn't one. Thus, SDF thinks that Feb 29th should be riolled over to March 1st in lenient mode, and in strict mode (the default for Net parsing), it simply returns null.  Of course, the real culprit is the horrible Java date/time package implementation. Using something like Joda-time for this works as expected.

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Rory Winston commented on NET-188:
----------------------------------

Something like this would fix it (I've tried it), but I think it's nasty:

if (short date validation fails)
  explicitly add the current year to the date string
   Create a new non-lenient SDF instance using using the previous SDF toPattern + " yyyy"
   Attempt to parse the date

Any comments? I'm tempted to mark this as WONTFIX.

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Sebb commented on NET-188:
--------------------------

The ftp directory listing output on Unix systems generally corresponds to that produced by "ls -l".

The man page for ls (e.g. on FreeBSD) says:

     If the modification time of the file is more than 6 months in the past or
     future, then the year of the last modification is displayed in place of
     the hour and minute fields.

So if the year is missing, why not set it according to the rule above?

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

ASHIZAWA Yoshinori commented on NET-188:
----------------------------------------

>Any comments? I'm tempted to mark this as WONTFIX.

Unfortunately it will not work well, because of lack of crossover year consideration.

Ex: If a file was created in Dec-2007 and current date was Jan-2008, the missing year would be 2007 (not current year).

I guess this issue isn't caused by a JDK implementation.
I hope it will be fixed soon (not WONTFIX).



> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Ad Timmering commented on NET-188:
----------------------------------

A fix for this would be greatly appreciated.

Rory: If not in the Commons Net, where should this be addressed in your opinion?

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Rory Winston commented on NET-188:
----------------------------------

It is a JDK implementation issue. That's the whole point of the analysis.

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Sebb commented on NET-188:
--------------------------

If the fie was created in Dec 2007, and it is now Jan 2008, then the year will be omitted on Unix systems.

Since Dec is less that 6 months behind Jan, and > 6 months ahead, the omitted year must be 2007.

Pseudocode:

If year is not present
then
      calculate date using current year
      if date - now > 6 months (or calculation fails)
      then
          calculate date using previous year
     endif
endif

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Sebb commented on NET-188:
--------------------------

@Rory: I don't agree that it's a JDK problem.

SimpleDateFormat may not be as flexible as one might want, but it's not its fault that it cannot handle all partially specified dates.

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Rory Winston commented on NET-188:
----------------------------------

That should work. I do think this will only happen in the case of Feb 29th , in which case we dont need to check the year, as it will always be the current year.  

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Sebb commented on NET-188:
--------------------------

Agreed Feb 29 cannot be the previous year as it is more than 6 months from the end of the year.

It could potentially be the next year - if the system clock has been turned back, or the file is future-dated.
[I assume the original example must have been created by future-dating a file]

However the most common case is that Feb 29 will be the current year.

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Rory Winston commented on NET-188:
----------------------------------

Something like this would work, if the initial recent date format parsing fails:

[code]
if (recentDateFormat != null) {
                                pp = new ParsePosition(0);
                                int year = Calendar.getInstance().get(Calendar.YEAR);
                                String timeStampStrPlusYear = timestampStr + " " + year;
                                SimpleDateFormat hackFormatter = new SimpleDateFormat(recentDateFormat.toPattern() + " yyyy");
                                hackFormatter.setLenient(false);
                                parsed = hackFormatter.parse(timeStampStrPlusYear, pp);
                        }
                        if (parsed != null && pp.getIndex() == timestampStr.length() + 5) {
                                working.setTime(parsed);
                        }
[/code]
Although that is really hacky.

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Issue Comment Edited: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

[hidden email] edited comment on NET-188 at 2/26/08 4:15 AM:
-----------------------------------------------------------

Something like this would work, if the initial recent date format parsing fails:

{code}
if (recentDateFormat != null) {
                                pp = new ParsePosition(0);
                                int year = Calendar.getInstance().get(Calendar.YEAR);
                                String timeStampStrPlusYear = timestampStr + " " + year;
                                SimpleDateFormat hackFormatter = new SimpleDateFormat(recentDateFormat.toPattern() + " yyyy");
                                hackFormatter.setLenient(false);
                                parsed = hackFormatter.parse(timeStampStrPlusYear, pp);
                        }
                        if (parsed != null && pp.getIndex() == timestampStr.length() + 5) {
                                working.setTime(parsed);
                        }
{code}
Although that is really hacky.

      was (Author: [hidden email]):
    Something like this would work, if the initial recent date format parsing fails:

[code]
if (recentDateFormat != null) {
                                pp = new ParsePosition(0);
                                int year = Calendar.getInstance().get(Calendar.YEAR);
                                String timeStampStrPlusYear = timestampStr + " " + year;
                                SimpleDateFormat hackFormatter = new SimpleDateFormat(recentDateFormat.toPattern() + " yyyy");
                                hackFormatter.setLenient(false);
                                parsed = hackFormatter.parse(timeStampStrPlusYear, pp);
                        }
                        if (parsed != null && pp.getIndex() == timestampStr.length() + 5) {
                                working.setTime(parsed);
                        }
[/code]
Although that is really hacky.
 

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Rory Winston commented on NET-188:
----------------------------------

Ok....I've added a "fix" on the 2.0 dev branch for testing.....does anyone feel brave enough to check it out, build it, and try a test to see if it works on their system?

$ svn checkout http://svn.apache.org/repos/asf/commons/proper/net/branches/NET_2_0 commons-net


> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

HONMA Hirotaka commented on NET-188:
------------------------------------

Rory, thank you for the quick follow-up.

In my environment, I got it to work when I also provided DateFormatSymbols to the constructor to make sure the formatting is done in the same locale.
Also, I think setting the TimeZone is necessary. Please let me know your thoughts.

Please see below for proposed changes:

{code}
Index: FTPTimestampParserImpl.java
===================================================================
--- FTPTimestampParserImpl.java (revision 631446)
+++ FTPTimestampParserImpl.java (working copy)
@@ -104,8 +104,9 @@
  pp = new ParsePosition(0);
  int year = Calendar.getInstance().get(Calendar.YEAR);
  String timeStampStrPlusYear = timestampStr + " " + year;
- SimpleDateFormat hackFormatter = new SimpleDateFormat(recentDateFormat.toPattern() + " yyyy");
+ SimpleDateFormat hackFormatter = new SimpleDateFormat(recentDateFormat.toPattern() + " yyyy", recentDateFormat.getDateFormatSymbols());
  hackFormatter.setLenient(false);
+ hackFormatter.setTimeZone(recentDateFormat.getTimeZone());
  parsed = hackFormatter.parse(timeStampStrPlusYear, pp);
  }
  if (parsed != null && pp.getIndex() == timestampStr.length() + 5) {
{code}


> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Will Wright commented on NET-188:
---------------------------------

Thanks HONMA - came across this when our production system refused to retrieve any files for today. This fix works a treat.

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Tim Fooy commented on NET-188:
------------------------------

A combination of this issue and this one https://issues.apache.org/bugzilla/show_bug.cgi?id=41724  has caused a lot of problems in our production environment.  Too bad that the ANT team seems to have fixed this half a year ago but have not released anything since then.  (See http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java?r1=526548&r2=574313&diff_format=h )
I hope these fixes in both projects will soon reach a release.

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-188) FTPClient#listFiles returns null element when file's timestamp is "02/29"

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ 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.

1234