You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2008/04/04 17:48:12 UTC
svn commit: r644738 -
/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
Author: angela
Date: Fri Apr 4 08:48:08 2008
New Revision: 644738
URL: http://svn.apache.org/viewvc?rev=644738&view=rev
Log:
reverting changes made with revision: 644653
Modified:
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java?rev=644738&r1=644737&r2=644738&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java Fri Apr 4 08:48:08 2008
@@ -253,9 +253,7 @@
int ind = destName.getIndex();
if (ind > 0) {
// subscript in name element
- String msg =
- "invalid destination path: " + safeGetJCRPath(destPath)
- + " (subscript in name element is not allowed)";
+ String msg = "invalid destination path (subscript in name element is not allowed)";
log.debug(msg);
throw new RepositoryException(msg);
}
@@ -304,9 +302,7 @@
// 3. verify that source has mixin mix:shareable
if (!isShareable(srcState)) {
- String msg =
- "Cloning inside a workspace is only allowed for shareable nodes; "
- + safeGetJCRPath(srcPath) + " is not shareable.";
+ String msg = "Cloning inside a workspace is only allowed for shareable nodes.";
log.debug(msg);
throw new RepositoryException(msg);
}
@@ -316,18 +312,14 @@
NodeId destParentId = destParentState.getNodeId();
if (destParentId.equals(srcId) ||
hierMgr.isAncestor(srcId, destParentId)) {
- String msg =
- "Cloning " + safeGetJCRPath(srcPath) + " to "
- + safeGetJCRPath(destPath) + " would create a share cycle.";
+ String msg = "This would create a share cycle.";
log.debug(msg);
throw new RepositoryException(msg);
}
// 5. do clone operation (modify and store affected states)
if (!srcState.addShare(destParentState.getNodeId())) {
- String msg =
- "Adding a shareable node (" + safeGetJCRPath(srcPath)
- + ") twice to the same parent is not supported.";
+ String msg = "Adding a shareable node twice to the same parent is not supported.";
log.debug(msg);
throw new UnsupportedRepositoryOperationException(msg);
}
@@ -421,9 +413,7 @@
int ind = destName.getIndex();
if (ind > 0) {
// subscript in name element
- String msg =
- "invalid copy destination path: " + safeGetJCRPath(destPath)
- + " (subscript in name element is not allowed)";
+ String msg = "invalid destination path (subscript in name element is not allowed)";
log.debug(msg);
throw new RepositoryException(msg);
}
@@ -524,21 +514,20 @@
// check precondition
if (!stateMgr.inEditMode()) {
- throw new IllegalStateException("cannot move path " + safeGetJCRPath(srcPath) + " because manager is not in edit mode");
+ throw new IllegalStateException("not in edit mode");
}
// 1. check paths & retrieve state
try {
if (srcPath.isAncestorOf(destPath)) {
- String msg =
- safeGetJCRPath(destPath) + ": invalid destination path"
- + " (cannot be descendant of source path)";
+ String msg = safeGetJCRPath(destPath)
+ + ": invalid destination path (cannot be descendant of source path)";
log.debug(msg);
throw new RepositoryException(msg);
}
} catch (MalformedPathException mpe) {
- String msg = "invalid path for move: " + safeGetJCRPath(destPath);
+ String msg = "invalid path: " + safeGetJCRPath(destPath);
log.debug(msg);
throw new RepositoryException(msg, mpe);
}
@@ -555,9 +544,8 @@
int ind = destName.getIndex();
if (ind > 0) {
// subscript in name element
- String msg =
- safeGetJCRPath(destPath) + ": invalid destination path"
- + " (subscript in name element is not allowed)";
+ String msg = safeGetJCRPath(destPath)
+ + ": invalid destination path (subscript in name element is not allowed)";
log.debug(msg);
throw new RepositoryException(msg);
}
@@ -585,7 +573,7 @@
} else {
// check shareable case
if (target.isShareable()) {
- String msg = "Moving a shareable node (" + safeGetJCRPath(srcPath) + " ) is not supported.";
+ String msg = "Moving a shareable node is not supported.";
log.debug(msg);
throw new UnsupportedRepositoryOperationException(msg);
}
@@ -641,9 +629,7 @@
// check precondition
if (!stateMgr.inEditMode()) {
- throw new IllegalStateException(
- "cannot remove node (" + safeGetJCRPath(nodePath)
- + ") because manager is not in edit mode");
+ throw new IllegalStateException("not in edit mode");
}
// 1. retrieve affected state
@@ -722,8 +708,7 @@
}
// make sure current session is granted write access on parent node
if (!accessMgr.isGranted(parentPath, nodeName, Permission.ADD_NODE)) {
- throw new AccessDeniedException(
- safeGetJCRPath(parentState.getNodeId())
+ throw new AccessDeniedException(safeGetJCRPath(parentState.getNodeId())
+ ": not allowed to add child node");
}
}
@@ -734,8 +719,7 @@
NodeDef parentDef = ntReg.getNodeDef(parentState.getDefinitionId());
// make sure parent node is not protected
if (parentDef.isProtected()) {
- throw new ConstraintViolationException(
- safeGetJCRPath(parentState.getNodeId())
+ throw new ConstraintViolationException(safeGetJCRPath(parentState.getNodeId())
+ ": cannot add child node to protected parent node");
}
// make sure there's an applicable definition for new child node
@@ -756,9 +740,8 @@
try {
conflictingState = (NodeState) stateMgr.getItemState(conflictingId);
} catch (ItemStateException ise) {
- String msg =
- "internal error: failed to retrieve state of "
- + safeGetJCRPath(conflictingId);
+ String msg = "internal error: failed to retrieve state of "
+ + safeGetJCRPath(conflictingId);
log.debug(msg);
throw new RepositoryException(msg, ise);
}
@@ -767,8 +750,7 @@
// check same-name sibling setting of both target and existing node
if (!conflictingTargetDef.allowsSameNameSiblings()
|| !newNodeDef.allowsSameNameSiblings()) {
- throw new ItemExistsException(
- "cannot add child node '"
+ throw new ItemExistsException("cannot add child node '"
+ nodeName.getLocalName() + "' to "
+ safeGetJCRPath(parentState.getNodeId())
+ ": colliding with same-named existing node");
@@ -879,14 +861,12 @@
}
// make sure current session is allowed to remove target node
if (!accessMgr.isGranted(targetPath, Permission.REMOVE_NODE)) {
- throw new AccessDeniedException(
- safeGetJCRPath(targetPath)
+ throw new AccessDeniedException(safeGetJCRPath(targetPath)
+ ": not allowed to remove node");
}
} catch (ItemNotFoundException infe) {
- String msg =
- "internal error: failed to check access rights for "
- + safeGetJCRPath(targetPath);
+ String msg = "internal error: failed to check access rights for "
+ + safeGetJCRPath(targetPath);
log.debug(msg);
throw new RepositoryException(msg, infe);
}
@@ -897,19 +877,16 @@
if ((options & CHECK_CONSTRAINTS) == CHECK_CONSTRAINTS) {
NodeDef parentDef = ntReg.getNodeDef(parentState.getDefinitionId());
if (parentDef.isProtected()) {
- throw new ConstraintViolationException(
- safeGetJCRPath(parentId)
+ throw new ConstraintViolationException(safeGetJCRPath(parentId)
+ ": cannot remove child node of protected parent node");
}
NodeDef targetDef = ntReg.getNodeDef(targetState.getDefinitionId());
if (targetDef.isMandatory()) {
- throw new ConstraintViolationException(
- safeGetJCRPath(targetPath)
+ throw new ConstraintViolationException(safeGetJCRPath(targetPath)
+ ": cannot remove mandatory node");
}
if (targetDef.isProtected()) {
- throw new ConstraintViolationException(
- safeGetJCRPath(targetPath)
+ throw new ConstraintViolationException(safeGetJCRPath(targetPath)
+ ": cannot remove protected node");
}
}
@@ -924,14 +901,12 @@
try {
NodeReferences refs = stateMgr.getNodeReferences(refsId);
if (refs.hasReferences()) {
- throw new ReferentialIntegrityException(
- safeGetJCRPath(targetPath)
+ throw new ReferentialIntegrityException(safeGetJCRPath(targetPath)
+ ": cannot remove node with references");
}
} catch (ItemStateException ise) {
- String msg =
- "internal error: failed to check references on "
- + safeGetJCRPath(targetPath);
+ String msg = "internal error: failed to check references on "
+ + safeGetJCRPath(targetPath);
log.error(msg, ise);
throw new RepositoryException(msg, ise);
}
@@ -1129,7 +1104,7 @@
// check precondition
if (!stateMgr.inEditMode()) {
- throw new IllegalStateException("cannot create node state for " + nodeName + " because manager is not in edit mode");
+ throw new IllegalStateException("not in edit mode");
}
NodeDef def = findApplicableNodeDefinition(nodeName, nodeTypeName, parent);
@@ -1178,9 +1153,8 @@
// try default primary type from definition
nodeTypeName = def.getDefaultPrimaryType();
if (nodeTypeName == null) {
- String msg =
- "an applicable node type could not be determined for "
- + nodeName;
+ String msg = "an applicable node type could not be determined for "
+ + nodeName;
log.debug(msg);
throw new ConstraintViolationException(msg);
}
@@ -1252,9 +1226,7 @@
// check precondition
if (!stateMgr.inEditMode()) {
- throw new IllegalStateException(
- "cannot create property state for " + propName
- + " because manager is not in edit mode");
+ throw new IllegalStateException("not in edit mode");
}
// find applicable definition
@@ -1470,8 +1442,7 @@
}
boolean checkedOut = propState.getValues()[0].getBoolean();
if (!checkedOut) {
- throw new VersionException(
- safeGetJCRPath(nodePath) + " is checked-in");
+ throw new VersionException(safeGetJCRPath(nodePath) + " is checked-in");
}
}
@@ -1505,8 +1476,8 @@
NodeState node = getNodeState(nodePath);
NodeDef parentDef = ntReg.getNodeDef(node.getDefinitionId());
if (parentDef.isProtected()) {
- throw new ConstraintViolationException(
- safeGetJCRPath(nodePath) + ": node is protected");
+ throw new ConstraintViolationException(safeGetJCRPath(nodePath)
+ + ": node is protected");
}
}
@@ -1557,9 +1528,8 @@
} catch (NoSuchItemStateException nsise) {
throw new ItemNotFoundException(safeGetJCRPath(id));
} catch (ItemStateException ise) {
- String msg =
- "internal error: failed to retrieve state of "
- + safeGetJCRPath(id);
+ String msg = "internal error: failed to retrieve state of "
+ + safeGetJCRPath(id);
log.debug(msg);
throw new RepositoryException(msg, ise);
}
@@ -1780,9 +1750,7 @@
// or an ancestor thereof
if (id.equals(destParentId)
|| hierMgr.isAncestor(id, destParentId)) {
- String msg =
- "cannot remove node " + safeGetJCRPath(srcPath)
- + " because it is an ancestor of the destination";
+ String msg = "cannot remove ancestor node";
log.debug(msg);
throw new RepositoryException(msg);
}
@@ -1800,8 +1768,7 @@
}
break;
default:
- throw new IllegalArgumentException(
- "unknown flag for copying node state: " + flag);
+ throw new IllegalArgumentException("unknown flag");
}
newState = stateMgr.createNew(id, srcState.getNodeTypeName(), destParentId);
// copy node state
@@ -1841,7 +1808,7 @@
if (stateMgr.hasItemState(mappedId)) {
NodeState destState = (NodeState) stateMgr.getItemState(mappedId);
if (!destState.isShareable()) {
- String msg = "Remapped child (" + safeGetJCRPath(srcPath) + ") is not shareable.";
+ String msg = "Remapped child is not shareable.";
throw new ItemStateException(msg);
}
if (!destState.addShare(id)) {
@@ -1925,9 +1892,7 @@
}
return newState;
} catch (ItemStateException ise) {
- String msg =
- "internal error: failed to copy state of "
- + srcState.getNodeId();
+ String msg = "internal error: failed to copy state of " + srcState.getNodeId();
log.debug(msg);
throw new RepositoryException(msg, ise);
}
@@ -2034,9 +1999,8 @@
try {
return ntReg.getEffectiveNodeType(types).includesNodeType(NameConstants.MIX_REFERENCEABLE);
} catch (NodeTypeConflictException ntce) {
- String msg =
- "internal error: failed to build effective node type for node "
- + state.getNodeId();
+ String msg = "internal error: failed to build effective node type for node "
+ + state.getNodeId();
log.debug(msg);
throw new RepositoryException(msg, ntce);
}