From 41f765bacfbf65230234e0318d75c09aabc26b7e Mon Sep 17 00:00:00 2001 From: dinesha Date: Wed, 31 Jul 2019 14:40:52 +0530 Subject: Sonar Fix- ProviderOperation.java Fixed Sonar Issues accross the file Issue-ID: APPC-1669 Change-Id: Idccc7e133a93f0af8d2352473d95f755f39f1ae7 Signed-off-by: dinesha --- .../iaas/provider/operation/impl/base/ProviderOperation.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/base/ProviderOperation.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/base/ProviderOperation.java index 7c16cb5cd..fc60f686a 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/base/ProviderOperation.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/base/ProviderOperation.java @@ -61,6 +61,7 @@ import org.slf4j.MDC; public abstract class ProviderOperation implements IProviderOperation { + private static final String palos = "PALOS"; private static final EELFLogger logger = EELFManager.getInstance().getLogger(ProviderOperation.class); protected static final Configuration configuration = ConfigurationFactory.getConfiguration(); @@ -209,9 +210,9 @@ public abstract class ProviderOperation implements IProviderOperation { protected void doFailure(RequestContext rc, HttpStatus code, String message, Throwable cause) throws APPCException { SvcLogicContext svcLogic = rc.getSvcLogicContext(); String msg = (message == null) ? code.getReasonPhrase() : message; - if ((msg.contains("PALOS"))) { - msg = msg.substring(msg.indexOf("PALOS"), msg.length()); - msg = msg.substring(msg.indexOf("PALOS"), msg.indexOf("\n")); + if ((msg.contains(palos))) { + msg = msg.substring(msg.indexOf(palos), msg.length()); + msg = msg.substring(msg.indexOf(palos), msg.indexOf("\n")); } else { if (msg.contains("\n")) { msg = msg.substring(0, msg.indexOf('\n')); -- cgit 1.2.3-korg