On 2.12.13 9:19 , [email protected] wrote:
Author: jukka
Date: Mon Dec  2 20:19:58 2013
New Revision: 1547174

URL: http://svn.apache.org/r1547174
Log:
OAK-1252: Lazy privilege access in AccessControlValidator

Defer privilege access to when they're really needed

[...]

          for (String privilegeName : privilegeNames) {
-            if (privilegeName == null || 
!privileges.containsKey(privilegeName)) {
+            try {
+                Privilege privilege = 
privilegeManager.getPrivilege(privilegeName);
+                if (privilege.isAbstract()) {
+                    throw accessViolation(11, "Abstract privilege " + 
privilegeName);
+                }
+            } catch (AccessControlException e) {
                  throw accessViolation(10, "Invalid privilege " + 
privilegeName);
-            }
-
-            Privilege privilege = privileges.get(privilegeName);
-            if (privilege.isAbstract()) {
-                throw accessViolation(11, "Abstract privilege " + 
privilegeName);
+            } catch (RepositoryException e) {
+                throw new RuntimeException(e);
              }
          }
      }

Could we include some form of an explanation why a RuntimeException is thrown here. E.g. throw a tailored descendant of RuntimeException including some extra message?

Michael

Reply via email to