You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by jo...@apache.org on 2019/09/09 13:31:47 UTC

[ignite] branch master updated: IGNITE-12123 Cache throws npe at {null, null, null} array key. - Fixes #6828.

This is an automated email from the ASF dual-hosted git repository.

jokser pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 8c9e5e4  IGNITE-12123 Cache throws npe at {null, null, null} array key. - Fixes #6828.
8c9e5e4 is described below

commit 8c9e5e46e102bcdd6e99f9f46197d834ebc9a428
Author: mstepachev <ma...@gmail.com>
AuthorDate: Mon Sep 9 16:30:36 2019 +0300

    IGNITE-12123 Cache throws npe at {null, null, null} array key. - Fixes #6828.
    
    Signed-off-by: Pavel Kovalenko <jo...@gmail.com>
---
 .../java/org/apache/ignite/internal/util/IgniteUtils.java  |  3 +++
 .../org/apache/ignite/cache/store/StoreArrayKeyTest.java   | 14 +++++++-------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index c6dfc56..8c09196 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -5366,6 +5366,9 @@ public abstract class IgniteUtils {
      * @param obj Object.
      */
     public static int hashCode(Object obj) {
+        if(obj == null)
+            return 0;
+
         if (obj.getClass().isArray()) {
             if (obj instanceof byte[])
                 return Arrays.hashCode((byte[])obj);
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/StoreArrayKeyTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/StoreArrayKeyTest.java
index 26eaf6b..52d3427 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/StoreArrayKeyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/StoreArrayKeyTest.java
@@ -82,15 +82,15 @@ public class StoreArrayKeyTest extends GridCommonAbstractTest {
             new String[][] {new String[] {"a", "b", "c"}, new String[] {"c", "b", "a"}, new String[] {"a", "b", "c"}},
             new Object[][] {
                 new String[][] {
-                    new String[] {"a", "b", "c"},
-                    new String[] {"a", "b", "c"},
-                    new String[] {"a", "b", "c"}
+                    new String[] {"a", "b", null},
+                    new String[] {"a", null, "c"},
+                    new String[] {null, "b", "c"}
                 },
-                new String[] {"c", "b", "a"},
+                new String[] {null, null, null},
                 new String[][] {
-                    new String[] {"a", "b", "c"},
-                    new String[] {"a", "b", "c"},
-                    new String[] {"a", "b", "c"}
+                    new String[] {"a", "b", null},
+                    new String[] {"a", null, "c"},
+                    new String[] {null, "b", "c"}
                 }}
         );
     }