private Node getDocumentNode(Session session, Document document) { if (document == null || document.getIdentity() == null) { log.error("Cannot retrieve workflow for null document"); return null; } try { return document.getNode(session); } catch (ItemNotFoundException e) { log.error("Document not found {}", e.getMessage()); } catch (RepositoryException e) { log.error("Unexpected error {}", e.getMessage(), e); } return null; }
@Override protected Node nodeWithId( String id, Session session ) throws RepositoryException { try { return session.getNodeByIdentifier(id); } catch (ItemNotFoundException infe) { throw new NotFoundException(infe.getMessage(), infe); } }
/** * Asserts that an item, identified by it's unique id, is found in the repository session. * * @param session * the session to be searched * @param itemId * the item expected to be found * @throws RepositoryException */ public static void assertNodeExistById(final Session session, final String itemId) throws RepositoryException { try { session.getNodeByIdentifier(itemId); } catch (final ItemNotFoundException e) { LOG.debug("Item with id {} does not exist", itemId, e); fail(e.getMessage()); } }
private List<Node> getReferencedNodes() { if (uuids != null) { Session session = getSession().getJcrSession(); List<Node> list = new ArrayList<Node>(uuids.size()); List<String> validUuids = new ArrayList<String>(uuids.size()); for (String id : uuids) { try { list.add(session.getNodeByIdentifier(id)); validUuids.add(id); } catch (ItemNotFoundException e) { log.info("Could not dereference uuid {} : {}", id, e.getMessage()); } catch (RepositoryException e) { log.warn("Could not dereference uuid {} : {}", id, e.getMessage()); } } uuids = validUuids; return list; } else { return Collections.emptyList(); } }
private String getMirrorPath() { Node node = MirrorTemplatePlugin.this.getModelObject(); try { if (node != null && node.hasProperty(HippoNodeType.HIPPO_DOCBASE)) { return getPath(node.getProperty(HippoNodeType.HIPPO_DOCBASE).getString()); } } catch (ValueFormatException e) { log.warn("Invalid value format for docbase " + e.getMessage()); log.debug("Invalid value format for docbase ", e); } catch (PathNotFoundException e) { log.warn("Docbase not found " + e.getMessage()); log.debug("Docbase not found ", e); } catch (ItemNotFoundException e) { log.info("Docbase " + e.getMessage() + " could not be dereferenced"); } catch (RepositoryException e) { log.error("Invalid docbase " + e.getMessage(), e); } return StringUtils.EMPTY; }
private String getMirrorPath() { Node node = GalleryPickerPlugin.this.getModelObject(); try { if (node != null && node.hasProperty(HippoNodeType.HIPPO_DOCBASE)) { return getPath(node.getProperty(HippoNodeType.HIPPO_DOCBASE).getString()); } } catch (ValueFormatException e) { log.warn("Invalid value format for docbase " + e.getMessage()); log.debug("Invalid value format for docbase ", e); } catch (PathNotFoundException e) { log.warn("Docbase not found " + e.getMessage()); log.debug("Docbase not found ", e); } catch (ItemNotFoundException e) { log.info("Docbase " + e.getMessage() + " could not be dereferenced"); } catch (RepositoryException e) { log.error("Invalid docbase " + e.getMessage(), e); } return StringUtils.EMPTY; }
log.warn("Docbase from '{}' does not contain a valid uuid. Content mirror is broken", contentNode.getPath()); } catch (ItemNotFoundException e) { log.warn("ItemNotFoundException: Content mirror is broken. ", e.getMessage()); } catch (RepositoryException e) { log.error("RepositoryException: Content mirror is broken. ", e);
@Override protected String load() { String docbaseUUID = valueModel.getObject(); if (docbaseUUID == null || docbaseUUID.equals("") || docbaseUUID.startsWith("cafebabe-")) { return EMPTY_LINK_TEXT; } try { return UserSession.get().getJcrSession().getNodeByUUID(docbaseUUID).getPath(); } catch (ValueFormatException e) { log.warn("Invalid value format for docbase " + e.getMessage()); log.debug("Invalid value format for docbase ", e); } catch (PathNotFoundException e) { log.warn("Docbase not found " + e.getMessage()); log.debug("Docbase not found ", e); } catch (ItemNotFoundException e) { log.info("Docbase not found " + e.getMessage()); log.debug("Docbase not found ", e); } catch (RepositoryException e) { log.error("Invalid docbase " + e.getMessage(), e); } return EMPTY_LINK_TEXT; } };
/** * Loads an asset by its UUID (generally the fastest way to load something). */ public AssetItem loadAssetByUUID(String uuid) { try { Node moduleNode = this.session.getNodeByIdentifier(uuid); return new AssetItem(this, moduleNode); } catch (ItemNotFoundException e) { log.warn(e.getMessage(), e); throw new RulesRepositoryException("That item does not exist."); } catch (RepositoryException e) { log.error("Unable to load an asset by UUID.", e); throw new RulesRepositoryException(e); } }
/** * Loads an asset by its UUID (generally the fastest way to load something). */ public AssetItem loadAssetByUUID(String uuid) { try { Node moduleNode = this.session.getNodeByIdentifier(uuid); return new AssetItem(this, moduleNode); } catch (ItemNotFoundException e) { log.warn(e.getMessage(), e); throw new RulesRepositoryException("That item does not exist."); } catch (RepositoryException e) { log.error("Unable to load an asset by UUID.", e); throw new RulesRepositoryException(e); } }
private void collectUniquePropertyNames(final Node node, final String repositoryName, final String subnodeName, final Collection<String> set, final boolean isDeep) throws RepositoryException { if (!MgnlContext.isSystemInstance()) { if (log.isDebugEnabled()) { log.debug("Collecting user properties in user context. List might not include all properties. Please check the calling code (see stacktrace)", new Exception()); } else { log.warn("Collecting user properties in user context. List might not include all properties. Please check the calling code (stacktrace will be printed for this call when debug logging is enabled)"); } } Session session = MgnlContext.getJCRSession(repositoryName); for (PropertyIterator iter = new FilteringPropertyIterator(node.getProperties(), new JCRMgnlPropertyHidingPredicate()); iter.hasNext();) { Property property = iter.nextProperty(); final String uuid = property.getString(); try { final Node targetNode = session.getNodeByIdentifier(uuid); set.add(targetNode.getName()); if (isDeep && targetNode.hasNode(subnodeName)) { collectUniquePropertyNames(targetNode.getNode(subnodeName), repositoryName, subnodeName, set, true); } } catch (ItemNotFoundException t) { final String path = property.getPath(); // TODO: why we are using UUIDs here? shouldn't be better to use group names, since uuids can change??? log.warn("Can't find {} node by UUID {} referred by node {}", repositoryName, t.getMessage(), path); log.debug("Failed while reading node by UUID", t); // we continue since it can happen that target node is removed // - UUID's are kept as simple strings thus have no referential integrity } } }
return events; } catch (ItemNotFoundException e) { log.info("Root node no longer exists: " + e.getMessage()); dispose(); return events;
private void removeHasVersionMixin(Node versionedNode) throws RepositoryException { Node node = versionedNode; while (node.getDepth() != 1) { node = node.getParent(); } String uuid = versionedNode.getIdentifier(); try { Node original = Components.getComponent(SystemContext.class).getJCRSession(sourceWorkspace).getNodeByIdentifier(uuid); if (NodeUtil.hasMixin(original, NodeTypes.HasVersion.NAME)) { original.removeMixin(NodeTypes.HasVersion.NAME); original.getSession().save(); } } catch (ItemNotFoundException e) { // in case original node does not exist, print warning log.warn("Original node for version {} not found.", e.getMessage()); } }
log.warn("LoginException '{}'. Return" , e.getMessage()); } catch (ItemNotFoundException e) { log.warn("ItemNotFoundException '{}' while trying to retrieve persisted formdata. Return" , e.getMessage()); } catch (RepositoryException e) { log.warn("RepositoryException '{}'. Return" , e.getMessage());
LOG.error(e.getMessage(),e); } catch (RepositoryException e) { LOG.error(e.getMessage(),e);
LOG.error(e.getMessage(),e); } catch (RepositoryException e) { LOG.error(e.getMessage(),e);
LOG.trace("An exception occurred: " + e.getMessage());
protected void setUp() throws Exception { super.setUp(); a = testRootNode.addNode("a", "nt:unstructured"); a.setProperty("p", 1); b = testRootNode.addNode("b", "nt:unstructured"); b.setProperty("p", 1); superuser.save(); principal = NodeImplTest.getReadOnlyPrincipal(getHelper()); NodeImplTest.changeReadPermission(principal, a, false); superuser.save(); readOnly = getHelper().getReadOnlySession(); // preliminary tests try { readOnly.getNodeByIdentifier(a.getIdentifier()); fail("Access to the node '" + a.getPath() + "' has to be denied."); } catch (ItemNotFoundException e) { // good acl } try { readOnly.getNodeByIdentifier(b.getIdentifier()); } catch (ItemNotFoundException e) { fail(e.getMessage()); } }
public void testReadVersionInfo3() throws RepositoryException, NotExecutableException { Node trn = getTestNode(); modifyPrivileges(trn.getPath(), PrivilegeRegistry.REP_WRITE, true); modifyPrivileges(trn.getPath(), Privilege.JCR_NODE_TYPE_MANAGEMENT, true); modifyPrivileges(trn.getPath(), Privilege.JCR_VERSION_MANAGEMENT, true); modifyPrivileges(VERSION_STORAGE_PATH, Privilege.JCR_READ, false); Node n = createVersionableNode(trn); assertTrue(n.isNodeType(mixVersionable)); assertFalse(n.isModified()); try { n.getVersionHistory(); n.getBaseVersion(); fail("No READ permission in the version storage"); } catch (AccessDeniedException e) { // success log.debug(e.getMessage()); } catch (ItemNotFoundException e) { // success log.debug(e.getMessage()); } } }
throw new PathNotFoundException(e.getMessage(), e.getCause()); } catch (RepositoryException e) { throw e;