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.";
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<InetSocketAddress> 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());
}
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);
}
}