You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by md...@apache.org on 2013/06/12 09:58:13 UTC
svn commit: r1492102 -
/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java
Author: mduerig
Date: Wed Jun 12 07:58:13 2013
New Revision: 1492102
URL: http://svn.apache.org/r1492102
Log:
OAK-864: MicroKernelException when moving a node to its own descendant
fix for Session.move
Modified:
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java
Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java?rev=1492102&r1=1492101&r2=1492102&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java Wed Jun 12 07:58:13 2013
@@ -16,7 +16,10 @@
*/
package org.apache.jackrabbit.oak.jcr.delegate;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import java.io.IOException;
+
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.jcr.AccessDeniedException;
@@ -43,8 +46,6 @@ import org.apache.jackrabbit.oak.spi.sec
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static com.google.common.base.Preconditions.checkNotNull;
-
/**
* TODO document
*/
@@ -242,7 +243,9 @@ public class SessionDelegate {
try {
Root currentRoot = contentSession.getLatestRoot();
- currentRoot.copy(srcPath, destPath);
+ if (!currentRoot.copy(srcPath, destPath)) {
+ throw new RepositoryException("Cannot copy node at " + srcPath + " to " + destPath);
+ }
currentRoot.commit();
} catch (CommitFailedException e) {
throw newRepositoryException(e);
@@ -283,7 +286,9 @@ public class SessionDelegate {
accessManager.checkPermissions(destPath, Permissions.getString(Permissions.NODE_TYPE_MANAGEMENT));
try {
- moveRoot.move(srcPath, destPath);
+ if (!moveRoot.move(srcPath, destPath)) {
+ throw new RepositoryException("Cannot move node at " + srcPath + " to " + destPath);
+ }
if (!transientOp) {
moveRoot.commit();
}