harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r426023 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/lang/Character.java test/api/java/org/apache/harmony/luni/tests/java/lang/Character_SubsetTest.java
Date Thu, 27 Jul 2006 09:55:38 GMT
Author: smishura
Date: Thu Jul 27 02:55:37 2006
New Revision: 426023

URL: http://svn.apache.org/viewvc?rev=426023&view=rev
Log:
Fix for HARMONY-888 ([classlib][lang] no NPE for new java.lang.Character.Subset(null))

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/lang/Character_SubsetTest.java
  (with props)
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Character.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Character.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Character.java?rev=426023&r1=426022&r2=426023&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Character.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Character.java
Thu Jul 27 02:55:37 2006
@@ -514,6 +514,9 @@
 		String name;
 
 		protected Subset(String string) {
+			if (string == null) {
+				throw new NullPointerException();
+			}
 			name = string;
 		}
 

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/lang/Character_SubsetTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/lang/Character_SubsetTest.java?rev=426023&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/lang/Character_SubsetTest.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/lang/Character_SubsetTest.java
Thu Jul 27 02:55:37 2006
@@ -0,0 +1,51 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.luni.tests.java.lang;
+
+import junit.framework.TestCase;
+
+public class Character_SubsetTest extends TestCase {
+
+    /**
+     * @tests java.lang.Character.Subset#Character.Subset(java.lang.String)
+     */
+    public void test_Ctor() {
+
+        try {
+            // Regression for HARMONY-888
+            new Character.Subset(null) {
+            };
+            fail("No expected NullPointerException");
+        } catch (NullPointerException e) {
+        }
+    }
+
+    /**
+     * @tests java.lang.Character.Subset#toString()
+     */
+    public void test_toString() {
+
+        String name = "name";
+        Character.Subset subset = new Character.Subset(name) {
+        };
+        assertSame(name, subset.toString());
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(Character_SubsetTest.class);
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/lang/Character_SubsetTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message