Refine search
@Override public void checkPropertiesAccess() { throw new AccessControlException("Not Allowed"); } @Override
@Override @Nullable protected String getSystemAttribute(String attributeName) { try { return System.getenv(attributeName); } catch (AccessControlException ex) { if (logger.isInfoEnabled()) { logger.info("Caught AccessControlException when accessing system environment variable '" + attributeName + "'; its value will be returned [null]. Reason: " + ex.getMessage()); } return null; } } };
protected void executeScript(Class scriptClass, Permission missingPermission) { try { Script script = InvokerHelper.createScript(scriptClass, new Binding()); script.run(); //InvokerHelper.runScript(scriptClass, null); } catch (AccessControlException ace) { if (missingPermission != null && missingPermission.implies(ace.getPermission())) { return; } else { fail(ace.toString()); } } if (missingPermission != null) { fail("Should catch an AccessControlException"); } }
private static AccessControlException accessControlException(Exception e) { AccessControlException ace = new AccessControlException(e.getMessage()); ace.initCause(e); return ace; }
@Override public final AccessControlException accessControlException(final Permission permission, final Permission permission_, final CodeSource codeSource, final ClassLoader classLoader) { final AccessControlException result = new AccessControlException(String.format(getLoggingLocale(), accessControlException$str(), permission_, codeSource, classLoader), permission); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String secMgrChange = "WFSM000002: Security manager may not be changed";
public static Node copy(Node srcNode, Node destNode) { try { Session sess = srcNode.getSession(); return copy(sess, srcNode.getPath(), destNode.getPath()); } catch (AccessDeniedException e) { log.debug("Access denied", e); throw new AccessControlException(e.getMessage()); } catch (RepositoryException e) { throw new MetadataRepositoryException("Failed to copy source node: " + srcNode + " to destination node: " + destNode, e); } }
public static String getString(Node node, String name) { try { Property prop = node.getProperty(name); return prop.getString(); } catch (PathNotFoundException e) { return null; } catch (AccessDeniedException e) { log.debug("Access denied", e); throw new AccessControlException(e.getMessage()); } catch (RepositoryException e) { throw new MetadataRepositoryException("Failed to access property: " + name, e); } }
public static Node getNode(Node parentNode, String name) { try { return parentNode.getNode(name); } catch (AccessDeniedException e) { log.debug("Access denied", e); throw new AccessControlException(e.getMessage()); } catch (RepositoryException e) { throw new MetadataRepositoryException("Failed to retrieve the Node named " + name, e); } }
/** * Assuming the specified property is a (WEAK)REFERENCE type, returns whether it is pointing at the specified node ID. */ public static boolean isReferencing(Node node, String refProp, String nodeId) { try { return node.getProperty(refProp).getNode().getIdentifier().equals(nodeId); } catch (AccessDeniedException e) { log.debug("Access denied", e); throw new AccessControlException(e.getMessage()); } catch (RepositoryException e) { throw new MetadataRepositoryException("Failed to check reference property against node ID: " + nodeId, e); } }
public static Node createNode(Node parentNode, String name, String nodeType) { try { return parentNode.addNode(name, nodeType); } catch (AccessDeniedException e) { log.debug("Access denied", e); throw new AccessControlException(e.getMessage()); } catch (RepositoryException e) { throw new MetadataRepositoryException("Failed to create the Node named " + name, e); } }
public static String getName(Node node) { try { return node.getName(); } catch (AccessDeniedException e) { log.debug("Access denied", e); throw new AccessControlException(e.getMessage()); } catch (RepositoryException e) { throw new MetadataRepositoryException("Unable to get name of Node " + node, e); } }
/** * Assuming the specified property is a (WEAK)REFERENCE type, returns whether it is pointing at the specified node. */ public static boolean isReferencing(Node node, String refProp, Node targetNode) { try { return node.getProperty(refProp).getNode().isSame(targetNode); } catch (AccessDeniedException e) { log.debug("Access denied", e); throw new AccessControlException(e.getMessage()); } catch (RepositoryException e) { throw new MetadataRepositoryException("Failed to check reference property against node: " + node, e); } }
throw new AccessControlException("No permission Project " + projectName + "."); page.add("errorMsg", e.getMessage());
public static String getPath(Node node) { try { return node.getPath(); } catch (AccessDeniedException e) { log.debug("Access denied", e); throw new AccessControlException(e.getMessage()); } catch (RepositoryException e) { throw new MetadataRepositoryException("Unable to get the Path", e); } }
public void checkPermission(String key) { try { // Checking a random permission to check if it is server. if(isEmbeddedServer() || habitat == null || isACC() || isNotServerORACC()){ return; } Permission perm = new RuntimePermission("SSLPassword"); AccessController.checkPermission(perm); } catch (AccessControlException e) { String message = e.getMessage(); Permission perm = new PropertyPermission(key, "read"); if (message != null) { message = message.replace(e.getPermission().toString(), perm.toString()); } throw new AccessControlException(message, perm); } }
public static boolean hasProperty(Node node, String propName) { try { return node.hasProperty(propName); } catch (AccessDeniedException e) { log.debug("Access denied", e); throw new AccessControlException(e.getMessage()); } catch (RepositoryException e) { throw new MetadataRepositoryException("Failed to test for property", e); } }
public static boolean hasNode(Node parentNode, String name) { try { return parentNode.hasNode(name); } catch (AccessDeniedException e) { log.debug("Access denied", e); throw new AccessControlException(e.getMessage()); } catch (RepositoryException e) { throw new MetadataRepositoryException("Failed to check for the existence of the node named " + name, e); } }
public static void removeNode(Node node) { try { node.remove(); } catch (AccessDeniedException e) { log.debug("Access denied", e); throw new AccessControlException(e.getMessage()); } catch (RepositoryException e) { throw new MetadataRepositoryException("Failed to remove the node " + node, e); } }
public static boolean isNodeType(Node node, String typeName) { try { return node.getPrimaryNodeType().isNodeType(typeName); } catch (AccessDeniedException e) { log.debug("Access denied", e); throw new AccessControlException(e.getMessage()); } catch (RepositoryException e) { throw new MetadataRepositoryException("Failed to retrieve the type of node: " + node, e); } }
public static Node getParent(Node node) { try { return node.getParent(); } catch (AccessDeniedException e) { log.debug("Access denied", e); throw new AccessControlException(e.getMessage()); } catch (RepositoryException e) { throw new MetadataRepositoryException("Failed to retrieve the parent of node: " + node, e); } }