You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Angela Schreiber <an...@day.com> on 2008/04/04 17:41:25 UTC

Re: svn commit: r644653 -> does not compile

commit to rev.644653 (JCR-1510) breaks the build.
it simply does not compile any more.

i'm reverting that change.

jukka, can you please take care of reopening the issue
and properly fixing it?

angela

jukka@apache.org wrote:
> Author: jukka
> Date: Fri Apr  4 02:37:32 2008
> New Revision: 644653
> 
> URL: http://svn.apache.org/viewvc?rev=644653&view=rev
> Log:
> JCR-1510: [PATCH] more verbose exception messages (BatchedItemOperations)
>     - Patch by Dave Brosius + some line wrapping
> 
> 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=644653&r1=644652&r2=644653&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 02:37:32 2008
> @@ -253,7 +253,9 @@
>          int ind = destName.getIndex();
>          if (ind > 0) {
>              // subscript in name element
> -            String msg = "invalid destination path (subscript in name element is not allowed)";
> +            String msg =
> +                "invalid destination path: " + safeGetJCRPath(destPath)
> +                + " (subscript in name element is not allowed)";
>              log.debug(msg);
>              throw new RepositoryException(msg);
>          }
> @@ -302,7 +304,9 @@
>  
>          // 3. verify that source has mixin mix:shareable
>          if (!isShareable(srcState)) {
> -            String msg = "Cloning inside a workspace is only allowed for shareable nodes.";
> +            String msg =
> +                "Cloning inside a workspace is only allowed for shareable nodes; "
> +                + safeGetJCRPath(srcPath) + " is not shareable.";
>              log.debug(msg);
>              throw new RepositoryException(msg);
>          }
> @@ -312,14 +316,18 @@
>          NodeId destParentId = destParentState.getNodeId();
>          if (destParentId.equals(srcId) ||
>                  hierMgr.isAncestor(srcId, destParentId)) {
> -            String msg = "This would create a share cycle.";
> +            String msg =
> +                "Cloning " + safeGetJCRPath(srcPath) + " to "
> +                + safeGetJCRPath(destPath) + " 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 twice to the same parent is not supported.";
> +            String msg =
> +                "Adding a shareable node (" + safeGetJCRPath(srcPath)
> +                + ") twice to the same parent is not supported.";
>              log.debug(msg);
>              throw new UnsupportedRepositoryOperationException(msg);
>          }
> @@ -413,7 +421,9 @@
>          int ind = destName.getIndex();
>          if (ind > 0) {
>              // subscript in name element
> -            String msg = "invalid destination path (subscript in name element is not allowed)";
> +            String msg =
> +                "invalid copy destination path: " + safeGetJCRPath(destPath)
> +                + " (subscript in name element is not allowed)";
>              log.debug(msg);
>              throw new RepositoryException(msg);
>          }
> @@ -514,20 +524,21 @@
>  
>          // check precondition
>          if (!stateMgr.inEditMode()) {
> -            throw new IllegalStateException("not in edit mode");
> +            throw new IllegalStateException("cannot move path " + safeGetJCRPath(srcPath) + " because manager is 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: " + safeGetJCRPath(destPath);
> +            String msg = "invalid path for move: " + safeGetJCRPath(destPath);
>              log.debug(msg);
>              throw new RepositoryException(msg, mpe);
>          }
> @@ -544,8 +555,9 @@
>          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);
>          }
> @@ -573,7 +585,7 @@
>          } else {
>              // check shareable case
>              if (target.isShareable()) {
> -                String msg = "Moving a shareable node is not supported.";
> +                String msg = "Moving a shareable node (" + safeGetJCRPath(srcPath) + " ) is not supported.";
>                  log.debug(msg);
>                  throw new UnsupportedRepositoryOperationException(msg);
>              }
> @@ -629,7 +641,9 @@
>  
>          // check precondition
>          if (!stateMgr.inEditMode()) {
> -            throw new IllegalStateException("not in edit mode");
> +            throw new IllegalStateException(
> +                    "cannot remove node (" + safeGetJCRPath(nodePath)
> +                    + ") because manager is not in edit mode");
>          }
>  
>          // 1. retrieve affected state
> @@ -708,7 +722,8 @@
>              }
>              // 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");
>              }
>          }
> @@ -719,7 +734,8 @@
>              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
> @@ -740,8 +756,9 @@
>                  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);
>                  }
> @@ -750,7 +767,8 @@
>                  // 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");
> @@ -861,12 +879,14 @@
>                  }
>                  // 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);
>              }
> @@ -877,16 +897,19 @@
>          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");
>              }
>          }
> @@ -901,12 +924,14 @@
>                      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);
>                      }
> @@ -1104,7 +1129,7 @@
>  
>          // check precondition
>          if (!stateMgr.inEditMode()) {
> -            throw new IllegalStateException("not in edit mode");
> +            throw new IllegalStateException("cannot create node state for " + nodeName + " because manager is not in edit mode");
>          }
>  
>          NodeDef def = findApplicableNodeDefinition(nodeName, nodeTypeName, parent);
> @@ -1153,8 +1178,9 @@
>              // 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);
>              }
> @@ -1226,7 +1252,9 @@
>  
>          // check precondition
>          if (!stateMgr.inEditMode()) {
> -            throw new IllegalStateException("not in edit mode");
> +            throw new IllegalStateException(
> +                    "cannot create property state for " + propName
> +                    + " because manager is not in edit mode");
>          }
>  
>          // find applicable definition
> @@ -1442,7 +1470,8 @@
>          }
>          boolean checkedOut = propState.getValues()[0].getBoolean();
>          if (!checkedOut) {
> -            throw new VersionException(safeGetJCRPath(nodePath) + " is checked-in");
> +            throw new VersionException(
> +                    safeGetJCRPath(nodePath) + " is checked-in");
>          }
>      }
>  
> @@ -1476,8 +1505,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");
>          }
>      }
>  
> @@ -1528,8 +1557,9 @@
>          } 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);
>          }
> @@ -1750,7 +1780,9 @@
>                          // or an ancestor thereof
>                          if (id.equals(destParentId)
>                                  || hierMgr.isAncestor(id, destParentId)) {
> -                            String msg = "cannot remove ancestor node";
> +                            String msg =
> +                                "cannot remove node " + safeGetJCRPath(srcPath)
> +                                + " because it is an ancestor of the destination";
>                              log.debug(msg);
>                              throw new RepositoryException(msg);
>                          }
> @@ -1768,7 +1800,8 @@
>                      }
>                      break;
>                  default:
> -                    throw new IllegalArgumentException("unknown flag");
> +                    throw new IllegalArgumentException(
> +                            "unknown flag for copying node state: " + flag);
>              }
>              newState = stateMgr.createNew(id, srcState.getNodeTypeName(), destParentId);
>              // copy node state
> @@ -1808,7 +1841,7 @@
>                          if (stateMgr.hasItemState(mappedId)) {
>                              NodeState destState = (NodeState) stateMgr.getItemState(mappedId);
>                              if (!destState.isShareable()) {
> -                                String msg = "Remapped child is not shareable.";
> +                                String msg = "Remapped child (" + safeGetJCRPath(srcPath) + ") is not shareable.";
>                                  throw new ItemStateException(msg);
>                              }
>                              if (!destState.addShare(id)) {
> @@ -1892,7 +1925,9 @@
>              }
>              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);
>          }
> @@ -1999,8 +2034,9 @@
>          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);
>          }
> 
> 
> 


Re: svn commit: r644653 -> does not compile

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Fri, Apr 4, 2008 at 6:41 PM, Angela Schreiber <an...@day.com> wrote:
> commit to rev.644653 (JCR-1510) breaks the build.
>  it simply does not compile any more.

Argh, I'm sorry for that. For some reason Eclipse didn't complain
about the changes and I didn't bother to run the Maven build for such
a "simple" change.

>  i'm reverting that change.

Thanks!

>  jukka, can you please take care of reopening the issue
>  and properly fixing it?

Will do.

BR,

Jukka Zitting