[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: SimpleDataFormat fixes

Kaffe CVS cvs-commits at kaffe.org
Tue Jan 18 05:55:50 PST 2005


PatchSet 5866 
Date: 2005/01/18 13:50:35
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: SimpleDataFormat fixes

2005-01-18  Dalibor Topic  <robilad at kaffe.org>

Resynced with GNU Classpath.

2005-01-15  Andrew John Hughes  <gnu_andrew at member.fsf.org>

* java/text/SimpleDateFormat.java:
(getDateFormatSymbols()): return a copy
(setDateFormatSymbols(java.text.DateFormatSymbols)):
throw exception on null input
(clone()): implemented to clone internal fields

Members: 
	ChangeLog:1.3409->1.3410 
	libraries/javalib/java/text/SimpleDateFormat.java:1.37->1.38 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3409 kaffe/ChangeLog:1.3410
--- kaffe/ChangeLog:1.3409	Mon Jan 17 18:14:09 2005
+++ kaffe/ChangeLog	Tue Jan 18 13:50:35 2005
@@ -1,3 +1,15 @@
+2005-01-18  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+
+	2005-01-15  Andrew John Hughes  <gnu_andrew at member.fsf.org>
+
+	* java/text/SimpleDateFormat.java:
+	(getDateFormatSymbols()): return a copy
+	(setDateFormatSymbols(java.text.DateFormatSymbols)):
+	throw exception on null input
+	(clone()): implemented to clone internal fields
+	
 2005-01-17  Dalibor Topic  <topic at notebox>
 
 	* config/powerpc/threads.h (THREADSTACKSIZE): Double stack size
Index: kaffe/libraries/javalib/java/text/SimpleDateFormat.java
diff -u kaffe/libraries/javalib/java/text/SimpleDateFormat.java:1.37 kaffe/libraries/javalib/java/text/SimpleDateFormat.java:1.38
--- kaffe/libraries/javalib/java/text/SimpleDateFormat.java:1.37	Sat Jan 15 18:09:50 2005
+++ kaffe/libraries/javalib/java/text/SimpleDateFormat.java	Tue Jan 18 13:50:37 2005
@@ -341,14 +341,14 @@
   }
 
   /**
-   * This method returns the format symbol information used for parsing
-   * and formatting dates.
+   * This method returns a copy of the format symbol information used
+   * for parsing and formatting dates.
    *
-   * @return The date format symbols.
+   * @return a copy of the date format symbols.
    */
   public DateFormatSymbols getDateFormatSymbols()
   {
-    return formatData;
+    return (DateFormatSymbols) formatData.clone();
   }
 
   /**
@@ -356,9 +356,15 @@
    * and formatting dates.
    *
    * @param formatData The date format symbols.
+   * @throws NullPointerException if <code>formatData</code> is null.
    */
    public void setDateFormatSymbols(DateFormatSymbols formatData)
    {
+     if (formatData == null)
+       {
+	 throw new
+	   NullPointerException("The supplied format data was null.");
+       }
      this.formatData = formatData;
    }
 
@@ -866,4 +872,19 @@
     calendar.set(Calendar.YEAR, year - 80);
     set2DigitYearStart(calendar.getTime());
   }
+
+  /**
+   * Returns a copy of this instance of
+   * <code>SimpleDateFormat</code>.  The copy contains
+   * clones of the formatting symbols and the 2-digit
+   * year century start date.
+   */
+  public Object clone()
+  {
+    SimpleDateFormat clone = (SimpleDateFormat) super.clone();
+    clone.setDateFormatSymbols((DateFormatSymbols) formatData.clone());
+    clone.set2DigitYearStart((Date) defaultCenturyStart.clone());
+    return clone;
+  }
+
 }



More information about the kaffe mailing list