You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2009/05/27 18:10:52 UTC

svn commit: r779225 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java

Author: angela
Date: Wed May 27 16:10:51 2009
New Revision: 779225

URL: http://svn.apache.org/viewvc?rev=779225&view=rev
Log:
JCR-1104: JSR 283 support

- Node.setPrimaryType should throws ConstraintViolation if nodetype is abstract. check was missing
- Node.setPrimaryType should throws ConstraintViolation instead of RepositoryException if the node type is mixin

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=779225&r1=779224&r2=779225&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java Wed May 27 16:10:51 2009
@@ -4684,8 +4684,11 @@
         }
 
         NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
-        if (ntMgr.getNodeType(ntName).isMixin()) {
-            throw new RepositoryException(nodeTypeName + ": not a primary node type");
+        NodeType nt = ntMgr.getNodeType(ntName);
+        if (nt.isMixin()) {
+            throw new ConstraintViolationException(nodeTypeName + ": not a primary node type.");
+        } else if (nt.isAbstract()) {
+            throw new ConstraintViolationException(nodeTypeName + ": is an abstract node type.");
         }
 
         // build effective node type of new primary type & existing mixin's