jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1528768 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeManagerImpl.java oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeManagerTest.java
Date Thu, 03 Oct 2013 09:38:59 GMT
Author: angela
Date: Thu Oct  3 09:38:58 2013
New Revision: 1528768

URL: http://svn.apache.org/r1528768
Log:
OAK-1073 : PrivilegeManager#getPrivilege throws RepositoryException rather than AccessControlException

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeManagerImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeManagerTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeManagerImpl.java?rev=1528768&r1=1528767&r2=1528768&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeManagerImpl.java
Thu Oct  3 09:38:58 2013
@@ -116,7 +116,11 @@ class PrivilegeManagerImpl implements Pr
         if (jcrName == null) {
             throw new AccessControlException("Invalid privilege name 'null'");
         }
-        return namePathMapper.getOakName(jcrName);
+        String oakName = namePathMapper.getOakNameOrNull(jcrName);
+        if (oakName == null) {
+        	throw new AccessControlException("Cannot resolve privilege name " + jcrName);
+        }
+        return oakName;
     }
 
     @Nonnull

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeManagerTest.java?rev=1528768&r1=1528767&r2=1528768&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeManagerTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeManagerTest.java
Thu Oct  3 09:38:58 2013
@@ -64,7 +64,7 @@ public class PrivilegeManagerTest extend
         }
         assertTrue(set.isEmpty());
     }
-
+    
     @Test
     public void testGetPrivilege() throws RepositoryException {
         Set<String> aggregatedPrivilegeNames = ImmutableSet.of("jcr:read",
@@ -147,6 +147,16 @@ public class PrivilegeManagerTest extend
     }
 
     @Test
+    public void testGetPrivilegesFromInvalidName2() throws RepositoryException {
+    	String nonExistingPrivilegeName = "{http://www.nonexisting.com/1.0}nonexisting";
+    	try{
+    		privilegeManager.getPrivilege(nonExistingPrivilegeName);
+    	} catch(AccessControlException e){
+    		//expected
+    	}
+    }
+
+    @Test
     public void testGetPrivilegesFromEmptyNames() {
         try {
             privilegeManager.getPrivilege("");
@@ -167,4 +177,4 @@ public class PrivilegeManagerTest extend
             // OK
         }
     }
-}
\ No newline at end of file
+}



Mime
View raw message