You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by md...@apache.org on 2014/09/16 11:11:02 UTC

svn commit: r1625224 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Segment.java

Author: mduerig
Date: Tue Sep 16 09:11:02 2014
New Revision: 1625224

URL: http://svn.apache.org/r1625224
Log:
OAK-2099: AIOOBE in Segment#toString
Correctly offset into the wrapped array using Buffer.position

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

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Segment.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Segment.java?rev=1625224&r1=1625223&r2=1625224&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Segment.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Segment.java Tue Sep 16 09:11:02 2014
@@ -470,12 +470,12 @@ public class Segment {
                 writer.format("reference %02x: %s%n", refid, getRefId(refid));
             }
             int rootcount = data.getShort(ROOT_COUNT_OFFSET) & 0xffff;
-            int pos = refcount * 16;
+            int pos = data.position() + refcount * 16;
             for (int rootid = 0; rootid < rootcount; rootid++) {
                 writer.format(
-                        "root %d: %s at %04x%n", rootid,
+                            "root %d: %s at %04x%n", rootid,
                         RecordType.values()[data.get(pos + rootid * 3) & 0xff],
-                        data.getShort(pos + rootid * 3 + 1) & 0xffff);
+                            data.getShort(pos + rootid * 3 + 1) & 0xffff);
             }
             int blobrefcount = data.getShort(BLOBREF_COUNT_OFFSET) & 0xffff;
             pos += rootcount * 3;