From a2507a8f1c4e9b3c8d727653aaed2c4beaefc13d Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Fri, 21 Aug 2015 02:06:34 -0400 Subject: [PATCH] test: fix and simplify logic --- .../common/network/NetworkAddressTests.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/core/src/test/java/org/elasticsearch/common/network/NetworkAddressTests.java b/core/src/test/java/org/elasticsearch/common/network/NetworkAddressTests.java index 4ccc9f71660..5847bb75eeb 100644 --- a/core/src/test/java/org/elasticsearch/common/network/NetworkAddressTests.java +++ b/core/src/test/java/org/elasticsearch/common/network/NetworkAddressTests.java @@ -87,21 +87,13 @@ public class NetworkAddressTests extends ESTestCase { /** creates address without any lookups. hostname can be null, for missing */ private InetAddress forge(String hostname, String address) throws IOException { - if (hostname == null) { - return InetAddress.getByName(address); - } else { - byte bytes[] = InetAddress.getByName(address).getAddress(); - return InetAddress.getByAddress(hostname, bytes); - } + byte bytes[] = InetAddress.getByName(address).getAddress(); + return InetAddress.getByAddress(hostname, bytes); } /** creates scoped ipv6 address without any lookups. hostname can be null, for missing */ private InetAddress forgeScoped(String hostname, String address, int scopeid) throws IOException { byte bytes[] = InetAddress.getByName(address).getAddress(); - if (hostname == null) { - return Inet6Address.getByAddress(hostname, bytes); - } else { - return Inet6Address.getByAddress(hostname, bytes, scopeid); - } + return Inet6Address.getByAddress(hostname, bytes, scopeid); } }