You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by mr...@apache.org on 2008/01/08 12:34:47 UTC

svn commit: r609938 - /jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java

Author: mreutegg
Date: Tue Jan  8 03:34:38 2008
New Revision: 609938

URL: http://svn.apache.org/viewvc?rev=609938&view=rev
Log:
JCR-1296: Exception may get lost in WorkspaceManager.OperationVisitorImpl.execute()

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

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java?rev=609938&r1=609937&r2=609938&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java Tue Jan  8 03:34:38 2008
@@ -746,6 +746,7 @@
          * Executes the operations on the repository service.
          */
         private void execute(ChangeLog changeLog) throws RepositoryException, ConstraintViolationException, AccessDeniedException, ItemExistsException, NoSuchNodeTypeException, UnsupportedRepositoryOperationException, VersionException {
+            RepositoryException ex = null;
             try {
                 ItemState target = changeLog.getTarget();
                 batch = service.createBatch(sessionInfo, target.getId());
@@ -755,12 +756,28 @@
                     log.debug("executing " + op.getName());
                     op.accept(this);
                 }
+            } catch (RepositoryException e) {
+                ex = e;
             } finally {
                 if (batch != null) {
-                    service.submit(batch);
+                    try {
+                        // submit must be called even in case there is an
+                        // exception to give the service a chance to clean
+                        // up the batch
+                        service.submit(batch);
+                    } catch (RepositoryException e) {
+                        if (ex == null) {
+                            ex = e;
+                        } else {
+                            log.warn("Exception submitting batch", e);
+                        }
+                    }
                     // reset batch field
                     batch = null;
                 }
+            }
+            if (ex != null) {
+                throw ex;
             }
         }