Evaluate to variable value 71/28771/3
authorburdziak <olaf.burdziakowski@nokia.com>
Mon, 22 Jan 2018 09:36:53 +0000 (10:36 +0100)
committerPatrick Brady <pb071s@att.com>
Mon, 22 Jan 2018 18:09:46 +0000 (18:09 +0000)
Same issue in many files.

Issue-ID: APPC-446

Change-Id: Iea2d6a64d5d794d3300267438cd3a2971d378d3a
Signed-off-by:te  burdziak <olaf.burdziakowski@nokia.com>

appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/AttachVolumeServer.java
appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/DettachVolumeServer.java
appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/EvacuateServer.java
appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RebuildServer.java
appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RestartServer.java
appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RestoreStack.java
appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/SnapshotStack.java
appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StartServer.java
appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StopServer.java
appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/TerminateServer.java
appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/VmStatuschecker.java

index 2acd499..3d3b9b7 100644 (file)
@@ -59,6 +59,7 @@ public class AttachVolumeServer extends ProviderServerOperation {
         String device = params.get(ProviderAdapter.DEVICE);
         VMURL vm = VMURL.parseURL(vm_url);
         Context context = null;
+        String tenantName = "Unknown";//to be used also in case of exception
         try {
             if (validateVM(rc, appName, vm_url, vm))
                 return null;
@@ -68,9 +69,10 @@ public class AttachVolumeServer extends ProviderServerOperation {
             String msg;
             context = getContext(rc, vm_url, identStr);
             if (context != null) {
+                tenantName = context.getTenantName();//this varaible also is used in case of exception
                 rc.reset();
                 server = lookupServer(rc, context, vm.getServerId());
-                logger.debug(Msg.SERVER_FOUND, vm_url, context.getTenantName(), server.getStatus().toString());
+                logger.debug(Msg.SERVER_FOUND, vm_url, tenantName, server.getStatus().toString());
                     VolumeService vs = context.getVolumeService();
                     vs.getVolumes(server);;
                     Volume vol = new Volume();
@@ -104,7 +106,7 @@ public class AttachVolumeServer extends ProviderServerOperation {
             doFailure(rc, e.getStatus(), e.getMessage());
         } catch (Exception ex) {
             String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, ex, ex.getClass().getSimpleName(),
-                    ATTACHVOLUME_SERVICE.toString(), vm_url, context == null ? "Unknown" : context.getTenantName());
+                    ATTACHVOLUME_SERVICE.toString(), vm_url, tenantName);
             logger.error(msg, ex);
             doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
         }
index 8c408c4..3dd843b 100644 (file)
@@ -68,6 +68,7 @@ public class DettachVolumeServer  extends ProviderServerOperation{
         String device = params.get(ProviderAdapter.DEVICE);
         VMURL vm = VMURL.parseURL(vm_url);
         Context context = null;
+        String tenantName = "Unknown";//to be used also in case of exception
         try {
             if (validateVM(rc, appName, vm_url, vm))
                 return null;
@@ -77,9 +78,10 @@ public class DettachVolumeServer  extends ProviderServerOperation{
             String msg;
             context = getContext(rc, vm_url, identStr);
             if (context != null) {
+                tenantName = context.getTenantName();//this varaible also is used in case of exception
                 rc.reset();
                 server = lookupServer(rc, context, vm.getServerId());
-                logger.debug(Msg.SERVER_FOUND, vm_url, context.getTenantName(), server.getStatus().toString());
+                logger.debug(Msg.SERVER_FOUND, vm_url, tenantName, server.getStatus().toString());
                 Volume vol = new Volume();
                 vol.setId(vol_id);
                 Map volms = server.getVolumes();
@@ -110,7 +112,7 @@ public class DettachVolumeServer  extends ProviderServerOperation{
             doFailure(rc, e.getStatus(), e.getMessage());
         } catch (Exception ex) {
             String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, ex, ex.getClass().getSimpleName(),
-                    ATTACHVOLUME_SERVICE.toString(), vm_url, context == null ? "Unknown" : context.getTenantName());
+                    ATTACHVOLUME_SERVICE.toString(), vm_url, tenantName);
             logger.error(msg, ex);
             doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
         }
index 73e4688..ab61a18 100644 (file)
@@ -174,12 +174,13 @@ public class EvacuateServer extends ProviderServerOperation {
             String targetHostId = params.get(ProviderAdapter.PROPERTY_TARGETHOST_ID);
 
             Context context = null;
+            String tenantName = "Unknown";//to be used also in case of exception
             try {
                 context = getContext(rc, vmUrl, identStr);
                 if (context != null) {
-
+                    tenantName = context.getTenantName();//this varaible also is used in case of exception
                     server = lookupServer(rc, context, vm.getServerId());
-                    logger.debug(Msg.SERVER_FOUND, vmUrl, context.getTenantName(), server.getStatus().toString());
+                    logger.debug(Msg.SERVER_FOUND, vmUrl, tenantName, server.getStatus().toString());
 
                     // check target host status
                     if (isComputeNodeDown(context, targetHostId)) {
@@ -268,7 +269,7 @@ public class EvacuateServer extends ProviderServerOperation {
                 doFailure(rc, e.getStatus(), e.getMessage());
             } catch (IOException | ZoneException e1) {
                 msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1, e1.getClass().getSimpleName(),
-                        Operation.EVACUATE_SERVICE.toString(), vmUrl, context == null ? "Unknown" : context.getTenantName());
+                        Operation.EVACUATE_SERVICE.toString(), vmUrl, tenantName);
                 logger.error(msg, e1);
                 metricsLogger.error(msg, e1);
                 doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
index c87dc7e..ae418d3 100644 (file)
@@ -357,12 +357,14 @@ public class RebuildServer extends ProviderServerOperation {
             ctx.setAttribute("REBUILD_STATUS", "ERROR");
 
             Context context = null;
+            String tenantName = "Unknown";//to be used also in case of exception
             try {
                 context = getContext(rc, vm_url, identStr);
                 if (context != null) {
+                    tenantName = context.getTenantName();//this varaible also is used in case of exception
                     rc.reset();
                     server = lookupServer(rc, context, vm.getServerId());
-                    logger.debug(Msg.SERVER_FOUND, vm_url, context.getTenantName(), server.getStatus().toString());
+                    logger.debug(Msg.SERVER_FOUND, vm_url, tenantName, server.getStatus().toString());
 
                     // Manually checking image service until new PAL release
                     if (hasImageAccess(rc, context)) {
@@ -391,7 +393,7 @@ public class RebuildServer extends ProviderServerOperation {
                 doFailure(rc, HttpStatus.NOT_FOUND_404, msg);
             } catch (Exception e1) {
                 msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1, e1.getClass().getSimpleName(),
-                        STOP_SERVICE.toString(), vm_url, context == null ? "Unknown" : context.getTenantName());
+                        STOP_SERVICE.toString(), vm_url, tenantName);
                 ctx.setAttribute("REBUILD_STATUS", "ERROR");
                 logger.error(msg, e1);
                 metricsLogger.error(msg);
index 18ddacf..42a3b90 100644 (file)
@@ -208,12 +208,14 @@ public class RestartServer extends ProviderServerOperation {
             String identStr = (ident == null) ? null : ident.toString();
 
             Context context = null;
+            String tenantName = "Unknown";//to be used also in case of exception
             try {
                 context = getContext(rc, vm_url, identStr);
                 if (context != null) {
+                    tenantName = context.getTenantName();//this varaible also is used in case of exception
                     rc.reset();
                     server = lookupServer(rc, context, vm.getServerId());
-                    logger.debug(Msg.SERVER_FOUND, vm_url, context.getTenantName(), server.getStatus().toString());
+                    logger.debug(Msg.SERVER_FOUND, vm_url, tenantName, server.getStatus().toString());
                     rc.reset();
                     restartServer(rc, server, ctx);
                     context.close();
@@ -232,7 +234,7 @@ public class RestartServer extends ProviderServerOperation {
             } catch (Exception e1) {
                 String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1,
                         e1.getClass().getSimpleName(), RESTART_SERVICE.toString(), vm_url,
-                        context == null ? "Unknown" : context.getTenantName());
+                        tenantName);
                 logger.error(msg, e1);
                 metricsLogger.error(msg, e1);
                 doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
index 7eeb237..218684e 100644 (file)
@@ -100,7 +100,7 @@ public class RestoreStack extends ProviderStackOperation {
 
         String vm_url = null;
         Context context = null;
-
+        String tenantName = "Unknown";//to be used also in case of exception
         try {
 
             validateParametersExist(params, ProviderAdapter.PROPERTY_INSTANCE_URL,
@@ -114,8 +114,9 @@ public class RestoreStack extends ProviderStackOperation {
             context = resolveContext(rc, params, appName, vm_url);
 
             if (context != null) {
+                tenantName = context.getTenantName();//this varaible also is used in case of exception
                 stack = lookupStack(rc, context, stackId);
-                logger.debug(Msg.STACK_FOUND, vm_url, context.getTenantName(), stack.getStatus().toString());
+                logger.debug(Msg.STACK_FOUND, vm_url, tenantName, stack.getStatus().toString());
                 logger.info(EELFResourceManager.format(Msg.TERMINATING_STACK, stack.getName()));
                 restoreStack(stack, snapshotId);
                 logger.info(EELFResourceManager.format(Msg.TERMINATE_STACK, stack.getName()));
@@ -134,7 +135,7 @@ public class RestoreStack extends ProviderStackOperation {
             doFailure(rc, e.getStatus(), e.getMessage(), e);
         } catch (Exception e1) {
             String msg = EELFResourceManager.format(Msg.STACK_OPERATION_EXCEPTION, e1, e1.getClass().getSimpleName(),
-                    "restoreStack", vm_url, null == context ? "n/a" : context.getTenantName());
+                    "restoreStack", vm_url, tenantName);
             logger.error(msg, e1);
             doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg, e1);
         }
index bf7ebc7..93f062f 100644 (file)
@@ -114,6 +114,7 @@ public class SnapshotStack extends ProviderStackOperation {
 
         String vm_url = null;
         Context context = null;
+        String tenantName = "Unknown";//to be used also in case of exception
         try {
             validateParametersExist(params, ProviderAdapter.PROPERTY_INSTANCE_URL,
                     ProviderAdapter.PROPERTY_PROVIDER_NAME, ProviderAdapter.PROPERTY_STACK_ID);
@@ -124,8 +125,9 @@ public class SnapshotStack extends ProviderStackOperation {
             context = resolveContext(rc, params, appName, vm_url);
 
             if (context != null) {
+                tenantName = context.getTenantName();//this varaible also is used in case of exception
                 stack = lookupStack(rc, context, stackId);
-                logger.debug(Msg.STACK_FOUND, vm_url, context.getTenantName(), stack.getStatus().toString());
+                logger.debug(Msg.STACK_FOUND, vm_url, tenantName, stack.getStatus().toString());
                 logger.info(EELFResourceManager.format(Msg.SNAPSHOTING_STACK, stack.getName()));
                 metricsLogger.info(EELFResourceManager.format(Msg.SNAPSHOTING_STACK, stack.getName()));
 
@@ -154,7 +156,7 @@ public class SnapshotStack extends ProviderStackOperation {
             doFailure(rc, e.getStatus(), e.getMessage(), e);
         } catch (Exception e1) {
             String msg = EELFResourceManager.format(Msg.STACK_OPERATION_EXCEPTION, e1, e1.getClass().getSimpleName(),
-                    "snapshotStack", vm_url, null == context ? "n/a" : context.getTenantName());
+                    "snapshotStack", vm_url, tenantName);
             logger.error(msg, e1);
             metricsLogger.error(msg);
             doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg, e1);
index f5d618f..ecd7bec 100644 (file)
@@ -77,13 +77,15 @@ public class StartServer extends ProviderServerOperation {
             String identStr = (ident == null) ? null : ident.toString();
 
             Context context = null;
+            String tenantName = "Unknown";//to be used also in case of exception
             ctx.setAttribute("START_STATUS", "ERROR");
             try {
                 context = getContext(rc, vm_url, identStr);
                 if (context != null) {
+                    tenantName = context.getTenantName();//this varaible also is used in case of exception
                     rc.reset();
                     server = lookupServer(rc, context, vm.getServerId());
-                    logger.debug(Msg.SERVER_FOUND, vm_url, context.getTenantName(), server.getStatus().toString());
+                    logger.debug(Msg.SERVER_FOUND, vm_url, tenantName, server.getStatus().toString());
                     String msg;
 
                     /*
@@ -163,7 +165,7 @@ public class StartServer extends ProviderServerOperation {
             } catch (Exception e1) {
                 String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1,
                         e1.getClass().getSimpleName(), START_SERVICE.toString(), vm_url,
-                        context == null ? "Unknown" : context.getTenantName());
+                        tenantName);
                 logger.error(msg, e1);
                 doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
             }
index 15adca9..6c0ed90 100644 (file)
@@ -79,13 +79,15 @@ public class StopServer extends ProviderServerOperation {
             String identStr = (ident == null) ? null : ident.toString();
 
             Context context = null;
+            String tenantName = "Unknown";//to be used also in case of exception
             ctx.setAttribute("STOP_STATUS", "ERROR");
             try {
                 context = getContext(rc, vm_url, identStr);
                 if (context != null) {
+                    tenantName = context.getTenantName();//this varaible also is used in case of exception
                     rc.reset();
                     server = lookupServer(rc, context, vm.getServerId());
-                    logger.debug(Msg.SERVER_FOUND, vm_url, context.getTenantName(), server.getStatus().toString());
+                    logger.debug(Msg.SERVER_FOUND, vm_url, tenantName, server.getStatus().toString());
 
                     String msg;
                     /*
@@ -180,7 +182,7 @@ public class StopServer extends ProviderServerOperation {
             } catch (Exception e1) {
                 String msg =
                         EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1, e1.getClass().getSimpleName(),
-                                STOP_SERVICE.toString(), vm_url, context == null ? "Unknown" : context.getTenantName());
+                                STOP_SERVICE.toString(), vm_url, tenantName);
                 logger.error(msg, e1);
                 doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
             }
index 6bd7d27..2582ed9 100644 (file)
@@ -200,11 +200,13 @@ public class TerminateServer extends ProviderServerOperation {
             String identStr = (ident == null) ? null : ident.toString();
 
             Context context = null;
+            String tenantName = "Unknown";//to be used also in case of exception
             try {
                 context = getContext(rc, vm_url, identStr);
                 if (context != null) {
+                    tenantName = context.getTenantName();//this varaible also is used in case of exception
                     server = lookupServer(rc, context, vm.getServerId());
-                    logger.debug(Msg.SERVER_FOUND, vm_url, context.getTenantName(), server.getStatus().toString());
+                    logger.debug(Msg.SERVER_FOUND, vm_url, tenantName, server.getStatus().toString());
                     logger.info(EELFResourceManager.format(Msg.TERMINATING_SERVER, server.getName()));
                     terminateServer(rc, server);
                     logger.info(EELFResourceManager.format(Msg.TERMINATE_SERVER, server.getName()));
@@ -221,7 +223,7 @@ public class TerminateServer extends ProviderServerOperation {
             } catch (Exception e1) {
                 String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1,
                         e1.getClass().getSimpleName(), RESTART_SERVICE.toString(), vm_url,
-                        context == null ? "Unknown" : context.getTenantName());
+                        tenantName);
                 logger.error(msg, e1);
                 doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
             }
index 9185e35..406d7c2 100644 (file)
@@ -80,11 +80,13 @@ public class VmStatuschecker extends ProviderServerOperation {
             String identStr = (ident == null) ? null : ident.toString();
 
             Context context = null;
+            String tenantName = "Unknown";//to be used also in case of exception
             try {
                 context = getContext(rc, vm_url, identStr);
                 if (context != null) {
+                    tenantName = context.getTenantName();//this varaible also is used in case of exception
                     server = lookupServer(rc, context, vm.getServerId());
-                    logger.debug(Msg.SERVER_FOUND, vm_url, context.getTenantName(), server.getStatus().toString());
+                    logger.debug(Msg.SERVER_FOUND, vm_url, tenantName, server.getStatus().toString());
 
                     String statusvm;
                     switch (server.getStatus()) {
@@ -138,7 +140,7 @@ public class VmStatuschecker extends ProviderServerOperation {
             } catch (Exception e1) {
                 String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1,
                         e1.getClass().getSimpleName(), RESTART_SERVICE.toString(), vm_url,
-                        context == null ? "Unknown" : context.getTenantName());
+                        tenantName);
                 logger.error(msg, e1);
                 doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
             }