jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r632328 - /jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
Date Fri, 29 Feb 2008 14:27:47 GMT
Author: jukka
Date: Fri Feb 29 06:27:44 2008
New Revision: 632328

URL: http://svn.apache.org/viewvc?rev=632328&view=rev
Log:
1.3: Merged revision 605134 (JCR-1209)

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

Modified: jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=632328&r1=632327&r2=632328&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
Fri Feb 29 06:27:44 2008
@@ -3035,13 +3035,26 @@
         // check lock status
         checkLock();
 
-        Property prop = internalSetProperty(QName.JCR_ISCHECKEDOUT, InternalValue.create(true));
-        prop.save();
-        prop = internalSetProperty(QName.JCR_PREDECESSORS,
+        boolean hasPendingChanges = session.hasPendingChanges();
+
+        Property[] props = new Property[2];
+        props[0] = internalSetProperty(QName.JCR_ISCHECKEDOUT, InternalValue.create(true));
+        props[1] = internalSetProperty(QName.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