ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [09/46] ignite git commit: ignite-1718: proper type name extraction in portable context for classes that ends on '$' sign
Date Wed, 28 Oct 2015 09:30:12 GMT
ignite-1718: proper type name extraction in portable context for classes that ends on '$' sign


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

Branch: refs/heads/ignite-843-rc1
Commit: e9524cea121ce70338bb9bf1a5f622acc445d5f0
Parents: 91e31e9
Author: Andrey Gura <agura@gridgain.com>
Authored: Thu Oct 22 11:05:02 2015 +0300
Committer: Denis Magda <dmagda@gridgain.com>
Committed: Thu Oct 22 11:05:02 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/portable/PortableContext.java       | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e9524cea/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
index 1ad42ab..e9cccf0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
@@ -547,7 +547,6 @@ public class PortableContext implements Externalizable {
 
         try {
             registered = marshCtx.registerClass(typeId, cls);
-
         }
         catch (IgniteCheckedException e) {
             throw new PortableException("Failed to register class.", e);
@@ -891,10 +890,11 @@ public class PortableContext implements Externalizable {
 
         int idx = clsName.lastIndexOf('$');
 
-        String typeName;
-
-        if (idx >= 0) {
-            typeName = clsName.substring(idx + 1);
+        if (idx == clsName.length() - 1)
+            // This is a regular (not inner) class name that ends with '$'. Common use case
for Scala classes.
+            idx = -1;
+        else if (idx >= 0) {
+            String typeName = clsName.substring(idx + 1);
 
             try {
                 Integer.parseInt(typeName);
@@ -1147,4 +1147,4 @@ public class PortableContext implements Externalizable {
             return registered;
         }
     }
-}
\ No newline at end of file
+}


Mime
View raw message