ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [20/21] incubator-ignite git commit: #[IGNITE-928]: Array out of bounds in IgniteUtils.filterReachable
Date Mon, 25 May 2015 09:12:42 GMT
#[IGNITE-928]: Array out of bounds in IgniteUtils.filterReachable


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

Branch: refs/heads/ignite-471-2
Commit: 050f4292f3526d2306336383c6e9e5b0d6df638e
Parents: 6ba171f
Author: iveselovskiy <iveselovskiy@gridgain.com>
Authored: Fri May 22 21:40:06 2015 +0300
Committer: iveselovskiy <iveselovskiy@gridgain.com>
Committed: Fri May 22 21:40:06 2015 +0300

----------------------------------------------------------------------
 .../ClientAbstractConnectivitySelfTest.java           | 14 ++++++++++++++
 .../org/apache/ignite/internal/util/IgniteUtils.java  |  6 ++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/050f4292/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
index 7272b2c..5aec7e5 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.client.integration;
 
 import org.apache.ignite.*;
 import org.apache.ignite.internal.client.*;
+import org.apache.ignite.internal.util.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
@@ -123,6 +124,19 @@ public abstract class ClientAbstractConnectivitySelfTest extends GridCommonAbstr
     }
 
     /**
+     * Simple test of address list filtering.
+     * @throws Exception
+     */
+    public void testResolveReachableOneAddress() throws Exception {
+        InetAddress addr = InetAddress.getByAddress(new byte[] {127, 0, 0, 1} );
+
+        List <InetAddress> filtered = IgniteUtils.filterReachable(Collections.singletonList(addr));
+
+        assertEquals(1, filtered.size());
+        assertEquals(addr, filtered.get(0));
+    }
+
+    /**
      * Tests correct behavior in case of 1 REST-enabled node
      * with explicitly specified loopback address setting.
      *

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/050f4292/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
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 673287d..0932212 100644
--- 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
@@ -1532,8 +1532,10 @@ public abstract class IgniteUtils {
             return Collections.emptyList();
 
         if (addrs.size() == 1) {
-            if (reachable(addrs.get(1), reachTimeout))
-                return Collections.singletonList(addrs.get(1));
+            InetAddress addr = addrs.get(0);
+
+            if (reachable(addr, reachTimeout))
+                return Collections.singletonList(addr);
 
             return Collections.emptyList();
         }


Mime
View raw message