You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2008/04/07 11:52:46 UTC
svn commit: r645433 -
/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java
Author: sebb
Date: Mon Apr 7 02:52:44 2008
New Revision: 645433
URL: http://svn.apache.org/viewvc?rev=645433&view=rev
Log:
NET-211 - setLenient() does not work across a year boundary
Modified:
commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java
Modified: commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java?rev=645433&r1=645432&r2=645433&view=diff
==============================================================================
--- commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java (original)
+++ commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java Mon Apr 7 02:52:44 2008
@@ -100,6 +100,11 @@
Date parsed = null;
String timeStampStrPlusYear="";
if (recentDateFormat != null) {
+ if (lenientFutureDates) {
+ // add a day to "now" so that "slop" doesn't cause a date
+ // slightly in the future to roll back a full year. (Bug 35181)
+ now.add(Calendar.DATE, 1);
+ }
// Temporarily add the current year to the short date time
// to cope with short-date leap year strings.
// e.g. Java's DateFormatter will assume that "Feb 29 12:00" refers to
@@ -118,11 +123,6 @@
working.setTime(parsed);
working.set(Calendar.YEAR, now.get(Calendar.YEAR));
- if (lenientFutureDates) {
- // add a day to "now" so that "slop" doesn't cause a date
- // slightly in the future to roll back a full year. (Bug 35181)
- now.add(Calendar.DATE, 1);
- }
if (working.after(now)) {
working.add(Calendar.YEAR, -1);
}