DO NOT REPLY [Bug 35181] New: - FTP timestamp: year recognition

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

DO NOT REPLY [Bug 35181] New: - FTP timestamp: year recognition

Bugzilla from bugzilla@apache.org
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG?
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35181>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND?
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35181

           Summary: FTP timestamp: year recognition
           Product: Commons
           Version: 1.4 Final
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Net
        AssignedTo: [hidden email]
        ReportedBy: [hidden email]


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

--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]