Bump odlparent to 6.0.0
[netconf.git] / netconf / callhome-provider / src / main / java / org / opendaylight / netconf / callhome / mount / CallHomeMountSessionContext.java
index 539f6ab3158d66a933c7af6fd825684bccae536c..e371eb1113412423f9595015fc1a6d9a79bb20c2 100644 (file)
@@ -5,10 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.netconf.callhome.mount;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.util.concurrent.Promise;
 import java.net.InetSocketAddress;
 import java.security.PublicKey;
@@ -27,7 +28,6 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
 
 class CallHomeMountSessionContext {
-
     public interface CloseCallback {
         void onClosed(CallHomeMountSessionContext deviceContext);
     }
@@ -39,14 +39,14 @@ class CallHomeMountSessionContext {
     // FIXME: Remove this
     private final ContextKey key;
 
-    CallHomeMountSessionContext(String nodeId, CallHomeProtocolSessionContext protocol,
-                                CallHomeChannelActivator activator, CloseCallback callback) {
+    CallHomeMountSessionContext(final String nodeId, final CallHomeProtocolSessionContext protocol,
+                                final CallHomeChannelActivator activator, final CloseCallback callback) {
 
-        this.nodeId = new NodeId(Preconditions.checkNotNull(nodeId, "nodeId"));
+        this.nodeId = new NodeId(requireNonNull(nodeId, "nodeId"));
         this.key = ContextKey.from(protocol.getRemoteAddress());
-        this.protocol = Preconditions.checkNotNull(protocol, "protocol");
-        this.activator = Preconditions.checkNotNull(activator, "activator");
-        this.onClose = Preconditions.checkNotNull(callback, "callback");
+        this.protocol = requireNonNull(protocol, "protocol");
+        this.activator = requireNonNull(activator, "activator");
+        this.onClose = requireNonNull(callback, "callback");
     }
 
     NodeId getId() {
@@ -73,7 +73,7 @@ class CallHomeMountSessionContext {
     }
 
     @SuppressWarnings("unchecked")
-    <V> Promise<V> activateNetconfChannel(NetconfClientSessionListener sessionListener) {
+    <V> Promise<V> activateNetconfChannel(final NetconfClientSessionListener sessionListener) {
         return (Promise<V>) activator.activate(wrap(sessionListener));
     }
 
@@ -81,12 +81,12 @@ class CallHomeMountSessionContext {
     private NetconfClientSessionListener wrap(final NetconfClientSessionListener delegate) {
         return new NetconfClientSessionListener() {
             @Override
-            public void onSessionUp(NetconfClientSession session) {
+            public void onSessionUp(final NetconfClientSession session) {
                 delegate.onSessionUp(session);
             }
 
             @Override
-            public void onSessionTerminated(NetconfClientSession session, NetconfTerminationReason reason) {
+            public void onSessionTerminated(final NetconfClientSession session, final NetconfTerminationReason reason) {
                 try {
                     delegate.onSessionTerminated(session, reason);
                 } finally {
@@ -95,7 +95,7 @@ class CallHomeMountSessionContext {
             }
 
             @Override
-            public void onSessionDown(NetconfClientSession session, Exception exc) {
+            public void onSessionDown(final NetconfClientSession session, final Exception exc) {
                 try {
                     removeSelf();
                 } finally {
@@ -104,12 +104,14 @@ class CallHomeMountSessionContext {
             }
 
             @Override
-            public void onMessage(NetconfClientSession session, NetconfMessage message) {
+            public void onMessage(final NetconfClientSession session, final NetconfMessage message) {
                 delegate.onMessage(session, message);
             }
         };
     }
 
+    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
+            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private void removeSelf() {
         onClose.onClosed(this);
     }