ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: ignite-471-2: check duplicate type id in MarshallerContext
Date Mon, 01 Jun 2015 13:45:04 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-471-2 ba0b50371 -> d783ca309


ignite-471-2: check duplicate type id in MarshallerContext


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

Branch: refs/heads/ignite-471-2
Commit: d783ca309b079a65747f11c442cee8abb0442315
Parents: ba0b503
Author: Denis Magda <dmagda@gridgain.com>
Authored: Mon Jun 1 16:44:54 2015 +0300
Committer: Denis Magda <dmagda@gridgain.com>
Committed: Mon Jun 1 16:44:54 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/internal/MarshallerContextAdapter.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d783ca30/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java
index 8386675..4ccb759 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java
@@ -95,12 +95,17 @@ public abstract class MarshallerContextAdapter implements MarshallerContext
{
     @Override public boolean registerClass(int id, Class cls) throws IgniteCheckedException
{
         boolean registered = true;
 
-        if (!map.containsKey(id)) {
+        String clsName = map.get(id);
+
+        if (clsName == null) {
             registered = registerClassName(id, cls.getName());
 
             if (registered)
                 map.putIfAbsent(id, cls.getName());
         }
+        else if (!clsName.equals(cls.getName()))
+            throw new IgniteCheckedException("Duplicate ID [id=" + id + ", oldCls=" + clsName
+
+                ", newCls=" + cls.getName());
 
         return registered;
     }


Mime
View raw message