You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/06/01 15:45:04 UTC

incubator-ignite git commit: ignite-471-2: check duplicate type id in MarshallerContext

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 <dm...@gridgain.com>
Authored: Mon Jun 1 16:44:54 2015 +0300
Committer: Denis Magda <dm...@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;
     }