ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [01/10] ignite git commit: IGNITE-1770: WIP.
Date Mon, 26 Oct 2015 15:11:59 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1770 99f4fd3ad -> ae2a938d6


IGNITE-1770: WIP.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e3d21877
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e3d21877
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e3d21877

Branch: refs/heads/ignite-1770
Commit: e3d218779e8cea1c7c38b68bac841c9a772615dd
Parents: 99f4fd3
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Mon Oct 26 16:43:41 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Mon Oct 26 16:43:41 2015 +0300

----------------------------------------------------------------------
 .../internal/portable/PortableReaderExImpl.java   | 17 +++++++++++++++--
 .../ignite/internal/portable/PortableUtils.java   | 18 ++++++++++++++++++
 2 files changed, 33 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e3d21877/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
index c1adc92..e23a865 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
@@ -145,6 +145,12 @@ public class PortableReaderExImpl implements PortableReader, PortableRawReaderEx
     /** */
     private int hdrLen;
 
+    /** Footer start. */
+    private int footerStart;
+
+    /** Footer end. */
+    private int footerEnd;
+
     /**
      * @param ctx Context.
      * @param arr Array.
@@ -202,13 +208,20 @@ public class PortableReaderExImpl implements PortableReader, PortableRawReaderEx
 
         in.position(in.position() + 2); // Skip flags.
 
-        typeId = in.readInt();
+        typeId = in.readIntPositioned(start + GridPortableMarshaller.TYPE_ID_POS);
+
+        footerStart = PortableUtils.footerStart(in, start);
+        footerEnd = in.readIntPositioned(start + GridPortableMarshaller.TOTAL_LEN_POS);
+
+        // Take in count possible raw offset.
+        if ((((footerEnd - footerStart) >> 2) & 0x1) == 0x1)
+            footerEnd -= 4;
 
         rawOff = PortableUtils.rawOffset(in, start);
 
         if (typeId == UNREGISTERED_TYPE_ID) {
             // Skip to the class name position.
-            in.position(in.position() + GridPortableMarshaller.DFLT_HDR_LEN - 8);
+            in.position(start + GridPortableMarshaller.DFLT_HDR_LEN);
 
             int off = in.position();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e3d21877/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
index d2bf579..bfe5295 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
@@ -557,6 +557,24 @@ public class PortableUtils {
     }
 
     /**
+     * Get footer start of the object.
+     *
+     * @param in Input stream.
+     * @param start Object start position inside the stream.
+     * @return Footer start.
+     */
+    public static int footerStart(PortablePositionReadable in, int start) {
+        int schemaId = in.readIntPositioned(start + GridPortableMarshaller.SCHEMA_ID_POS);
+
+        if (schemaId == 0)
+            // No schema, footer start equals to object end.
+            return in.readIntPositioned(start + GridPortableMarshaller.TOTAL_LEN_POS);
+        else
+            // Schema exists, use offset.
+            return in.readIntPositioned(start + GridPortableMarshaller.SCHEMA_OR_RAW_OFF_POS);
+    }
+
+    /**
      * Get raw offset of the object.
      *
      * @param in Input stream.


Mime
View raw message