jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r605134 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
Date Tue, 18 Dec 2007 08:35:40 GMT
Author: mreutegg
Date: Tue Dec 18 00:35:40 2007
New Revision: 605134

URL: http://svn.apache.org/viewvc?rev=605134&view=rev
Log:
JCR-1209: NodeImpl.checkout() calls save() two times

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=605134&r1=605133&r2=605134&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
Tue Dec 18 00:35:40 2007
@@ -3020,13 +3020,26 @@
         // check lock status
         checkLock();
 
-        Property prop = internalSetProperty(NameConstants.JCR_ISCHECKEDOUT, InternalValue.create(true));
-        prop.save();
-        prop = internalSetProperty(NameConstants.JCR_PREDECESSORS,
+        boolean hasPendingChanges = session.hasPendingChanges();
+
+        Property[] props = new Property[2];
+        props[0] = internalSetProperty(NameConstants.JCR_ISCHECKEDOUT, InternalValue.create(true));
+        props[1] = internalSetProperty(NameConstants.JCR_PREDECESSORS,
                 new InternalValue[]{
                     InternalValue.create(new UUID(getBaseVersion().getUUID()))
                 });
-        prop.save();
+        if (hasPendingChanges) {
+            for (int i = 0; i < props.length; i++) {
+                props[i].save();
+            }
+        } else {
+            try {
+                session.save();
+            } catch (RepositoryException e) {
+                session.refresh(false);
+                throw e;
+            }
+        }
     }
 
     /**



Mime
View raw message