commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwins...@apache.org
Subject svn commit: r632584 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java
Date Sat, 01 Mar 2008 12:41:20 GMT
Author: rwinston
Date: Sat Mar  1 04:41:17 2008
New Revision: 632584

URL: http://svn.apache.org/viewvc?rev=632584&view=rev
Log:
Add isLeapYear() check (NET-188)

Modified:
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java?rev=632584&r1=632583&r2=632584&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java
(original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java
Sat Mar  1 04:41:17 2008
@@ -23,6 +23,7 @@
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.GregorianCalendar;
 import java.util.TimeZone;
 
 import org.apache.commons.net.ftp.Configurable;
@@ -99,8 +100,9 @@
 			// to cope with short-date leap year strings.
 			// e.g. Java's DateFormatter will assume that "Feb 29 12:00" refers to 
 			// Feb 29 1970 (an invalid date) rather than a potentially valid leap year date.
-			// TODO This is a HORRENDOUS hack. Remove at first opportunity.
-			if (recentDateFormat != null) {
+			// This is pretty bad hack to work around the deficiencies of the JDK date/time classes.
+			if (recentDateFormat != null && 
+					new GregorianCalendar().isLeapYear(now.get(Calendar.YEAR))) {
 				pp = new ParsePosition(0);
 				int year = Calendar.getInstance().get(Calendar.YEAR);
 				String timeStampStrPlusYear = timestampStr + " " + year;



Mime
View raw message