Hussain created NET-504:
---------------------------
Summary: org.apache.commons.net.ftp.FTPFile.getTimestamp() showing
advance date
Key: NET-504
URL: https://issues.apache.org/jira/browse/NET-504
Project: Commons Net
Issue Type: Bug
Components: FTP
Affects Versions: 3.0.1
Environment: OS: GNU/Linux
Java: 1.6
Reporter: Hussain
Hi, my requirement is not to pick very recent file(copy in progress). to avoid
this i implemented some code, but when i call
org.apache.commons.net.ftp.FTPFile.getTimestamp() showing advance date, than
created date.
Code:
for (FTPFile file : fileArray) {
Calendar modificationCal =
file.getTimestamp();
Calendar presentCal =
Calendar.getInstance();
long diffMSecs =
presentCal.getTimeInMillis() - modificationCal.getTimeInMillis();
long noOfMin =
diffMSecs/(60*1000);
if(noOfMin <= 3){
System.out.println("Cureent Time is : "+presentCal.getTime().toString());
System.out.println("File Time is : "+modificationCal.getTime().toString());
System.out.println("in
if continue, file: "+file.getName()+" no of Min :"+noOfMin);
continue;
}
Output:
2013-03-05 03:41:00,056 INFO [stdout] (MyScheduler_Worker-1) Cureent Time is :
Tue Mar 05 03:41:00 EST 2013
2013-03-05 03:41:00,056 INFO [stdout] (MyScheduler_Worker-1) File Time is :
Tue Mar 05 08:31:00 EST 2013
2013-03-05 03:41:00,056 INFO [stdout] (MyScheduler_Worker-1) in if continue,
file: sample_file.txt no of Min :-289
any guess , why its not working ?
Thanks, Hussain Peera.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira