aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-vfc-adapter/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 /adapters/mso-vfc-adapter/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 'adapters/mso-vfc-adapter/src/main')
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java13
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java5
2 files changed, 10 insertions, 8 deletions
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
index cefaadbb63..efc0a303c0 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
@@ -24,6 +24,7 @@
package org.onap.so.adapters.vfc.util;
import java.io.IOException;
+import com.google.common.base.Strings;
import org.onap.so.adapters.vfc.constant.HttpCode;
import org.onap.so.adapters.vfc.exceptions.ApplicationException;
import org.onap.so.logger.ErrorCode;
@@ -83,8 +84,8 @@ public class JsonUtil {
try {
return MAPPER.readValue(jsonstr, type);
} catch (IOException e) {
- logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(),
- UNMARSHAL_FAIL_MSG, e);
+ logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NS_EXC.toString(),
+ ErrorCode.BusinessProcesssError.getValue(), UNMARSHAL_FAIL_MSG, e);
throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG);
}
}
@@ -101,8 +102,8 @@ public class JsonUtil {
try {
return MAPPER.readValue(jsonstr, type);
} catch (IOException e) {
- logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(),
- UNMARSHAL_FAIL_MSG, e);
+ logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NS_EXC.toString(),
+ ErrorCode.BusinessProcesssError.getValue(), UNMARSHAL_FAIL_MSG, e);
throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG);
}
}
@@ -118,8 +119,8 @@ public class JsonUtil {
try {
return MAPPER.writeValueAsString(srcObj);
} catch (IOException e) {
- logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(),
- "fail to marshal json", e);
+ logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NS_EXC.toString(),
+ ErrorCode.BusinessProcesssError.getValue(), "fail to marshal json", e);
throw new ApplicationException(HttpCode.BAD_REQUEST, "srcObj marshal failed!");
}
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
index 1e61d4deb2..a84785bcad 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
@@ -27,6 +27,7 @@ package org.onap.so.adapters.vfc.util;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
import javax.ws.rs.core.UriBuilder;
+import com.google.common.base.Strings;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
@@ -194,12 +195,12 @@ public class RestfulUtil {
}
private static void logError(String errMsg, Throwable t) {
- logger.error("{} {} {} {}", MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
ErrorCode.AvailabilityError.getValue(), errMsg, t);
}
private static void logError(String errMsg) {
- logger.error("{} {} {} {}", MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
ErrorCode.AvailabilityError.toString(), errMsg);
}