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

[net] FTP timestamp: year recognition

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    • 35181

    Description

      org.apache.commons.net.ftp.parser.FTPTimestampParserImpl

      public Calendar parseTimestamp(String timestampStr)
      :
      if (working.after(now))

      { working.add(Calendar.YEAR, -1); }

      If system date of the remote machine is ahead of local machine, the code above
      does not work well. For example, when the system date of local machine is five
      minutes later than date of file at the remote machine, it is recognized as the
      file a year ago.

      LOCAL SYSDATE:Jun/02/2005 14:00
      File TimeStamp
      Jun/02 14:05 -recognized as-> Jun/02/2004 14:05

      The date format is switched after six months, so I think that the code above
      shuold be changed as following:

      // s m h d half-year
      // 1000*60*60*24*183=15811200000ms
      long wkt = working.getTimeInMillis();
      long nwt = now.getTimeInMillis();
      if (wkt > (nwt+15811200000L)) { working.add(Calendar.YEAR, -1); }

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ishigami@victokai.co.jp Satoshi Ishigami
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: