jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1452400 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentPropertyState.java
Date Mon, 04 Mar 2013 17:10:50 GMT
Author: jukka
Date: Mon Mar  4 17:10:50 2013
New Revision: 1452400

URL: http://svn.apache.org/r1452400
Log:
OAK-593: Segment-based MK

Minor SegmentPropertyState improvements

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentPropertyState.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentPropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentPropertyState.java?rev=1452400&r1=1452399&r2=1452400&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentPropertyState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentPropertyState.java
Mon Mar  4 17:10:50 2013
@@ -73,6 +73,7 @@ class SegmentPropertyState extends Abstr
     @Override @Nonnull @SuppressWarnings("unchecked")
     public <T> T getValue(Type<T> type) {
         if (type.isArray()) {
+            final int count = count();
             final Type<?> base = type.getBaseType();
             return (T) new Iterable<Object>() {
                 @Override
@@ -81,7 +82,7 @@ class SegmentPropertyState extends Abstr
                         private int index = 0;
                         @Override
                         public boolean hasNext() {
-                            return index < count();
+                            return index < count;
                         }
                         @Override
                         public Object next() {
@@ -115,15 +116,14 @@ class SegmentPropertyState extends Abstr
 
         Segment segment = reader.getStore().readSegment(recordId.getSegmentId());
 
-        Type<?> base;
+        Type<?> base = getType();
         ListRecord values;
-        if (isArray()) {
-            base = getType().getBaseType();
+        if (base.isArray()) {
+            base = base.getBaseType();
             int size = segment.readInt(recordId.getOffset());
             RecordId listId = segment.readRecordId(recordId.getOffset() + 4);
             values = new ListRecord(listId, size);
         } else {
-            base = getType();
             values = new ListRecord(recordId, 1);
         }
         checkElementIndex(index, values.size());



Mime
View raw message