jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1346996 - in /jackrabbit/oak/trunk: oak-it/jcr/pom.xml oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Date Wed, 06 Jun 2012 17:31:31 GMT
Author: reschke
Date: Wed Jun  6 17:31:31 2012
New Revision: 1346996

URL: http://svn.apache.org/viewvc?rev=1346996&view=rev
Log:
NodeImpl: add checks for invalid workspace names; update test exclusions

Modified:
    jackrabbit/oak/trunk/oak-it/jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java

Modified: jackrabbit/oak/trunk/oak-it/jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/jcr/pom.xml?rev=1346996&r1=1346995&r2=1346996&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-it/jcr/pom.xml Wed Jun  6 17:31:31 2012
@@ -52,8 +52,6 @@ org.apache.jackrabbit.test.api.SessionTe
 org.apache.jackrabbit.test.api.SessionUUIDTest
 org.apache.jackrabbit.test.api.NodeTest#testSaveConstraintViolationException
 org.apache.jackrabbit.test.api.NodeTest#testSaveInvalidStateException<!--OAK-131-->
-org.apache.jackrabbit.test.api.NodeTest#testGetCorrespondingNodePathNoSuchWorkspaceException
-org.apache.jackrabbit.test.api.NodeTest#testUpdateNoSuchWorkspaceException
 org.apache.jackrabbit.test.api.NodeTest#testAddNodeConstraintViolationExceptionUndefinedNodeType
 org.apache.jackrabbit.test.api.NodeTest#testRemoveMandatoryNode
 org.apache.jackrabbit.test.api.NodeTest#testRemoveInvalidItemStateException<!--OAK-131-->

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1346996&r1=1346995&r2=1346996&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Wed Jun  6 17:31:31 2012
@@ -34,6 +34,7 @@ import javax.jcr.Item;
 import javax.jcr.ItemExistsException;
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.ItemVisitor;
+import javax.jcr.NoSuchWorkspaceException;
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
 import javax.jcr.PathNotFoundException;
@@ -891,6 +892,7 @@ public class NodeImpl extends ItemImpl i
     @Nonnull
     public String getCorrespondingNodePath(String workspaceName) throws RepositoryException
{
         checkStatus();
+        checkValidWorkspace(workspaceName);
         throw new UnsupportedRepositoryOperationException("TODO: Node.getCorrespondingNodePath");
     }
 
@@ -898,6 +900,7 @@ public class NodeImpl extends ItemImpl i
     @Override
     public void update(String srcWorkspace) throws RepositoryException {
         checkStatus();
+        checkValidWorkspace(srcWorkspace);
         ensureNoPendingSessionChanges();
 
         // TODO
@@ -1148,4 +1151,13 @@ public class NodeImpl extends ItemImpl i
         String oakName = sessionDelegate.getOakPathOrThrow(mixinName);
         return "mix:title".equals(oakName);
     }
+
+    private void checkValidWorkspace(String workspaceName) throws RepositoryException {
+        for (String wn : sessionDelegate.getWorkspace().getAccessibleWorkspaceNames()) {
+            if (wn.equals(workspaceName)) {
+                return;
+            }
+        }
+        throw new NoSuchWorkspaceException(workspaceName + " does not exist.");
+    }
 }



Mime
View raw message