You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by rw...@apache.org on 2008/03/09 18:32:19 UTC

svn commit: r635306 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java

Author: rwinston
Date: Sun Mar  9 10:32:18 2008
New Revision: 635306

URL: http://svn.apache.org/viewvc?rev=635306&view=rev
Log:
NET-198

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=635306&r1=635305&r2=635306&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 Sun Mar  9 10:32:18 2008
@@ -74,7 +74,6 @@
 	 */
 	public Calendar parseTimestamp(String timestampStr) throws ParseException {
 		Calendar now = Calendar.getInstance();
-		now.setTimeZone(this.getServerTimeZone());
 		return parseTimestamp(timestampStr, now);
 	}
 	
@@ -93,7 +92,8 @@
 	 * @param now The current time 	 
 	 */
 	public Calendar parseTimestamp(String timestampStr, Calendar now) throws ParseException {
-		Calendar working = Calendar.getInstance();
+		now.setTimeZone(this.getServerTimeZone());
+		Calendar working = (Calendar) now.clone();;
 		working.setTimeZone(getServerTimeZone());
 		ParsePosition pp = new ParsePosition(0);
 
@@ -122,7 +122,7 @@
 			// This is pretty bad hack to work around the deficiencies of the JDK date/time classes.
 			if (recentDateFormat != null) {
 				pp = new ParsePosition(0);
-				int year = Calendar.getInstance().get(Calendar.YEAR);
+				int year = now.get(Calendar.YEAR);
 				String timeStampStrPlusYear = timestampStr + " " + year;
 				SimpleDateFormat hackFormatter = new SimpleDateFormat(recentDateFormat.toPattern() + " yyyy", 
 						recentDateFormat.getDateFormatSymbols());