jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r705961 - /jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
Date Sun, 19 Oct 2008 05:42:29 GMT
Author: jukka
Date: Sat Oct 18 22:42:29 2008
New Revision: 705961

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

Made jcr2spi implementation of Node.addMixin() succeed if the mixin already exists.

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

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?rev=705961&r1=705960&r2=705961&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
Sat Oct 18 22:42:29 2008
@@ -623,16 +623,15 @@
         VersionException, ConstraintViolationException, LockException, RepositoryException
{
         checkIsWritable();
         Name mixinQName = getQName(mixinName);
-        if (!canAddMixin(mixinQName)) {
-            throw new ConstraintViolationException("Cannot add '" + mixinName + "' mixin
type.");
-        }
 
         // get mixin types present in the jcr:mixintypes property without
         // modifying the NodeState.
         List mixinValue = getMixinTypes();
-        if (mixinValue.contains(mixinQName)) {
-            log.warn("Mixin " + mixinName + " has already been transiently added -> Ignored.");
-        } else {
+        if (!mixinValue.contains(mixinQName)) {
+            if (!canAddMixin(mixinQName)) {
+                throw new ConstraintViolationException("Cannot add '" + mixinName + "' mixin
type.");
+            }
+
             mixinValue.add(mixinQName);
             // perform the operation
             Operation op = SetMixin.create(getNodeState(), (Name[]) mixinValue.toArray(new
Name[mixinValue.size()]));



Mime
View raw message