summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJegadeesh Babu <jegabab1@in.ibm.com>2019-03-21 22:18:49 +0530
committerTakamune Cho <takamune.cho@att.com>2019-03-22 19:06:29 +0000
commita1832b89823840b9fe956f01f099b6d778193e14 (patch)
tree38bbc4a2ddca6444439ba3f23b44014ecb323745
parentbe4c0dc3f795ed2feae494e20f432466f8a7e0a9 (diff)
Potential Null pointer exception avoided
Sonar fix Issue-ID: APPC-1552 Change-Id: I8f5e6386bd96a136f49ba651aed8fb209bed9435 Signed-off-by: Jegadeesh Babu <jegabab1@in.ibm.com>
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RebootServer.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RebootServer.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RebootServer.java
index 363f61455..e5d73aad0 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RebootServer.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RebootServer.java
@@ -7,6 +7,7 @@
* Copyright (C) 2017 Amdocs
* ================================================================================
* Modifications Copyright (C) 2019 Ericsson
+ * Modifications Copyright (C) 2019 IBM
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,6 +80,7 @@ public class RebootServer extends ProviderServerOperation {
rebooType = "SOFT";
}
logger.info("reboot type" + rebooType);
+ if (ctx != null) {
try {
VMURL vm = VMURL.parseURL(vmUrl);
Context context;
@@ -122,8 +124,6 @@ public class RebootServer extends ProviderServerOperation {
}
} catch (ResourceNotFoundException | StateException ex) {
- String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, ex, ex.getClass().getSimpleName(),
- REBOOT_SERVICE.toString(), vmUrl, tenantName);
ctx.setAttribute("REBOOT_STATUS", "FAILURE");
if (ex instanceof ResourceNotFoundException) {
doFailure(requestContext, HttpStatus.NOT_FOUND_404, ex.getMessage());
@@ -131,11 +131,10 @@ public class RebootServer extends ProviderServerOperation {
doFailure(requestContext, HttpStatus.CONFLICT_409, ex.getMessage());
}
} catch (Exception ex) {
- String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, ex, ex.getClass().getSimpleName(),
- REBOOT_SERVICE.toString(), vmUrl, tenantName);
ctx.setAttribute("REBOOT_STATUS", "FAILURE");
doFailure(requestContext, HttpStatus.INTERNAL_SERVER_ERROR_500, ex.getMessage());
}
+ }
return server;
}