diff options
2 files changed, 10 insertions, 7 deletions
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/EvacuateServer.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/EvacuateServer.java index 4715860de..cfd816e14 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/EvacuateServer.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/EvacuateServer.java @@ -8,6 +8,8 @@ * ================================================================================ * Modifications Copyright (C) 2019 Ericsson * ============================================================================= + * Modification 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. * You may obtain a copy of the License at @@ -359,7 +361,7 @@ public class EvacuateServer extends ProviderServerOperation { } private void setTimeForMetricsLogger() { - String timestamp = LoggingUtils.generateTimestampStr(((Date) new Date()).toInstant()); + String timestamp = LoggingUtils.generateTimestampStr((new Date()).toInstant()); MDC.put(LoggingConstants.MDCKeys.BEGIN_TIMESTAMP, timestamp); MDC.put(LoggingConstants.MDCKeys.END_TIMESTAMP, timestamp); MDC.put(LoggingConstants.MDCKeys.ELAPSED_TIME, "0"); diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/LookupServer.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/LookupServer.java index 3fdb76722..4ca036595 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/LookupServer.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/LookupServer.java @@ -6,6 +6,8 @@ * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= + * Modification 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. * You may obtain a copy of the License at @@ -51,7 +53,7 @@ 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"; public Server lookupServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException { Server server = null; @@ -76,14 +78,13 @@ 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; } private Server lookupServerNested(Map<String, String> params, Server server, RequestContext rqstCtx, SvcLogicContext ctx, - String appName, VMURL vm, String vmUrl) - throws APPCException { + String appName, VMURL vm, String vmUrl) { // use try with resource to ensure context is closed (returned to pool) try (Context context = resolveContext(rqstCtx, params, appName, vmUrl)) { @@ -92,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); @@ -102,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); |