You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/01/09 08:56:22 UTC

[2/2] ignite git commit: ServerImpl: check attribute for null.

ServerImpl: check attribute for null.


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

Branch: refs/heads/ignite-3477
Commit: 124ee7f19883e73e0fc7940d6fdbe216593fd505
Parents: d484a76
Author: sboikov <sb...@gridgain.com>
Authored: Mon Jan 9 11:56:22 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Jan 9 11:56:22 2017 +0300

----------------------------------------------------------------------
 .../apache/ignite/spi/discovery/tcp/ServerImpl.java | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/124ee7f1/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 66f1173..44159c6 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -3685,8 +3685,8 @@ class ServerImpl extends TcpDiscoveryImpl {
                     return;
                 }
 
-                boolean locActiveOnStart = locNode.attribute(ATTR_ACTIVE_ON_START);
-                boolean rmtActiveOnStart = node.attribute(ATTR_ACTIVE_ON_START);
+                boolean locActiveOnStart = booleanAttribute(locNode, ATTR_ACTIVE_ON_START, true);
+                boolean rmtActiveOnStart = booleanAttribute(node, ATTR_ACTIVE_ON_START, true);
 
                 if (locActiveOnStart != rmtActiveOnStart) {
                     String errMsg = "Local node's active on start flag differs from " +
@@ -3801,6 +3801,18 @@ class ServerImpl extends TcpDiscoveryImpl {
         }
 
         /**
+         * @param node Node.
+         * @param name Attribute name.
+         * @param dflt Default value.
+         * @return Attribute value.
+         */
+        private boolean booleanAttribute(ClusterNode node, String name, boolean dflt) {
+            Boolean attr = node.attribute(name);
+
+            return attr != null ? attr : dflt;
+        }
+
+        /**
          * @param node Joining node.
          * @param errMsg Message to log.
          * @param sndMsg Message to send.