jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1414752 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatingHook.java oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
Date Wed, 28 Nov 2012 15:21:55 GMT
Author: alexparvulescu
Date: Wed Nov 28 15:21:54 2012
New Revision: 1414752

URL: http://svn.apache.org/viewvc?rev=1414752&view=rev
Log:
OAK-478 NPE in the TypeValidator when using the Lucene Index

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatingHook.java
    jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatingHook.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatingHook.java?rev=1414752&r1=1414751&r2=1414752&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatingHook.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatingHook.java
Wed Nov 28 15:21:54 2012
@@ -23,6 +23,7 @@ import org.apache.jackrabbit.oak.api.Com
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
+import org.apache.jackrabbit.oak.spi.state.NodeStateUtils;
 
 import static org.apache.jackrabbit.oak.plugins.memory.MemoryNodeState.EMPTY_NODE;
 
@@ -150,21 +151,15 @@ public class ValidatingHook implements C
 
         @Override
         public void childNodeAdded(String name, NodeState after) {
-            if (exception == null) {
-                try {
-                    Validator v = validator.childNodeAdded(name, after);
-                    if (v != null) {
-                        validate(v, EMPTY_NODE, after);
-                    }
-                } catch (CommitFailedException e) {
-                    exception = e;
-                }
-            }
+            childNodeChanged(name, EMPTY_NODE, after);
         }
 
         @Override
         public void childNodeChanged(
                 String name, NodeState before, NodeState after) {
+            if (NodeStateUtils.isHidden(name)) {
+                return;
+            }
             if (exception == null) {
                 try {
                     Validator v =
@@ -180,16 +175,7 @@ public class ValidatingHook implements C
 
         @Override
         public void childNodeDeleted(String name, NodeState before) {
-            if (exception == null) {
-                try {
-                    Validator v = validator.childNodeDeleted(name, before);
-                    if (v != null) {
-                        validate(v, before, EMPTY_NODE);
-                    }
-                } catch (CommitFailedException e) {
-                    exception = e;
-                }
-            }
+            childNodeChanged(name, before, EMPTY_NODE);
         }
 
     }

Modified: jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java?rev=1414752&r1=1414751&r2=1414752&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
(original)
+++ jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
Wed Nov 28 15:21:54 2012
@@ -18,14 +18,11 @@ package org.apache.jackrabbit.oak.plugin
 
 import java.io.IOException;
 
-import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IOContext;
 import org.apache.lucene.store.IndexOutput;
 
-import static org.apache.jackrabbit.JcrConstants.*;
-
 /**
  * A red-write implementation of the Lucene {@link Directory} (a flat list of
  * files) that allows to store Lucene index content in an Oak repository.
@@ -34,7 +31,6 @@ public class ReadWriteOakDirectory exten
 
     public ReadWriteOakDirectory(NodeBuilder directoryBuilder) {
         super(directoryBuilder);
-        this.directoryBuilder.setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, Type.NAME);
     }
 
     @Override
@@ -58,8 +54,6 @@ public class ReadWriteOakDirectory exten
             this.buffer = readFile(name);
             this.size = buffer.length;
             this.position = 0;
-            directoryBuilder.child(name).setProperty(JCR_PRIMARYTYPE,
-                    NT_UNSTRUCTURED, Type.NAME);
         }
 
         @Override



Mime
View raw message