fix PCE SpotBugs issues
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / service / PathComputationServiceImpl.java
index 8a1b33317c5e5f4c469e78fb2f66e2360bcabec1..85ccde2b1034f8d63a5dd3b0135683a4b35cbdb3 100644 (file)
@@ -10,19 +10,17 @@ package org.opendaylight.transportpce.pce.service;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
-
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Callable;
 import java.util.concurrent.Executors;
-
 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
 import org.opendaylight.transportpce.pce.PceComplianceCheck;
 import org.opendaylight.transportpce.pce.PceComplianceCheckResult;
 import org.opendaylight.transportpce.pce.PceSendingPceRPCs;
 import org.opendaylight.transportpce.pce.gnpy.GnpyResult;
-
 import org.opendaylight.yang.gen.v1.gnpy.path.rev200202.result.Response;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.CancelResourceReserveInput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.CancelResourceReserveOutput;
@@ -77,6 +75,9 @@ public class PathComputationServiceImpl implements PathComputationService {
         LOG.info("close.");
     }
 
+    @SuppressFBWarnings(
+        value = "UPM_UNCALLED_PRIVATE_METHOD",
+        justification = "false positive, this method is used by public method cancelResourceReserve")
     private void sendNotifications(ServicePathNotificationTypes servicePathNotificationTypes, String serviceName,
             RpcStatusEx rpcStatusEx, String message, PathDescription pathDescription) {
         ServicePathRpcResultBuilder servicePathRpcResultBuilder =
@@ -105,12 +106,12 @@ public class PathComputationServiceImpl implements PathComputationService {
                         RpcStatusEx.Pending, "Service compliant, submitting cancelResourceReserve Request ...", null);
                 PceSendingPceRPCs sendingPCE = new PceSendingPceRPCs();
                 sendingPCE.cancelResourceReserve();
-                if (sendingPCE.getSuccess()) {
+                if (Boolean.TRUE.equals(sendingPCE.getSuccess())) {
                     message = "ResourceReserve cancelled !";
                 } else {
                     message = "Cancelling ResourceReserve failed !";
                 }
-                LOG.info(message);
+                LOG.info("in PathComputationServiceImpl : {}",message);
                 sendNotifications(ServicePathNotificationTypes.CancelResourceReserve, input.getServiceName(),
                         RpcStatusEx.Successful, "cancel Resource Reserve successful!", null);
                 ConfigurationResponseCommonBuilder configurationResponseCommon =
@@ -173,7 +174,7 @@ public class PathComputationServiceImpl implements PathComputationService {
                 }
                 output.setGnpyResponse(listResponse);
 
-                if (!(sendingPCE.getSuccess()) || (path == null)) {
+                if (Boolean.FALSE.equals(sendingPCE.getSuccess()) || (path == null)) {
                     configurationResponseCommon.setAckFinalIndicator("Yes")
                             .setRequestId(input.getServiceHandlerHeader().getRequestId()).setResponseCode(responseCode)
                             .setResponseMessage(message);
@@ -256,9 +257,7 @@ public class PathComputationServiceImpl implements PathComputationService {
                 feasible = true;
             }
         }
-        GnpyResponse gnpypResp = new GnpyResponseBuilder().setPathDir(pathDir).setResponseType(respType)
-                .setFeasibility(feasible).build();
-        return gnpypResp;
+        return new GnpyResponseBuilder().setPathDir(pathDir).setResponseType(respType).setFeasibility(feasible).build();
     }
 
 }