jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r570149 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
Date Mon, 27 Aug 2007 14:59:33 GMT
Author: stefan
Date: Mon Aug 27 07:59:33 2007
New Revision: 570149

URL: http://svn.apache.org/viewvc?rev=570149&view=rev
Log:
more lenient behavior of Node#addMixin if mixin is already present 

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=570149&r1=570148&r2=570149&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
Mon Aug 27 07:59:33 2007
@@ -1039,9 +1039,11 @@
         if (!mixin.isMixin()) {
             throw new RepositoryException(mixinName + ": not a mixin node type");
         }
+
         NodeTypeImpl primaryType = ntMgr.getNodeType(primaryTypeName);
         if (primaryType.isDerivedFrom(mixinName)) {
-            throw new RepositoryException(mixinName + ": already contained in primary node
type");
+            // new mixin is already included in primary type
+            return;
         }
 
         // build effective node type of mixin's & primary type in order to detect conflicts
@@ -1055,8 +1057,10 @@
             // build effective node type representing primary type including existing mixin's
             entExisting = ntReg.getEffectiveNodeType((QName[]) set.toArray(new QName[set.size()]));
             if (entExisting.includesNodeType(mixinName)) {
-                throw new RepositoryException(mixinName + ": already contained in mixin types");
+                // new mixin is already included in existing mixin type(s)
+                return;
             }
+
             // add new mixin
             set.add(mixinName);
             // try to build new effective node type (will throw in case of conflicts)



Mime
View raw message