jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1177367 - /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java
Date Thu, 29 Sep 2011 17:09:51 GMT
Author: mduerig
Date: Thu Sep 29 17:09:50 2011
New Revision: 1177367

URL: http://svn.apache.org/viewvc?rev=1177367&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP)
improve error handling and logging

Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java?rev=1177367&r1=1177366&r2=1177367&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java
Thu Sep 29 17:09:50 2011
@@ -93,8 +93,7 @@ public class ChangeLog {
             operation.accept(operationVisitor);
         }
 
-        // process all remaining states that were not covered by the
-        // operation persistence.
+        // process all remaining states that were not covered by the operation persistence.
         for (ItemState<?> state : affectedStates) {
             HierarchyEntry<?> entry = state.getHierarchyEntry();
 
@@ -116,23 +115,11 @@ public class ChangeLog {
                 case EXISTING_REMOVED:
                     entry.remove();
                     break;
-                case NEW:
-                    // illegal. should not get here.
-                    log.error("ChangeLog still contains NEW state: " + state.getName());
-                    state.setStatus(Status.EXISTING);
-                    break;
-                case MODIFIED:
-                case _UNDEFINED_:
-                case STALE_DESTROYED:
-                case STALE_MODIFIED:
-                    // illegal.
-                    log.error("ChangeLog contains state (" + state.getName() + ") with illegal
status " + state.getStatus());
-                    break;
                 case EXISTING:
-                    if (state.isNode() && changedMixins.contains(state)) {
-                        // mixin changed for a node -> force reloading upon next
-                        // access in order to be aware of modified uniqueID.
-                        entry.invalidate(false);
+                    if (changedMixins.contains(state)) {
+                            // mixin changed for a node -> force reloading upon next
+                            // access in order to be aware of modified uniqueID.
+                            entry.invalidate(false);
                     }
                     // otherwise: ignore. operations already have been completed
                     break;
@@ -140,6 +127,15 @@ public class ChangeLog {
                 case REMOVED:
                     entry.invalidate(false);
                     break;
+                case NEW:
+                case MODIFIED:
+                case _UNDEFINED_:
+                case STALE_DESTROYED:
+                case STALE_MODIFIED:
+                    IllegalStateException e = new IllegalStateException("ChangeLog contains
state (" + state.getName() +
+                            ") with illegal status " + state.getStatus());
+                    log.error(e.getMessage(), e);
+                    throw e;
             }
         }
     }
@@ -153,8 +149,7 @@ public class ChangeLog {
             ops[i].undo();
         }
 
-        // process all remaining states that were not covered by the
-        // operation undo.
+        // process all remaining states that were not covered by the operation undo.
         for (ItemState<?> state : affectedStates) {
             switch (state.getStatus()) {
                 case EXISTING_MODIFIED:
@@ -164,15 +159,12 @@ public class ChangeLog {
                     state.getHierarchyEntry().revert();
                     break;
                 case NEW:
-                    // illegal. should not get here.
-                    log.error("ChangeLog still contains NEW state: " + state.getName());
-                    state.getHierarchyEntry().revert();
-                    break;
                 case MODIFIED:
                 case _UNDEFINED_:
-                    // illegal.
-                    log.error("ChangeLog contains state (" + state.getName() + ") with illegal
status " + state.getStatus());
-                    break;
+                    IllegalStateException e = new IllegalStateException("ChangeLog contains
state (" + state.getName() +
+                            ") with illegal status " + state.getStatus());
+                    log.error(e.getMessage(), e);
+                    throw e;
                 case EXISTING:
                 case REMOVED:
                 case INVALIDATED:



Mime
View raw message