harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r407161 - in /incubator/harmony/enhanced/classlib/trunk/modules/text/src: main/java/java/text/ test/java/org/apache/harmony/text/tests/java/text/
Date Wed, 17 May 2006 05:19:38 GMT
Author: smishura
Date: Tue May 16 22:19:37 2006
New Revision: 407161

URL: http://svn.apache.org/viewcvs?rev=407161&view=rev
Log:
Apply updated patch for HARMONY-466 ([classlib][text] DateFormatSymbols, DecimalFormat, SimpleDateFormat
methods should throw NPE)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormatSymbols.java
    incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DecimalFormat.java
    incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java
    incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormatSymbols.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormatSymbols.java?rev=407161&r1=407160&r2=407161&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormatSymbols.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormatSymbols.java
Tue May 16 22:19:37 2006
@@ -282,8 +282,14 @@
 	 * 
 	 * @param data
 	 *            the String containing the pattern characters
+	 *
+	 * @exception NullPointerException
+	 *                when the data is null
 	 */
 	public void setLocalPatternChars(String data) {
+		if (data==null) {
+			throw new NullPointerException();
+		}
 		localPatternChars = data;
 	}
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DecimalFormat.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DecimalFormat.java?rev=407161&r1=407160&r2=407161&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DecimalFormat.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DecimalFormat.java
Tue May 16 22:19:37 2006
@@ -173,10 +173,15 @@
      * @return an AttributedCharacterIterator with the formatted number and
      *         attributes
      * 
+     * @exception NullPointerException
+     *                when the object is null
      * @exception IllegalArgumentException
      *                when the object cannot be formatted by this Format
      */
     public AttributedCharacterIterator formatToCharacterIterator(Object object) {
+        if (object == null) {
+            throw new NullPointerException();
+        }
         return dform.formatToCharacterIterator(object);
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java?rev=407161&r1=407160&r2=407161&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java
Tue May 16 22:19:37 2006
@@ -402,10 +402,15 @@
 	 * @return an AttributedCharacterIterator with the formatted date and
 	 *         attributes
 	 * 
+	 * @exception NullPointerException
+	 *                when the object is null
 	 * @exception IllegalArgumentException
 	 *                when the object cannot be formatted by this Format
 	 */
 	public AttributedCharacterIterator formatToCharacterIterator(Object object) {
+		if (object==null) {
+			throw new NullPointerException();
+		}
 		if (object instanceof Date)
 			return formatToCharacterIteratorImpl((Date) object);
 		if (object instanceof Number)

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java?rev=407161&r1=407160&r2=407161&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java
Tue May 16 22:19:37 2006
@@ -237,6 +237,14 @@
         String retVal = dfs.getLocalPatternChars();
         String val = "GyMZZkHmsSEHHFwWahKz";
         assertTrue("Returned incorrect pattern string", retVal.equals(val));
+        
+        try {
+            // Regression for HARMONY-466
+            new DateFormatSymbols().setLocalPatternChars(null);
+            fail("NullPointerException expected");
+        } catch (NullPointerException e) {
+            // expected
+        }
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java?rev=407161&r1=407160&r2=407161&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
Tue May 16 22:19:37 2006
@@ -1077,6 +1077,15 @@
      * @tests java.text.DecimalFormat#formatToCharacterIterator(java.lang.Object)
      */
     public void test_formatToCharacterIteratorLjava_lang_Object() {
+
+        try {
+            // Regression for HARMONY-466
+            new DecimalFormat().formatToCharacterIterator(null);
+            fail("NullPointerException expected");
+        } catch (NullPointerException e) {
+            // expected
+        }
+
         new Support_DecimalFormat(
                 "test_formatToCharacterIteratorLjava_lang_Object")
                 .t_formatToCharacterIterator();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java?rev=407161&r1=407160&r2=407161&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java
Tue May 16 22:19:37 2006
@@ -313,6 +313,15 @@
      * @tests java.text.SimpleDateFormat#formatToCharacterIterator(java.lang.Object)
      */
     public void test_formatToCharacterIteratorLjava_lang_Object() {
+
+        try {
+            // Regression for HARMONY-466
+            new SimpleDateFormat().formatToCharacterIterator(null);
+            fail("NullPointerException expected");
+        } catch (NullPointerException e) {
+            // expected
+        }
+        
         // Test for method formatToCharacterIterator(java.lang.Object)
         new Support_SimpleDateFormat(
                 "test_formatToCharacterIteratorLjava_lang_Object")



Mime
View raw message