X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Futil%2Fosgi%2FNetconfConfigUtil.java;h=64aeebd54205c658cad64589994a436282cbdb5b;hb=3a71a222b896b9d07e638af62300180799bdac67;hp=333fea3493172286fdba2c807eff105760741411;hpb=999c87c5aa34530297757b653ffb0dea80bf4ff2;p=controller.git diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/osgi/NetconfConfigUtil.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/osgi/NetconfConfigUtil.java index 333fea3493..64aeebd542 100644 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/osgi/NetconfConfigUtil.java +++ b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/osgi/NetconfConfigUtil.java @@ -16,7 +16,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public final class NetconfConfigUtil { - private static final Logger logger = LoggerFactory.getLogger(NetconfConfigUtil.class); + private static final Logger LOG = LoggerFactory.getLogger(NetconfConfigUtil.class); private static final String PREFIX_PROP = "netconf."; @@ -48,34 +48,11 @@ public final class NetconfConfigUtil { try { return Long.parseLong(timeoutString); } catch (final NumberFormatException e) { - logger.warn("Cannot parse {} property: {}, using defaults", key, timeoutString, e); + LOG.warn("Cannot parse {} property: {}, using defaults", key, timeoutString, e); return DEFAULT_TIMEOUT_MILLIS; } } - /** - * Get extracted address or default. - * - * @throws java.lang.IllegalStateException if neither address is present. - */ - private static InetSocketAddress getNetconfAddress(final InetSocketAddress defaultAddress, Optional extractedAddress, InfixProp infix) { - InetSocketAddress inetSocketAddress; - - if (extractedAddress.isPresent() == false) { - logger.debug("Netconf {} address not found, falling back to default {}", infix, defaultAddress); - - if (defaultAddress == null) { - logger.warn("Netconf {} address not found, default address not provided", infix); - throw new IllegalStateException("Netconf " + infix + " address not found, default address not provided"); - } - inetSocketAddress = defaultAddress; - } else { - inetSocketAddress = extractedAddress.get(); - } - - return inetSocketAddress; - } - public static String getPrivateKeyPath(final BundleContext context) { return getPropertyValue(context, getPrivateKeyKey()); } @@ -112,7 +89,7 @@ public final class NetconfConfigUtil { try { return Optional.of(parseAddress(address, port)); } catch (final RuntimeException e) { - logger.warn("Unable to parse {} netconf address from {}:{}, fallback to default", + LOG.warn("Unable to parse {} netconf address from {}:{}, fallback to default", infixProp, address, port, e); } }