fixed sonar issues in SaveNodeExecutor.java
authorSandeep J <sandeejh@in.ibm.com>
Mon, 17 Dec 2018 06:16:04 +0000 (11:46 +0530)
committerSandeep J <sandeejh@in.ibm.com>
Mon, 17 Dec 2018 06:16:44 +0000 (11:46 +0530)
fixed sonar issues

Issue-ID: CCSDK-525
Change-Id: I7b1ad4167f84da2820eb81f8951237428353612a
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SaveNodeExecutor.java

index 2dfc407..f8595ff 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2017 AT&T Intellectual Property. All rights
  *                                             reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -36,6 +38,7 @@ import org.slf4j.LoggerFactory;
 public class SaveNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(SaveNodeExecutor.class);
+    private static final String FAILURE= "failure";
 
     @Override
     public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
@@ -51,7 +54,7 @@ public class SaveNodeExecutor extends AbstractSvcLogicNodeExecutor {
         boolean force = "true".equalsIgnoreCase(forceStr);
         boolean localOnly = "true".equalsIgnoreCase(localOnlyStr);
 
-        Map<String, String> parmMap = new HashMap<String, String>();
+        Map<String, String> parmMap = new HashMap<>();
 
         Set<Map.Entry<String, SvcLogicExpression>> parmSet = node.getParameterSet();
         boolean hasParms = false;
@@ -70,7 +73,7 @@ public class SaveNodeExecutor extends AbstractSvcLogicNodeExecutor {
             }
         }
 
-        String outValue = "failure";
+        String outValue = FAILURE;
 
         if (LOG.isDebugEnabled()) {
             LOG.debug("save node encountered - looking for resource class " + plugin);
@@ -92,11 +95,11 @@ public class SaveNodeExecutor extends AbstractSvcLogicNodeExecutor {
                         break;
                     case FAILURE:
                     default:
-                        outValue = "failure";
+                        outValue = FAILURE;
                 }
             } catch (SvcLogicException e) {
                 LOG.error("Caught exception from resource plugin", e);
-                outValue = "failure";
+                outValue = FAILURE;
             }
         } else {
             LOG.warn("Could not find SvcLogicResource object for plugin " + plugin);