You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2007/02/16 15:55:41 UTC

svn commit: r508431 - /jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Restore.java

Author: angela
Date: Fri Feb 16 06:55:40 2007
New Revision: 508431

URL: http://svn.apache.org/viewvc?view=rev&rev=508431
Log:
#0000 - avoid NPE upon Restore.persisted in case of a 
        Workspace.restore.

Modified:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Restore.java

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Restore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Restore.java?view=diff&rev=508431&r1=508430&r2=508431
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Restore.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Restore.java Fri Feb 16 06:55:40 2007
@@ -68,16 +68,19 @@
      */
     public void persisted(CacheBehaviour cacheBehaviour) {
         if (cacheBehaviour == CacheBehaviour.INVALIDATE) {
+            NodeEntry entry;
             if (nodeState == null || removeExisting) {
                 // invalidate the complete tree
-                NodeEntry root = nodeState.getNodeEntry();
-                while (root.getParent() != null) {
-                    root = root.getParent();
+                // -> start searching root-entry from any version-entry or
+                //    from the given nodestate
+                entry = (nodeState == null) ? versionStates[0].getNodeEntry() : nodeState.getNodeEntry();
+                while (entry.getParent() != null) {
+                    entry = entry.getParent();
                 }
-                root.invalidate(true);
             } else {
-                nodeState.getHierarchyEntry().invalidate(true);
+                entry = nodeState.getNodeEntry();
             }
+            entry.invalidate(true);
         }
     }
     //----------------------------------------< Access Operation Parameters >---