You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by to...@apache.org on 2014/04/15 11:14:00 UTC

svn commit: r1587480 - in /jackrabbit/oak/branches/1.0: ./ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/

Author: tommaso
Date: Tue Apr 15 09:14:00 2014
New Revision: 1587480

URL: http://svn.apache.org/r1587480
Log:
OAK-1730 - backported fix to possible NPE in OrderedContentMirrorStoreStrategy to branch 1.0

Added:
    jackrabbit/oak/branches/1.0/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OrderedIndexConcurrentClusterIT.java
      - copied unchanged from r1587472, jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OrderedIndexConcurrentClusterIT.java
Modified:
    jackrabbit/oak/branches/1.0/   (props changed)
    jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStoreStrategy.java

Propchange: jackrabbit/oak/branches/1.0/
------------------------------------------------------------------------------
  Merged /jackrabbit/oak/trunk:r1587472

Modified: jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStoreStrategy.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStoreStrategy.java?rev=1587480&r1=1587479&r2=1587480&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStoreStrategy.java (original)
+++ jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStoreStrategy.java Tue Apr 15 09:14:00 2014
@@ -158,15 +158,19 @@ public class OrderedContentMirrorStoreSt
                     // (1) find the previous element
                     ChildNodeEntry previous = findPrevious(
                             index.getNodeState(), node.getNodeState());
-                    LOG.debug("previous: {}", previous);
-                    // (2) find the next element
-                    String next = node.getString(NEXT); 
-                    if (next == null) {
-                        next = "";
+                    if (previous == null) {
+                        LOG.debug("previous not found. Already deleted in the meanwhile. Skipping re-link");
+                    } else {
+                        LOG.debug("previous: {}", previous);
+                        // (2) find the next element
+                        String next = node.getString(NEXT);
+                        if (next == null) {
+                            next = "";
+                        }
+                        // (3) re-link the previous to the next
+                        index.getChildNode(previous.getName()).setProperty(NEXT, next);
                     }
-                    // (3) re-link the previous to the next
-                    index.getChildNode(previous.getName()).setProperty(NEXT, next); 
-                } 
+                }
                 node.remove();
             }
         }