@Override
 public Privilege privilegeFromName(String privilegeName)
     throws AccessControlException, RepositoryException {
   try {
     return registry.getPrivilege(privilegeName, null);
   } catch (AccessControlException e) {
     if (e.getMessage() != null
         && e.getMessage().startsWith("Unknown privilege {http://www.jcp.org/jcr/1.0}")) {
       // fallback to default workspace for JCR permissions
       return registry.getPrivilege(privilegeName, Constants.EDIT_WORKSPACE);
     } else {
       throw e;
     }
   }
 }
Пример #2
0
 /**
  * This kludge is specific to get over AccessControlException thrown during Applet.stop() or
  * destroy() when static thread is suspended. Set a flag in AppletClassLoader to indicate that an
  * AccessControlException for RuntimePermission "modifyThread" or "modifyThreadGroup" had
  * occurred.
  */
 private void setExceptionStatus(AccessControlException e) {
   Permission p = e.getPermission();
   if (p instanceof RuntimePermission) {
     if (p.getName().startsWith("modifyThread")) {
       if (loader == null) loader = getClassLoader(getCodeBase(), getClassLoaderCacheKey());
       loader.setExceptionStatus();
     }
   }
 }