X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fimpl%2FNetconfServerSessionNegotiator.java;h=75ca014aac9877666ed21e478b21ee3241711bd2;hb=a33c5a6dce59e7fde138a873500861b06116b3bc;hp=4af12fe78dad387b68207121602530bab13cc2bc;hpb=bcb088ff848d235743650779625598e224b29307;p=netconf.git diff --git a/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiator.java b/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiator.java index 4af12fe78d..75ca014aac 100644 --- a/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiator.java +++ b/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiator.java @@ -66,12 +66,11 @@ public final class NetconfServerSessionNegotiator * @return Two values - port and host of socket address */ protected static Map.Entry getHostName(final SocketAddress socketAddress) { - if (socketAddress instanceof InetSocketAddress) { - final var inetSocketAddress = (InetSocketAddress) socketAddress; + if (socketAddress instanceof InetSocketAddress inetSocketAddress) { return new SimpleImmutableEntry<>(Integer.toString(inetSocketAddress.getPort()), inetSocketAddress.getHostString()); - } else if (socketAddress instanceof LocalAddress) { - return new SimpleImmutableEntry<>(UNKNOWN, ((LocalAddress) socketAddress).id()); + } else if (socketAddress instanceof LocalAddress localAddress) { + return new SimpleImmutableEntry<>(UNKNOWN, localAddress.id()); } else { return new SimpleImmutableEntry<>(UNKNOWN, UNKNOWN); }