jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r188785 - in /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core: ItemImpl.java WorkspaceImpl.java state/LocalItemStateManager.java version/persistence/InternalVersionHistoryImpl.java version/persistence/NativePVM.java
Date Tue, 07 Jun 2005 14:36:02 GMT
Author: dpfister
Date: Tue Jun  7 07:36:02 2005
New Revision: 188785

URL: http://svn.apache.org/viewcvs?rev=188785&view=rev
Log:
- cancel() should be invoked only if edit() actually suceeded

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/InternalVersionHistoryImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/NativePVM.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java?rev=188785&r1=188784&r2=188785&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java Tue Jun 
7 07:36:02 2005
@@ -1266,10 +1266,19 @@
                 Collection dirtyRefs =
                         checkReferences(dirty.iterator(), removed.iterator());
 
-                boolean succeeded = false;
+
+                // start the update operation
                 try {
-                    // start the update operation
                     stateMgr.edit();
+                } catch (IllegalStateException e) {
+                    String msg = "Unable to start edit operation";
+                    log.debug(msg);
+                    throw new RepositoryException(msg, e);
+                }
+
+                boolean succeeded = false;
+
+                try {
 
                     // process transient items marked as 'removed'
                     removeTransientItems(removed.iterator());

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java?rev=188785&r1=188784&r2=188785&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java Tue
Jun  7 07:36:02 2005
@@ -250,13 +250,22 @@
             throw new RepositoryException(msg, mpe);
         }
 
-        boolean succeeded = false;
         BatchedItemOperations ops =
                 new BatchedItemOperations(stateMgr, rep.getNodeTypeRegistry(),
                         getLockManager(), session, hierMgr,
                         session.getNamespaceResolver());
+
         try {
             ops.edit();
+        } catch (IllegalStateException e) {
+            String msg = "unable to start edit operation";
+            log.debug(msg);
+            throw new RepositoryException(msg, e);
+        }
+
+        boolean succeeded = false;
+
+        try {
             ops.copy(srcPath, srcWsp.getItemStateManager(),
                     srcWsp.getHierarchyManager(),
                     ((SessionImpl) srcWsp.getSession()).getAccessManager(),
@@ -462,13 +471,22 @@
             throw new RepositoryException(msg, mpe);
         }
 
-        boolean succeeded = false;
         BatchedItemOperations ops =
                 new BatchedItemOperations(stateMgr, rep.getNodeTypeRegistry(),
                         getLockManager(), session, hierMgr,
                         session.getNamespaceResolver());
+
         try {
             ops.edit();
+        } catch (IllegalStateException e) {
+            String msg = "unable to start edit operation";
+            log.debug(msg);
+            throw new RepositoryException(msg, e);
+        }
+
+        boolean succeeded = false;
+
+        try {
             ops.move(srcPath, destPath);
             ops.update();
             succeeded = true;

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java?rev=188785&r1=188784&r2=188785&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
Tue Jun  7 07:36:02 2005
@@ -227,7 +227,7 @@
     /**
      * {@inheritDoc}
      */
-    public void edit() throws IllegalStateException {
+    public synchronized void edit() throws IllegalStateException {
         if (editMode) {
             throw new IllegalStateException("Already in edit mode");
         }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/InternalVersionHistoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/InternalVersionHistoryImpl.java?rev=188785&r1=188784&r2=188785&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/InternalVersionHistoryImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/InternalVersionHistoryImpl.java
Tue Jun  7 07:36:02 2005
@@ -253,10 +253,17 @@
         }
 
         try {
-            boolean succeeded = false;
             UpdatableItemStateManager stateMgr = getVersionManager().getItemStateMgr();
+
             try {
                 stateMgr.edit();
+            } catch (IllegalStateException e) {
+                throw new VersionException("Unable to start edit operation", e);
+            }
+
+            boolean succeeded = false;
+
+            try {
 
                 // remove from persistance state
                 node.removeNode(v.getNode().getName());
@@ -320,7 +327,11 @@
         UpdatableItemStateManager stateMgr = getVersionManager().getItemStateMgr();
         try {
             stateMgr.edit();
+        } catch (IllegalStateException e) {
+            throw new VersionException("Unable to start edit operation", e);
+        }
 
+        try {
             if (prev != null) {
                 labelNode.removeNode(label);
             }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/NativePVM.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/NativePVM.java?rev=188785&r1=188784&r2=188785&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/NativePVM.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/NativePVM.java
Tue Jun  7 07:36:02 2005
@@ -236,9 +236,15 @@
             return hist;
         }
 
-        boolean succeeded = false;
         try {
             stateMgr.edit();
+        } catch (IllegalStateException e) {
+            throw new RepositoryException("Unable to start edit operation", e);
+        }
+
+        boolean succeeded = false;
+
+        try {
 
             // create deep path
             String uuid = UUID.randomUUID().toString();
@@ -467,9 +473,15 @@
             } while (history.hasVersion(new QName("", versionName)));
         }
 
-        boolean succeeded = false;
         try {
             stateMgr.edit();
+        } catch (IllegalStateException e) {
+            throw new RepositoryException("Unable to start edit operation.");
+        }
+
+        boolean succeeded = false;
+
+        try {
             InternalVersionImpl v = history.checkin(new QName("", versionName), node);
             stateMgr.update();
             succeeded = true;



Mime
View raw message