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

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 - 3 - 4 | Next >

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

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.


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

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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


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

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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


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

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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


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

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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


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

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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


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

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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


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

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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


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

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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


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

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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


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

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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


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

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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


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

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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


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

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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