jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1346863 - 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 12:51:02 GMT
Author: reschke
Date: Wed Jun  6 12:51:02 2012
New Revision: 1346863

URL: http://svn.apache.org/viewvc?rev=1346863&view=rev
Log:
enhance exception handling for the case where it is tried to add a node to a property; update
test expectations

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=1346863&r1=1346862&r2=1346863&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-it/jcr/pom.xml Wed Jun  6 12:51:02 2012
@@ -44,7 +44,6 @@
             <property>
               <name>known.issues</name>
               <value>
-org.apache.jackrabbit.test.api.AddNodeTest#testConstraintViolation
 org.apache.jackrabbit.test.api.SessionTest#testMoveConstraintViolationExceptionSrc
 org.apache.jackrabbit.test.api.SessionTest#testMoveConstraintViolationExceptionDest
 org.apache.jackrabbit.test.api.SessionTest#testSaveConstraintViolationException

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=1346863&r1=1346862&r2=1346863&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 12:51:02 2012
@@ -181,6 +181,16 @@ public class NodeImpl extends ItemImpl i
 
         NodeDelegate parent = dlg.getChild(parentPath);
         if (parent == null) {
+            // is it a property?
+            String grandParentPath = PathUtils.getParentPath(parentPath);
+            NodeDelegate grandParent = dlg.getChild(grandParentPath);
+            if (grandParent != null) {
+                String propname = PathUtils.getName(parentPath);
+                if (grandParent.getProperty(propname) != null) {
+                    throw new ConstraintViolationException("Can't add new node to property.");
+                }
+            }
+
             throw new PathNotFoundException(relPath);
         }
 



Mime
View raw message