ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [05/16] ignite git commit: IGNITE-1282: Fixed incorrect metadata resolution for MAP_ENTRY type.
Date Wed, 04 Nov 2015 10:28:08 GMT
IGNITE-1282: Fixed incorrect metadata resolution for MAP_ENTRY type.


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

Branch: refs/heads/ignite-950-new
Commit: 6eb314e75c63fad4985fa0ef89f285fd2a287291
Parents: f7fdc18
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Wed Nov 4 11:16:31 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Wed Nov 4 11:16:31 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/portable/PortableUtils.java   |  3 ++-
 .../portable/builder/PortableBuilderImpl.java     | 18 +++++++++++-------
 .../CacheObjectPortableProcessorImpl.java         |  4 ++++
 3 files changed, 17 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6eb314e7/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 4e3538c..e0368b6 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
@@ -65,6 +65,7 @@ import static org.apache.ignite.internal.portable.GridPortableMarshaller.INT_ARR
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.LONG;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.LONG_ARR;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.MAP;
+import static org.apache.ignite.internal.portable.GridPortableMarshaller.MAP_ENTRY;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.NULL;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.OBJ;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.OBJ_ARR;
@@ -464,7 +465,7 @@ public class PortableUtils {
             return MAP;
 
         if (Map.Entry.class.isAssignableFrom(cls))
-            return MAP;
+            return MAP_ENTRY;
 
         return OBJ;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/6eb314e7/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
index d7ec6b3..89bb3ff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.portable.builder;
 
+import org.apache.ignite.internal.portable.GridPortableMarshaller;
 import org.apache.ignite.internal.portable.PortableContext;
 import org.apache.ignite.internal.portable.PortableObjectImpl;
 import org.apache.ignite.internal.portable.PortableObjectOffheapImpl;
@@ -245,7 +246,7 @@ public class PortableBuilderImpl implements PortableBuilder {
                     int fieldId = reader.readIntPositioned(footerPos);
                     int fieldLen = fieldPositionAndLength(footerPos, footerEnd, rawPos, fieldOffsetSize).get2();
 
-                    int postLen = reader.position() + fieldLen; // Position where reader
will be placed afterwards.
+                    int postPos = reader.position() + fieldLen; // Position where reader
will be placed afterwards.
 
                     footerPos += 4 + fieldOffsetSize;
 
@@ -276,7 +277,7 @@ public class PortableBuilderImpl implements PortableBuilder {
                             else if (readCache == null) {
                                 val = reader.parseValue();
 
-                                assert reader.position() == postLen;
+                                assert reader.position() == postPos;
                             }
                             else
                                 val = readCache.get(fieldId);
@@ -285,7 +286,7 @@ public class PortableBuilderImpl implements PortableBuilder {
                         }
                     }
 
-                    reader.position(postLen);
+                    reader.position(postPos);
                 }
             }
 
@@ -336,15 +337,18 @@ public class PortableBuilderImpl implements PortableBuilder {
                                 newFldsMetadata = new HashMap<>();
 
                             newFldsMetadata.put(name, newFldTypeName);
-                        } else {
-                            if (!"Object".equals(oldFldTypeName) && !oldFldTypeName.equals(newFldTypeName))
{
+                        }
+                        else {
+                            String objTypeName =
+                                CacheObjectPortableProcessorImpl.FIELD_TYPE_NAMES[GridPortableMarshaller.OBJ];
+
+                            if (!objTypeName.equals(oldFldTypeName) && !oldFldTypeName.equals(newFldTypeName))
{
                                 throw new PortableException(
                                     "Wrong value has been set [" +
                                         "typeName=" + (typeName == null ? metadata.typeName()
: typeName) +
                                         ", fieldName=" + name +
                                         ", fieldType=" + oldFldTypeName +
-                                        ", assignedValueType=" + newFldTypeName +
-                                        ", assignedValue=" + (((PortableValueWithType) val).value())
+ ']'
+                                        ", assignedValueType=" + newFldTypeName + ']'
                                 );
                             }
                         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/6eb314e7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java
index 04c1e69..083fec9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java
@@ -95,6 +95,7 @@ import static org.apache.ignite.internal.portable.GridPortableMarshaller.BYTE;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.BYTE_ARR;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.CHAR;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.CHAR_ARR;
+import static org.apache.ignite.internal.portable.GridPortableMarshaller.CLASS;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.COL;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.DATE;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.DATE_ARR;
@@ -111,6 +112,7 @@ import static org.apache.ignite.internal.portable.GridPortableMarshaller.INT_ARR
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.LONG;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.LONG_ARR;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.MAP;
+import static org.apache.ignite.internal.portable.GridPortableMarshaller.MAP_ENTRY;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.OBJ;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.OBJ_ARR;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.PORTABLE_OBJ;
@@ -198,6 +200,8 @@ public class CacheObjectPortableProcessorImpl extends IgniteCacheObjectProcessor
         FIELD_TYPE_NAMES[PORTABLE_OBJ] = "Object";
         FIELD_TYPE_NAMES[COL] = "Collection";
         FIELD_TYPE_NAMES[MAP] = "Map";
+        FIELD_TYPE_NAMES[MAP_ENTRY] = "Entry";
+        FIELD_TYPE_NAMES[CLASS] = "Class";
         FIELD_TYPE_NAMES[BYTE_ARR] = "byte[]";
         FIELD_TYPE_NAMES[SHORT_ARR] = "short[]";
         FIELD_TYPE_NAMES[INT_ARR] = "int[]";


Mime
View raw message