ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [3/6] incubator-ignite git commit: ignite-950: fixes in the protocol
Date Fri, 29 May 2015 14:13:03 GMT
ignite-950: fixes in the protocol


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

Branch: refs/heads/ignite-950
Commit: 3e6c779714710ad1566c07bb2fa6522bafef4ca6
Parents: 3148af7
Author: Denis Magda <dmagda@gridgain.com>
Authored: Fri May 29 13:38:09 2015 +0300
Committer: Denis Magda <dmagda@gridgain.com>
Committed: Fri May 29 13:38:09 2015 +0300

----------------------------------------------------------------------
 .../optimized/OptimizedObjectInputStream.java   |  2 +-
 .../optimized/OptimizedObjectOutputStream.java  | 21 ++++++++++++++------
 2 files changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3e6c7797/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectInputStream.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectInputStream.java
b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectInputStream.java
index d07aaf5..edc612b 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectInputStream.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectInputStream.java
@@ -521,7 +521,7 @@ class OptimizedObjectInputStream extends ObjectInputStream {
         byte flag = (byte)in.readInt();
 
         if (flag != EMPTY_FOOTER) {
-            int skip = 3;
+            int skip = 2;
 
             for (int i = 0; i < fields.hierarchyLevels(); i++)
                 skip += fields.fields(i).size() * 3;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3e6c7797/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
index b136bc6..2b27ec0 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
@@ -1005,18 +1005,18 @@ class OptimizedObjectOutputStream extends ObjectOutputStream {
          * Puts type ID and its value len to the footer.
          *
          * @param typeId Type ID.
-         * @param relativeOff Offset of an object in fields' data section.
+         * @param relOff Offset of an object in fields' data section.
          * @param len Total number of bytes occupied by type's value.
          */
-        private void put(int typeId, int relativeOff, int len) {
+        private void put(int typeId, int relOff, int len) {
             if (data == null)
                 return;
 
             data[pos++] = typeId;
-            data[pos++] = relativeOff;
+            data[pos++] = relOff;
             data[pos++] = len;
 
-            lenForOff.put(relativeOff, len);
+            lenForOff.put(relOff, len);
         }
 
         /**
@@ -1026,13 +1026,22 @@ class OptimizedObjectOutputStream extends ObjectOutputStream {
          * @param typeId Type ID.
          */
         private void putHandle(int handle, int typeId) {
+            if (data == null)
+                return;
+
             int handleOff = handles.objectOffset(handle);
             int relOff = fieldsDataPos - handleOff;
 
             Integer len = lenForOff.get(relOff);
 
-            if (len == null)
-                throw new IllegalArgumentException("Failed to find length for offset: " +
relOff);
+            if (len == null) {
+                // this can be a handle to an outer object, we won't be able to process such
cases when a field
+                // is detached
+                data = null;
+                lenForOff = null;
+
+                return;
+            }
 
             put(typeId, relOff, len);
         }


Mime
View raw message