Uploaded image for project: 'Commons Net'
  1. Commons Net
  2. NET-188

FTPClient#listFiles returns null element when file's timestamp is "02/29"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 1.5, 2.0
    • Component/s: None
    • Labels:
      None

      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:

      [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
      

      test 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();
      }
      

      results bellow.

      [0] -rw-r--r--    1 0        0               0 Dec 18  2006 aaa.txt
      [1] null
      

      Second element(bbb.txt) should not be null.

        Attachments

        1. commons-net-ftp-date-parser-feb29.patch
          1 kB
          Ingo Weinhold
        2. DstParseTest.java
          0.5 kB
          Brian Phillips
        3. FTPTimestampParserImpl.patch
          5 kB
          Andre Sudhoff
        4. FTPTimestampParserLeap.patch
          4 kB
          Sebb
        5. jan01.patch
          0.7 kB
          Martin Oberhuber

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                manhole HONMA Hirotaka
              • Votes:
                32 Vote for this issue
                Watchers:
                15 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: