From fe2c0d11986a49aed5cb578f5aea227e4d34b1de Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Mon, 27 Aug 2018 02:54:34 +0530 Subject: fixed sonar issues in MsoRequestsDbAdapterImpl fixed sonar issue: Define a constant instead of duplicating literal 3 times. Issue-ID: SO-913 Change-Id: I12e2d60d9841cf3600ac7e4c822027c9af19c3b6 Signed-off-by: Sandeep J --- .../onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java index 2f6a5839b7..d0eae88c9e 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 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,6 +53,8 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { private static final String SUCCESSFUL = "Successful"; private static final String GET_INFRA_REQUEST = "Get Infra request"; + + private static final String ERROR = "Error "; private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, MsoRequestsDbAdapterImpl.class); @@ -131,7 +135,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { } catch (Exception e) { String error = "Error retrieving MSO Infra Requests DB for Request ID " + requestId; - logger.error("Error " + MsoLogger.ErrorCode.BusinessProcesssError + " for " + GET_INFRA_REQUEST + " - " + MessageEnum.RA_DB_REQUEST_NOT_EXIST + " - " + error, e); + logger.error(ERROR + MsoLogger.ErrorCode.BusinessProcesssError + " for " + GET_INFRA_REQUEST + " - " + MessageEnum.RA_DB_REQUEST_NOT_EXIST + " - " + error, e); logger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, error); throw new MsoRequestsDbException(error, e); } @@ -165,7 +169,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { } } catch (Exception e) { String error = "Error retrieving MSO Infra Requests DB for Request ID " + requestId; - logger.error("Error " + MsoLogger.ErrorCode.BusinessProcesssError + " for " + GET_INFRA_REQUEST + " - " + MessageEnum.RA_DB_REQUEST_NOT_EXIST + " - " + error, e); + logger.error(ERROR + MsoLogger.ErrorCode.BusinessProcesssError + " for " + GET_INFRA_REQUEST + " - " + MessageEnum.RA_DB_REQUEST_NOT_EXIST + " - " + error, e); logger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, error); throw new MsoRequestsDbException(error, e); } @@ -223,7 +227,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { String error = "Entity not found. Unable to retrieve OperationStatus Object ServiceId: " + serviceId + " operationId: " + operationId; MsoRequestsDbException e = new MsoRequestsDbException(error); - logger.error("Error "+ MsoLogger.ErrorCode.BusinessProcesssError + " - " + MessageEnum.RA_DB_REQUEST_NOT_EXIST + " - " + error, e); + logger.error(ERROR+ MsoLogger.ErrorCode.BusinessProcesssError + " - " + MessageEnum.RA_DB_REQUEST_NOT_EXIST + " - " + error, e); throw e; } -- cgit 1.2.3-korg