From a1832b89823840b9fe956f01f099b6d778193e14 Mon Sep 17 00:00:00 2001 From: Jegadeesh Babu Date: Thu, 21 Mar 2019 22:18:49 +0530 Subject: Potential Null pointer exception avoided Sonar fix Issue-ID: APPC-1552 Change-Id: I8f5e6386bd96a136f49ba651aed8fb209bed9435 Signed-off-by: Jegadeesh Babu --- .../appc/adapter/iaas/provider/operation/impl/RebootServer.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main') 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; } -- cgit 1.2.3-korg