On 23.11.12 15:17, [email protected] wrote:
Author: alexparvulescu
Date: Fri Nov 23 15:17:00 2012
New Revision: 1412910

URL: http://svn.apache.org/viewvc?rev=1412910&view=rev
Log:
OAK-154 Full text search index
  - added node types to the index nodes, to prevent a NPE in the node type 
validation code

Thanks for fixing this. However, I think we should also fix the NPE. A missing node type might be an error condition, but it shouldn't result in a NPE. Do you have a way to reproduce this? If you, could you log an issue?

Michael




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

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=1412910&r1=1412909&r2=1412910&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
 Fri Nov 23 15:17:00 2012
@@ -18,11 +18,14 @@ 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.
@@ -31,6 +34,7 @@ public class ReadWriteOakDirectory exten

      public ReadWriteOakDirectory(NodeBuilder directoryBuilder) {
          super(directoryBuilder);
+        this.directoryBuilder.setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, 
Type.NAME);
      }

      @Override
@@ -54,6 +58,8 @@ 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


Reply via email to