harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r487569 - in /harmony/enhanced/classlib/trunk/modules/text/src: main/java/java/text/NumberFormat.java test/java/org/apache/harmony/text/tests/java/text/NumberFormatTest.java
Date Fri, 15 Dec 2006 14:31:44 GMT
Author: ayza
Date: Fri Dec 15 06:31:43 2006
New Revision: 487569

URL: http://svn.apache.org/viewvc?view=rev&rev=487569
Log:
Applying patch for HARMONY-1685 ([classlib][text] no NPE for NumberFormat.parseObject("test",
null)))

Modified:
    harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/NumberFormat.java
    harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/NumberFormatTest.java

Modified: harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/NumberFormat.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/NumberFormat.java?view=diff&rev=487569&r1=487568&r2=487569
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/NumberFormat.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/NumberFormat.java
Fri Dec 15 06:31:43 2006
@@ -461,6 +461,10 @@
      */
     @Override
     public final Object parseObject(String string, ParsePosition position) {
+        if (position == null) {
+            throw new NullPointerException(Messages.getString("text.08"));
+        }
+
         try {
             return parse(string, position);
         } catch (Exception e) {

Modified: harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/NumberFormatTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/NumberFormatTest.java?view=diff&rev=487569&r1=487568&r2=487569
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/NumberFormatTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/NumberFormatTest.java
Fri Dec 15 06:31:43 2006
@@ -221,6 +221,14 @@
     public void test_parseObjectLjava_lang_StringLjava_text_ParsePosition() {
     	// regression test for HARMONY-1003
     	assertNull(NumberFormat.getInstance().parseObject("0", new ParsePosition(-1)));
+    
+         // Regression for HARMONY-1685
+         try {
+             NumberFormat.getInstance().parseObject("test", null);
+             fail("NullPointerException expected");
+         } catch (NullPointerException e) {
+            //expected
+	    }
     }
     
     protected void setUp() {



Mime
View raw message