ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [09/50] [abbrv] ignite git commit: IGNITE-8857 HashMap is returned instead of filtering wrapper. - Fixes #4258.
Date Mon, 02 Jul 2018 12:51:37 GMT
IGNITE-8857 HashMap is returned instead of filtering wrapper. - Fixes #4258.

Signed-off-by: Dmitriy Pavlov <dpavlov@apache.org>


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

Branch: refs/heads/ignite-8446
Commit: e1a3398b509a16f0db3b60751d0ef52e1b763a87
Parents: 4c295f8
Author: Sergey Chugunov <sergey.chugunov@gmail.com>
Authored: Thu Jun 28 17:29:20 2018 +0300
Committer: Dmitriy Pavlov <dpavlov@apache.org>
Committed: Thu Jun 28 17:29:20 2018 +0300

----------------------------------------------------------------------
 .../zk/internal/ZookeeperClusterNode.java       |  4 ++--
 .../zk/internal/ZookeeperDiscoverySpiTest.java  | 22 ++++++++++++++++++++
 2 files changed, 24 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e1a3398b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperClusterNode.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperClusterNode.java
b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperClusterNode.java
index 2fe3052..02e4123 100644
--- a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperClusterNode.java
+++ b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperClusterNode.java
@@ -243,11 +243,11 @@ public class ZookeeperClusterNode implements IgniteClusterNode, Externalizable,
     /** {@inheritDoc} */
     @Override public Map<String, Object> attributes() {
         // Even though discovery SPI removes this attribute after authentication, keep this
check for safety.
-        return F.view(attrs, new IgnitePredicate<String>() {
+        return new HashMap<>(F.view(attrs, new IgnitePredicate<String>() {
             @Override public boolean apply(String s) {
                 return !IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS.equals(s);
             }
-        });
+        }));
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1a3398b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiTest.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiTest.java
b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiTest.java
index f04a880..4cfc6cb 100644
--- a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiTest.java
+++ b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiTest.java
@@ -473,6 +473,28 @@ public class ZookeeperDiscoverySpiTest extends GridCommonAbstractTest
{
     }
 
     /**
+     * Verifies that node attributes returned through public API are presented in standard
form.
+     *
+     * It means there is no exotic classes that may unnecessary capture other classes from
the context.
+     *
+     * For more information about the problem refer to
+     * <a href="https://issues.apache.org/jira/browse/IGNITE-8857">IGNITE-8857</a>.
+     */
+    public void testNodeAttributesNotReferencingZookeeperClusterNode() throws Exception {
+        userAttrs = new HashMap<>();
+        userAttrs.put("testAttr", "testAttr");
+
+        try {
+            IgniteEx ignite = startGrid(0);
+
+            assertTrue(ignite.cluster().localNode().attributes() instanceof HashMap);
+        }
+        finally {
+            userAttrs = null;
+        }
+    }
+
+    /**
      * @throws Exception If failed.
      */
     public void testZkRootNotExists() throws Exception {


Mime
View raw message