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

alexpl 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 91e66669ffc IGNITE-18766 Fix incorrect id check in 
ClusterGroupAdapter.forNodeId - Fixes #10640.
91e66669ffc is described below

commit 91e66669ffc11950fe4a4358c04893a71aa98953
Author: Denis Kuznetsov <[email protected]>
AuthorDate: Fri Apr 14 10:48:06 2023 +0300

    IGNITE-18766 Fix incorrect id check in ClusterGroupAdapter.forNodeId - 
Fixes #10640.
    
    Signed-off-by: Aleksey Plekhanov <[email protected]>
---
 .../ignite/internal/cluster/ClusterGroupAdapter.java       |  2 +-
 .../ignite/internal/GridProjectionForCachesSelfTest.java   | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
index b6d07ece704..880a2b0460f 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
@@ -458,7 +458,7 @@ public class ClusterGroupAdapter implements ClusterGroupEx, 
Externalizable {
                 nodeIds = U.newHashSet(ids.length + 1);
 
                 for (UUID id0 : ids) {
-                    if (contains(id))
+                    if (contains(id0))
                         nodeIds.add(id0);
                 }
 
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
index e68b9a07472..ebec6bd4ddf 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import java.util.UUID;
 import org.apache.ignite.Ignite;
@@ -281,6 +282,19 @@ public class GridProjectionForCachesSelfTest extends 
GridCommonAbstractTest {
         }
     }
 
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testProjectionWithBadId() {
+        ClusterNode locNode = ignite.cluster().localNode();
+
+        ClusterGroup prj = ignite.cluster().forNodeId(UUID.randomUUID(), 
locNode.id());
+        Collection<ClusterNode> nodes = prj.nodes();
+
+        assertEquals(1, nodes.size());
+    }
+
     /**
      *
      */

Reply via email to