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 an...@apache.org on 2013/02/07 14:54:06 UTC
svn commit: r1443477 -
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexDiff.java
Author: angela
Date: Thu Feb 7 13:54:06 2013
New Revision: 1443477
URL: http://svn.apache.org/viewvc?rev=1443477&view=rev
Log:
OAK-613 : NPE in Property2IndexDiff#getIndexes(String) when processing a removed node.
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexDiff.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexDiff.java?rev=1443477&r1=1443476&r2=1443477&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexDiff.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexDiff.java Thu Feb 7 13:54:06 2013
@@ -16,14 +16,6 @@
*/
package org.apache.jackrabbit.oak.plugins.index.p2;
-import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
-import static org.apache.jackrabbit.oak.commons.PathUtils.concat;
-import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NAME;
-import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NODE_TYPE;
-import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.TYPE_PROPERTY_NAME;
-import static org.apache.jackrabbit.oak.plugins.index.p2.Property2Index.TYPE;
-import static com.google.common.collect.Lists.newArrayList;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
@@ -31,7 +23,6 @@ import java.util.List;
import java.util.Map;
import com.google.common.collect.ImmutableList;
-
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Type;
@@ -43,16 +34,23 @@ import org.apache.jackrabbit.oak.spi.sta
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.apache.jackrabbit.oak.spi.state.NodeStateUtils;
+import static com.google.common.collect.Lists.newArrayList;
+import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
+import static org.apache.jackrabbit.oak.commons.PathUtils.concat;
+import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NAME;
+import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NODE_TYPE;
+import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.TYPE_PROPERTY_NAME;
+import static org.apache.jackrabbit.oak.plugins.index.p2.Property2Index.TYPE;
+
/**
* {@link IndexHook} implementation that is responsible for keeping the
* {@link Property2Index} up to date.
- * <p>
+ * <p/>
* There is a tree of PropertyIndexDiff objects, each object represents the
* changes at a given node.
- *
+ *
* @see Property2Index
* @see Property2IndexLookup
- *
*/
class Property2IndexDiff implements IndexHook {
@@ -60,7 +58,7 @@ class Property2IndexDiff implements Inde
protected static String declaringNodeTypes = "declaringNodeTypes";
-
+
private final IndexStoreStrategy store = new ContentMirrorStoreStrategy();
/**
@@ -139,7 +137,7 @@ class Property2IndexDiff implements Inde
/**
* Get all the indexes for the given property name.
- *
+ *
* @param name the property name
* @return the indexes
*/
@@ -150,7 +148,7 @@ class Property2IndexDiff implements Inde
}
List<Property2IndexUpdate> filtered = new ArrayList<Property2IndexUpdate>();
for (Property2IndexUpdate pi : indexes) {
- if (pi.getNodeTypeNames() == null
+ if (node == null || pi.getNodeTypeNames() == null
|| pi.getNodeTypeNames().isEmpty()) {
filtered.add(pi);
continue;
@@ -291,4 +289,4 @@ class Property2IndexDiff implements Inde
public void close() throws IOException {
updates.clear();
}
-}
\ No newline at end of file
+}