harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r431555 - in /incubator/harmony/enhanced/classlib/trunk/modules/security/src: main/java/common/org/apache/harmony/security/SystemScope.java test/api/java/org/apache/harmony/security/tests/java/security/IdentityScope2Test.java
Date Tue, 15 Aug 2006 08:30:19 GMT
Author: mloenko
Date: Tue Aug 15 01:30:18 2006
New Revision: 431555

URL: http://svn.apache.org/viewvc?rev=431555&view=rev
Log:
applied patch for HARMONY-1173
[classlib][security] compatibility: IdentityScope.getIdentity((String) null) throws NPE on
RI and returns 'null' on Harmony
added regression test

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/SystemScope.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/IdentityScope2Test.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/SystemScope.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/SystemScope.java?rev=431555&r1=431554&r2=431555&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/SystemScope.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/SystemScope.java
Tue Aug 15 01:30:18 2006
@@ -79,7 +79,7 @@
      */
     public synchronized Identity getIdentity(String name) {
         if (name == null) {
-            return null;
+            throw new NullPointerException();
         }
         return (Identity) names.get(name);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/IdentityScope2Test.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/IdentityScope2Test.java?rev=431555&r1=431554&r2=431555&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/IdentityScope2Test.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/IdentityScope2Test.java
Tue Aug 15 01:30:18 2006
@@ -238,16 +238,25 @@
        		assertEquals("Wrong size", 1, sub.size());
 	}
 
-	/**
-	 * @tests java.security.IdentityScope#toString()
-	 */
-	public void test_toString() throws Exception {
-       		IdentityScopeSubclass sub = new IdentityScopeSubclass("test",
-       				new IdentityScopeSubclass());
-       		Identity id = new IdentitySubclass();
-       		id.setPublicKey(pubKey);
-       		sub.addIdentity(id);
-       		assertNotNull("toString returned a null", sub.toString());
-       		assertTrue("Not a valid String ", sub.toString().length() > 0);
-	}
-}
\ No newline at end of file
+    /**
+     * @tests java.security.IdentityScope#toString()
+     */
+    public void test_toString() throws Exception {
+            IdentityScopeSubclass sub = new IdentityScopeSubclass("test",
+                    new IdentityScopeSubclass());
+            Identity id = new IdentitySubclass();
+            id.setPublicKey(pubKey);
+            sub.addIdentity(id);
+            assertNotNull("toString returned a null", sub.toString());
+            assertTrue("Not a valid String ", sub.toString().length() > 0);
+    }
+
+    public void test_getIdentity() throws Exception {
+        //Regression for HARMONY-1173
+        IdentityScope scope = IdentityScope.getSystemScope(); 
+        try {
+            scope.getIdentity((String) null);
+            fail("NPE expected");
+        } catch (NullPointerException npe) {}
+    }
+}



Mime
View raw message