Return-Path: X-Original-To: apmail-jackrabbit-oak-commits-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-oak-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 17A2EC92E for ; Wed, 6 Jun 2012 17:31:56 +0000 (UTC) Received: (qmail 51542 invoked by uid 500); 6 Jun 2012 17:31:56 -0000 Delivered-To: apmail-jackrabbit-oak-commits-archive@jackrabbit.apache.org Received: (qmail 51522 invoked by uid 500); 6 Jun 2012 17:31:56 -0000 Mailing-List: contact oak-commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: oak-commits@jackrabbit.apache.org Delivered-To: mailing list oak-commits@jackrabbit.apache.org Received: (qmail 51514 invoked by uid 99); 6 Jun 2012 17:31:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jun 2012 17:31:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jun 2012 17:31:53 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 183E623888CD; Wed, 6 Jun 2012 17:31:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: oak-commits@jackrabbit.apache.org From: reschke@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120606173132.183E623888CD@eris.apache.org> 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 -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 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."); + } }