aboutsummaryrefslogtreecommitdiffstats
path: root/common/src/main
diff options
context:
space:
mode:
authorrob.bog <r.bogacki@samsung.com>2019-05-28 13:18:24 +0200
committerr.bogacki <r.bogacki@samsung.com>2019-06-03 12:26:59 +0200
commita2df406852f02374c81afc8231639c7cb482f10e (patch)
tree17c234a0b796217b0abb554d291364b400e9b26b /common/src/main
parent1640ac602723737c8f15a9a84046e709f7230a1c (diff)
Cleaned up duplicated literals
Cleaned up Sonar code smells related to the duplicated literals in loggers. Issue-ID: SO-1932 Signed-off-by: Robert Bogacki <r.bogacki@samsung.com> Change-Id: I58c48cec0012c42b7b892ae76c24c6a087c60c7e
Diffstat (limited to 'common/src/main')
-rw-r--r--common/src/main/java/org/onap/so/utils/CryptoUtils.java5
-rw-r--r--common/src/main/java/org/onap/so/utils/UUIDChecker.java3
-rw-r--r--common/src/main/java/org/onap/so/utils/XmlMarshaller.java9
3 files changed, 10 insertions, 7 deletions
diff --git a/common/src/main/java/org/onap/so/utils/CryptoUtils.java b/common/src/main/java/org/onap/so/utils/CryptoUtils.java
index 09b48d266f..f42fc0111f 100644
--- a/common/src/main/java/org/onap/so/utils/CryptoUtils.java
+++ b/common/src/main/java/org/onap/so/utils/CryptoUtils.java
@@ -23,6 +23,7 @@
package org.onap.so.utils;
+import com.google.common.base.Strings;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -89,7 +90,7 @@ public final class CryptoUtils {
try {
return CryptoUtils.encrypt(message, CLOUD_KEY);
} catch (GeneralSecurityException e) {
- logger.error("{} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_GENERAL_EXCEPTION.toString(),
ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e);
return null;
}
@@ -99,7 +100,7 @@ public final class CryptoUtils {
try {
return CryptoUtils.decrypt(message, CLOUD_KEY);
} catch (GeneralSecurityException e) {
- logger.error("{} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_GENERAL_EXCEPTION.toString(),
ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e);
return null;
}
diff --git a/common/src/main/java/org/onap/so/utils/UUIDChecker.java b/common/src/main/java/org/onap/so/utils/UUIDChecker.java
index 585ffcc7c4..6a95334696 100644
--- a/common/src/main/java/org/onap/so/utils/UUIDChecker.java
+++ b/common/src/main/java/org/onap/so/utils/UUIDChecker.java
@@ -24,6 +24,7 @@
package org.onap.so.utils;
import java.util.UUID;
+import com.google.common.base.Strings;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,7 +52,7 @@ public class UUIDChecker {
public static String getUUID() {
String result = UUID.randomUUID().toString();
- logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID, result);
+ logger.info(Strings.repeat("{} ", 2), MessageEnum.APIH_GENERATED_REQUEST_ID, result);
return result;
}
}
diff --git a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
index 0022ecbb96..e6acb87eaa 100644
--- a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
+++ b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
@@ -32,6 +32,7 @@ import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.sax.SAXSource;
+import com.google.common.base.Strings;
import org.onap.so.exceptions.MarshallerException;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
@@ -52,8 +53,8 @@ public class XmlMarshaller {
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.marshal(object, stringWriter);
} catch (JAXBException e) {
- logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(),
- e.getMessage(), e);
+ logger.error(Strings.repeat("{} ", 3), MessageEnum.GENERAL_EXCEPTION.toString(),
+ ErrorCode.SchemaError.getValue(), e.getMessage(), e);
throw new MarshallerException(e.getMessage(), ErrorCode.SchemaError.getValue(), e);
}
@@ -77,8 +78,8 @@ public class XmlMarshaller {
SAXSource source = new SAXSource(xmlReader, inputSource);
object = jaxbUnmarshaller.unmarshal(source, object.getClass()).getValue();
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(),
- e.getMessage(), e);
+ logger.error(Strings.repeat("{} ", 3), MessageEnum.GENERAL_EXCEPTION.toString(),
+ ErrorCode.SchemaError.getValue(), e.getMessage(), e);
throw new MarshallerException(e.getMessage(), ErrorCode.SchemaError.getValue(), e);
}