ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [15/49] ignite git commit: IGNITE-3834: Fixed a problem with BinaryMarshaller handles resolution.
Date Mon, 12 Sep 2016 11:18:54 GMT
IGNITE-3834: Fixed a problem with BinaryMarshaller handles resolution.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 40d4b6ac6a71ed541d20018cf7deb2fb9b9bbb9b
Parents: d65228e
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Mon Sep 5 11:35:26 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Mon Sep 5 11:35:26 2016 +0300

----------------------------------------------------------------------
 .../internal/binary/BinaryReaderHandles.java    |  2 +-
 .../binary/BinaryMarshallerSelfTest.java        | 38 ++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/40d4b6ac/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandles.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandles.java
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandles.java
index fddb8aa..881060f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandles.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandles.java
@@ -57,7 +57,7 @@ public class BinaryReaderHandles {
                 return null;
 
             case MODE_SINGLE:
-                return (T)data;
+                 return pos == singlePos ? (T)data : null;
 
             default:
                 assert mode == MODE_MULTIPLE;

http://git-wip-us.apache.org/repos/asf/ignite/blob/40d4b6ac/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
index f4c1bf7..b347ec0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
@@ -2896,6 +2896,21 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest
{
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testSingleHandle() throws Exception {
+        SingleHandleA a = new SingleHandleA(new SingleHandleB());
+
+        BinaryObjectImpl bo = marshal(a, binaryMarshaller());
+
+        Map<String, BinaryObject> map = bo.field("map");
+
+        BinaryObject innerBo = map.get("key");
+
+        assertEquals(SingleHandleB.class, innerBo.deserialize().getClass());
+    }
+
+    /**
      *
      */
     private static interface SomeItf {
@@ -4847,4 +4862,27 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest
{
             return value;
         }
     }
+
+    /**
+     */
+    private static class SingleHandleA {
+        /** */
+        private SingleHandleB b;
+
+        /** */
+        private Map<Object, SingleHandleB> map = new HashMap<>();
+
+        /**
+         * @param b B.
+         */
+        SingleHandleA(SingleHandleB b) {
+            this.b = b;
+
+            map.put("key", b);
+        }
+    }
+
+    /**
+     */
+    private static class SingleHandleB {}
 }


Mime
View raw message