Sonar Fix: LookupServer.java 06/96006/2
authorArundathi Patil <arundpil@in.ibm.com>
Thu, 19 Sep 2019 15:05:31 +0000 (20:35 +0530)
committerTakamune Cho <takamune.cho@att.com>
Tue, 1 Oct 2019 15:01:17 +0000 (15:01 +0000)
Fixed sonar issues across this file

Issue-ID: APPC-1739
Change-Id: Iabbaada720d8b3f2ee3916a0d663b90f8fe23bcb
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/LookupServer.java

index 4ca0365..daa8b26 100644 (file)
@@ -53,9 +53,9 @@ public class LookupServer extends ProviderServerOperation {
 
     private static final EELFLogger logger = EELFManager.getInstance().getLogger(EvacuateServer.class);
     private static final Configuration configuration = ConfigurationFactory.getConfiguration();
-    private static final String serverFound = "serverFound";
+    private static final String SERVERFOUND = "serverFound";
 
-    public Server lookupServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
+    public Server lookupServer(Map<String, String> params, SvcLogicContext ctx) {
         Server server = null;
         RequestContext rc = new RequestContext(ctx);
         rc.isAlive(); // should we test the return and fail if false?
@@ -78,7 +78,7 @@ public class LookupServer extends ProviderServerOperation {
             String msg = EELFResourceManager.format(Msg.SERVER_NOT_FOUND, e, vmUrl);
             logger.error(msg);
             doFailure(rc, HttpStatus.NOT_FOUND_404, msg);
-            ctx.setAttribute(serverFound, "failure");
+            ctx.setAttribute(SERVERFOUND, "failure");
         }
         return server;
     }
@@ -93,7 +93,7 @@ public class LookupServer extends ProviderServerOperation {
                 rqstCtx.reset();
                 server = lookupServer(rqstCtx, context, vm.getServerId());
                 logger.debug(Msg.SERVER_FOUND, vmUrl, context.getTenantName(), server.getStatus().toString());
-                ctx.setAttribute(serverFound, "success");
+                ctx.setAttribute(SERVERFOUND, "success");
                 String msg = EELFResourceManager.format(Msg.SUCCESS_EVENT_MESSAGE, "LookupServer", vmUrl);
                 ctx.setAttribute(org.onap.appc.Constants.ATTRIBUTE_SUCCESS_MESSAGE, msg);
                 doSuccess(rqstCtx);
@@ -103,7 +103,7 @@ public class LookupServer extends ProviderServerOperation {
             String msg = EELFResourceManager.format(Msg.SERVER_NOT_FOUND, e, vmUrl);
             logger.error(msg);
             doFailure(rqstCtx, HttpStatus.NOT_FOUND_404, msg);
-            ctx.setAttribute(serverFound, "failure");
+            ctx.setAttribute(SERVERFOUND, "failure");
         } catch (IOException e) {
             // exception closing context
             String msg = EELFResourceManager.format(Msg.CLOSE_CONTEXT_FAILED, e, vmUrl);