Commons Net
  1. Commons Net
  2. NET-445

The method listFiles in FTPClient can not list these files which upload to FTP Server in Feb, 29 2012

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.1
    • Fix Version/s: 3.1
    • Component/s: FTP
    • Labels:
      None

      Description

      Before Feb, 29 2012, the method listFiles() in FTPClient.class can list all files in FTP Server. But today, for any file which be uploaded to FTP Server in Feb, 29 2012, this API can not list these files. When I change the date of FTP Server(it is not Feb, 29 2012), this API can list all files in FTP Server also.

        Activity

        Sebb made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Sebb made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 3.1 [ 12317744 ]
        Resolution Fixed [ 1 ]
        Hide
        keming.hu added a comment -

        In my project, I make sure to use commons-net-3.0.1.jar. For these files which were uploaded to FTP server in Feb,29 2012,the method of listFiles can obtain these files in the jar package

        Show
        keming.hu added a comment - In my project, I make sure to use commons-net-3.0.1.jar. For these files which were uploaded to FTP server in Feb,29 2012,the method of listFiles can obtain these files in the jar package
        Hide
        Sebb added a comment -

        Have you tried 3.1?

        I think the problem mentioned in my earlier comment only applies when the server date is not a leap year.
        This is confirmed by the comment from Danilo.

        Show
        Sebb added a comment - Have you tried 3.1? I think the problem mentioned in my earlier comment only applies when the server date is not a leap year. This is confirmed by the comment from Danilo.
        Hide
        George Sanchez added a comment -

        Just encountered this in production using version commons-net.1.4.1.jar Is this being addressed on the latest release ?
        Thanks!

        Show
        George Sanchez added a comment - Just encountered this in production using version commons-net.1.4.1.jar Is this being addressed on the latest release ? Thanks!
        Hide
        Sebb added a comment -

        Note: the example ftp class can be used to test as follows:

        set CLASSPATH=commons-net-examples-3.1.jar;commons-net-3.1.jar
        java examples/ftp/FTPClientExample -l host[:port] username password [directory]
        
        Show
        Sebb added a comment - Note: the example ftp class can be used to test as follows: set CLASSPATH=commons-net-examples-3.1.jar;commons-net-3.1.jar java examples/ftp/FTPClientExample -l host[:port] username password [directory]
        Sebb made changes -
        Field Original Value New Value
        Fix Version/s 3.0.1 [ 12316459 ]
        Fix Version/s 3.1 [ 12317744 ]
        Hide
        Danilo Seki added a comment -

        We had this problem today. I used the code from NET-188 and found out that the problem exists on versions 1.4.0 and 1.4.1. Checked versions 1.3.0, 2.0, 3.0 and 3.0.1 and the problem did not happen.

        Initially we suspected the version packaged in the application (1.3.0) but latter we found out the application server used version 1.4.1 and that it was being used before in the classpath. Make sure you are using the version you packaged.

        Btw, I tested different JVM's: Sun 1.5, Sun 1.6 and BEA 1.5.

        Show
        Danilo Seki added a comment - We had this problem today. I used the code from NET-188 and found out that the problem exists on versions 1.4.0 and 1.4.1. Checked versions 1.3.0, 2.0, 3.0 and 3.0.1 and the problem did not happen. Initially we suspected the version packaged in the application (1.3.0) but latter we found out the application server used version 1.4.1 and that it was being used before in the classpath. Make sure you are using the version you packaged. Btw, I tested different JVM's: Sun 1.5, Sun 1.6 and BEA 1.5.
        Hide
        Sebb added a comment -

        Snapshots are regularly published - no guarantees!

        https://repository.apache.org/content/groups/snapshots/commons-net/commons-net/3.2-SNAPSHOT/

        It might be worth trying the latest one - commons-net-3.2-20120229.013133-18 - as some fixes were made recently that relate to leap year issues.

        Show
        Sebb added a comment - Snapshots are regularly published - no guarantees! https://repository.apache.org/content/groups/snapshots/commons-net/commons-net/3.2-SNAPSHOT/ It might be worth trying the latest one - commons-net-3.2-20120229.013133-18 - as some fixes were made recently that relate to leap year issues.
        Hide
        Sebb added a comment - - edited

        NET uses SimpleDateFormat to parse short dates; however this does not work properly for Feb 29.
        The current work-round fails for leap-years.

        [Later] the problem with SimpleDateFormat is that it assumes the year is 1970 - which was not a leap year.
        The workround is to append the current year to the short date before parsing.
        This works fine if the current year is a leap year, as is true of 2012.
        However, if the ftp server continues to display short dates after the end of 2012, the work-round will fail at the start of 2013.
        Many ftp servers only display short dates for +/- 6 months; such servers will switch to long format dates for Feb 29 before the end of 2012, so won't be affected.

        Show
        Sebb added a comment - - edited NET uses SimpleDateFormat to parse short dates; however this does not work properly for Feb 29. The current work-round fails for leap-years. [Later] the problem with SimpleDateFormat is that it assumes the year is 1970 - which was not a leap year. The workround is to append the current year to the short date before parsing. This works fine if the current year is a leap year, as is true of 2012. However, if the ftp server continues to display short dates after the end of 2012, the work-round will fail at the start of 2013. Many ftp servers only display short dates for +/- 6 months; such servers will switch to long format dates for Feb 29 before the end of 2012, so won't be affected.
        keming.hu created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            keming.hu
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development