harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r425059 - in /incubator/harmony/enhanced/classlib/trunk/modules/auth/src: main/java/common/javax/security/auth/kerberos/ServicePermission.java test/java/common/javax/security/auth/kerberos/ServicePermissionTest.java
Date Mon, 24 Jul 2006 14:20:04 GMT
Author: smishura
Date: Mon Jul 24 07:20:04 2006
New Revision: 425059

URL: http://svn.apache.org/viewvc?rev=425059&view=rev
Log:
Fix for HARMONY-769 ([classlib][auth] compatibility:exception order for javax.security.auth.kerberos.ServicePermission(null,
invalid_action))

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/kerberos/ServicePermission.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/ServicePermissionTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/kerberos/ServicePermission.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/kerberos/ServicePermission.java?rev=425059&r1=425058&r2=425059&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/kerberos/ServicePermission.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/kerberos/ServicePermission.java
Mon Jul 24 07:20:04 2006
@@ -140,14 +140,14 @@
     public ServicePermission(String name, String actions) {
         super(name);
 
+        initActions(actions);
+
         if (name == null) {
             throw new NullPointerException("service principal is null");
         }
         if (name.trim().length() == 0) {
             throw new IllegalArgumentException("service principal is empty");
         }
-
-        initActions(actions);
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/ServicePermissionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/ServicePermissionTest.java?rev=425059&r1=425058&r2=425059&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/ServicePermissionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/ServicePermissionTest.java
Mon Jul 24 07:20:04 2006
@@ -42,6 +42,10 @@
         junit.textui.TestRunner.run(ServicePermissionTest.class);
     }
     
+    /**
+     * @tests javax.security.auth.kerberos.ServicePermission#ServicePermission(
+     *        java.lang.String,java.lang.String)
+     */
     public void testCtor() {
         ServicePermission sp = new ServicePermission("krbtgt/AAA.COM@BBB.COM", "initiate");
         ServicePermission sp1 = new ServicePermission("host/AAA.COM@BBB.COM", "accept");
@@ -51,6 +55,14 @@
         assertEquals("accept",sp1.getActions());
         ServicePermission sp2 = new ServicePermission("host/AAA.COM@BBB.COM", "accept, initiate");
         assertEquals("initiate,accept", sp2.getActions());
+
+        try {
+            // Regression for HARMONY-769
+            // checks exception order: action parameter is verified first
+            new ServicePermission(null, "initiate accept");
+            fail("No expected IllegalArgumentException"); 
+        } catch(IllegalArgumentException e){
+        }
     }
     
     public void testFailedCtor() {



Mime
View raw message