Re: svn commit: r1412910 - /jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java

2012-11-27 Thread Michael Dürig



On 23.11.12 15:17, alexparvule...@apache.org wrote:

Author: alexparvulescu
Date: Fri Nov 23 15:17:00 2012
New Revision: 1412910

URL: http://svn.apache.org/viewvc?rev=1412910view=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=1412910r1=1412909r2=1412910view=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




Re: svn commit: r1412910 - /jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java

2012-11-27 Thread Jukka Zitting
Hi,

On Tue, Nov 27, 2012 at 12:46 PM, Michael Dürig mdue...@apache.org wrote:
 On 23.11.12 15:17, alexparvule...@apache.org wrote:
   - 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?

Since the index nodes are hidden the type validator should never be
looking at them in the first place, and thus I'd even like to avoid
having to use workarounds like the extra jcr:primaryType setting in
the index nodes.

BR,

Jukka Zitting


Re: svn commit: r1412910 - /jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java

2012-11-27 Thread Alex Parvulescu
ok, I've created OAK-478

if you find a fix, please also commit the path (which will remove the node
types :)

thanks,
alex


https://issues.apache.org/jira/browse/OAK-478


On Tue, Nov 27, 2012 at 11:50 AM, Jukka Zitting jukka.zitt...@gmail.comwrote:

 Hi,

 On Tue, Nov 27, 2012 at 12:46 PM, Michael Dürig mdue...@apache.org
 wrote:
  On 23.11.12 15:17, alexparvule...@apache.org wrote:
- 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?

 Since the index nodes are hidden the type validator should never be
 looking at them in the first place, and thus I'd even like to avoid
 having to use workarounds like the extra jcr:primaryType setting in
 the index nodes.

 BR,

 Jukka Zitting