harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r926569 - in /harmony/enhanced/classlib/trunk/modules/auth/src: main/java/common/javax/security/auth/SubjectDomainCombiner.java test/java/common/org/apache/harmony/auth/tests/javax/security/auth/SubjectDomainCombinerTest.java
Date Tue, 23 Mar 2010 13:36:43 GMT
Author: odeakin
Date: Tue Mar 23 13:36:43 2010
New Revision: 926569

URL: http://svn.apache.org/viewvc?rev=926569&view=rev
Log:
Apply patch and add regression test for HARMONY-1229 ([classlib][auth] compatibility: new
SubjectDomainCombiner().combine( {null}, ...) throws NPE on Harmony and works silently on
RI)

Modified:
    harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/SubjectDomainCombiner.java
    harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/SubjectDomainCombinerTest.java

Modified: harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/SubjectDomainCombiner.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/SubjectDomainCombiner.java?rev=926569&r1=926568&r2=926569&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/SubjectDomainCombiner.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/SubjectDomainCombiner.java
Tue Mar 23 13:36:43 2010
@@ -103,11 +103,13 @@ public class SubjectDomainCombiner imple
             Principal[] p = s.toArray(new Principal[s.size()]);
 
             for (cur = 0; cur < currentDomains.length; cur++) {
-                ProtectionDomain newPD;
-                newPD = new ProtectionDomain(currentDomains[cur].getCodeSource(),
-                        currentDomains[cur].getPermissions(), currentDomains[cur]
-                                .getClassLoader(), p);
-                pd[cur] = newPD;
+                if (currentDomains[cur] != null) {
+                    ProtectionDomain newPD;
+                    newPD = new ProtectionDomain(currentDomains[cur].getCodeSource(),
+                            currentDomains[cur].getPermissions(), currentDomains[cur]
+                                    .getClassLoader(), p);
+                    pd[cur] = newPD;
+                }
             }
         }
 

Modified: harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/SubjectDomainCombinerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/SubjectDomainCombinerTest.java?rev=926569&r1=926568&r2=926569&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/SubjectDomainCombinerTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/SubjectDomainCombinerTest.java
Tue Mar 23 13:36:43 2010
@@ -115,6 +115,9 @@ public class SubjectDomainCombinerTest e
         // test case: check inherited domains
         pd = combiner.combine(null, new ProtectionDomain[] { domain });
         assertSame("Inherited domain", domain, pd[0]);
+
+        //Regression for HARMONY-1129
+        assertNotNull(new SubjectDomainCombiner(new Subject()).combine(new ProtectionDomain[]
{null}, new ProtectionDomain[] {null}));
     }
 
     public final void testSecurityException() {



Mime
View raw message