You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Michael Dürig <md...@apache.org> on 2012/11/27 11:46:51 UTC

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


On 23.11.12 15:17, alexparvulescu@apache.org 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
>
>

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

Posted by Alex Parvulescu <al...@gmail.com>.
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 <ju...@gmail.com>wrote:

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

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

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