Fix findbugs violations in netconf
[netconf.git] / netconf / sal-netconf-connector / src / main / java / org / opendaylight / netconf / sal / connect / netconf / sal / NetconfDeviceRpc.java
index e34b885787709215c4c0777741c1c27c4262765d..897cdaa5c73267039b1438aed9054cb69c37b9d9 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.netconf.sal.connect.netconf.sal;
 
-import com.google.common.base.Function;
 import com.google.common.collect.Collections2;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
@@ -37,13 +36,14 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
  */
 public final class NetconfDeviceRpc implements DOMRpcService {
 
-    private final RemoteDeviceCommunicator<NetconfMessage> listener;
+    private final RemoteDeviceCommunicator<NetconfMessage> communicator;
     private final MessageTransformer<NetconfMessage> transformer;
     private final Collection<DOMRpcIdentifier> availableRpcs;
 
-    public NetconfDeviceRpc(final SchemaContext schemaContext, final RemoteDeviceCommunicator<NetconfMessage> listener,
-                            final MessageTransformer<NetconfMessage> transformer) {
-        this.listener = listener;
+    public NetconfDeviceRpc(final SchemaContext schemaContext,
+            final RemoteDeviceCommunicator<NetconfMessage> communicator,
+            final MessageTransformer<NetconfMessage> transformer) {
+        this.communicator = communicator;
         this.transformer = transformer;
 
         availableRpcs = Collections2.transform(schemaContext.getOperations(),
@@ -56,7 +56,7 @@ public final class NetconfDeviceRpc implements DOMRpcService {
                                                                   @Nullable final NormalizedNode<?, ?> input) {
         final NetconfMessage message = transformer.toRpcRequest(type, input);
         final ListenableFuture<RpcResult<NetconfMessage>> delegateFutureWithPureResult =
-                listener.sendRequest(message, type.getLastComponent());
+                communicator.sendRequest(message, type.getLastComponent());
 
         final ListenableFuture<DOMRpcResult> transformed =
             Futures.transform(delegateFutureWithPureResult, input1 -> {
@@ -67,13 +67,8 @@ public final class NetconfDeviceRpc implements DOMRpcService {
                 }
             }, MoreExecutors.directExecutor());
 
-        return Futures.makeChecked(transformed, new Function<Exception, DOMRpcException>() {
-            @Nullable
-            @Override
-            public DOMRpcException apply(@Nullable final Exception exception) {
-                return new DOMRpcImplementationNotAvailableException(exception, "Unable to invoke rpc %s", type);
-            }
-        });
+        return Futures.makeChecked(transformed, exception ->
+            new DOMRpcImplementationNotAvailableException(exception, "Unable to invoke rpc %s", type));
     }
 
     @Nonnull