fixed npe - https://issues.apache.org/jira/browse/IGNITE-2532
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4035d40f Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4035d40f Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4035d40f Branch: refs/heads/ignite-1786 Commit: 4035d40f18fa2d829eaa17c0496eeecfad81fee1 Parents: ee20f1d Author: Yakov Zhdanov <[email protected]> Authored: Tue Feb 2 16:42:35 2016 +0300 Committer: Yakov Zhdanov <[email protected]> Committed: Tue Feb 2 16:42:35 2016 +0300 ---------------------------------------------------------------------- .../multicast/TcpDiscoveryMulticastIpFinder.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/4035d40f/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java index 8402cbf..75b5f91 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java @@ -116,7 +116,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder { private String locAddr; /** Time to live. */ - private Integer ttl; + private int ttl = -1; /** */ @GridToStringExclude @@ -267,6 +267,8 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder { * <p> * If TTL is {@code 0}, packets are not transmitted on the network, * but may be delivered locally. + * <p> + * Default value is {@code -1} which corresponds to system default value. * * @param ttl Time to live. */ @@ -307,7 +309,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder { throw new IgniteSpiException("Invalid number of address request attempts, " + "value greater than zero is expected: " + addrReqAttempts); - if (ttl != null && (ttl < 0 || ttl > 255)) + if (ttl != -1 && (ttl < 0 || ttl > 255)) throw new IgniteSpiException("Time-to-live value is out of 0 <= TTL <= 255 range: " + ttl); if (F.isEmpty(getRegisteredAddresses())) @@ -545,7 +547,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder { sock.setSoTimeout(resWaitTime); - if (ttl != null) + if (ttl != -1) sock.setTimeToLive(ttl); reqPckt.setData(MSG_ADDR_REQ_DATA); @@ -817,7 +819,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder { sock.joinGroup(mcastGrp); - if (ttl != null) + if (ttl != -1) sock.setTimeToLive(ttl); return sock; @@ -908,4 +910,4 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder { } } } -} \ No newline at end of file +}
