jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1394142 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: plugins/index/lucene/ReadOnlyOakDirectory.java query/ast/LengthImpl.java
Date Thu, 04 Oct 2012 16:27:56 GMT
Author: mduerig
Date: Thu Oct  4 16:27:56 2012
New Revision: 1394142

URL: http://svn.apache.org/viewvc?rev=1394142&view=rev
Log:
OAK-350: Unify PropertyState and CoreValue
- User PropertyState.size() instead of CoreValue.length()

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadOnlyOakDirectory.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LengthImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadOnlyOakDirectory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadOnlyOakDirectory.java?rev=1394142&r1=1394141&r2=1394142&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadOnlyOakDirectory.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadOnlyOakDirectory.java
Thu Oct  4 16:27:56 2012
@@ -22,7 +22,7 @@ import java.util.Collection;
 
 import javax.jcr.UnsupportedRepositoryOperationException;
 
-import org.apache.jackrabbit.oak.api.CoreValue;
+import com.google.common.collect.Iterables;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.lucene.store.Directory;
@@ -31,7 +31,7 @@ import org.apache.lucene.store.IndexInpu
 import org.apache.lucene.store.IndexOutput;
 import org.apache.lucene.store.NoLockFactory;
 
-import com.google.common.collect.Iterables;
+import static org.apache.jackrabbit.oak.api.Type.BINARY;
 
 /**
  * A read-only implementation of the Lucene {@link Directory} (a flat list of
@@ -75,7 +75,7 @@ class ReadOnlyOakDirectory extends Direc
             return 0;
         }
 
-        return property.getValue().length();
+        return property.size();
     }
 
     @Override
@@ -111,10 +111,9 @@ class ReadOnlyOakDirectory extends Direc
             return new byte[0];
         }
 
-        CoreValue value = property.getValue();
-        InputStream stream = value.getNewStream();
+        InputStream stream = property.getValue(BINARY).getNewStream();
         try {
-            byte[] buffer = new byte[(int) value.length()];
+            byte[] buffer = new byte[(int) property.size()];
 
             int size = 0;
             do {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LengthImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LengthImpl.java?rev=1394142&r1=1394141&r2=1394142&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LengthImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LengthImpl.java
Thu Oct  4 16:27:56 2012
@@ -56,7 +56,7 @@ public class LengthImpl extends DynamicO
             return null;
         }
         if (!p.isArray()) {
-            long length = p.getValue().length();
+            long length = p.size();
             CoreValue v = query.getValueFactory().createValue(length);
             return new SinglePropertyState("LENGTH", v);
         }



Mime
View raw message