summaryrefslogtreecommitdiffstats
path: root/vnfmarket-be/vnf-sdk-marketplace
diff options
context:
space:
mode:
authorGao Weitao <victor.gao@huawei.com>2019-07-03 06:15:11 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-03 06:15:11 +0000
commitebf87758a63d3ead9f5f2eceec49aac2a87cf268 (patch)
treeaae171c2a50fa794b62a3d59675597c0310d1ed2 /vnfmarket-be/vnf-sdk-marketplace
parented22fc37063dc709cd09584ddcd8ec348fa4217d (diff)
parent39ad17e19c7cf49c1b3ef475d9cf9a4fd3f1b6e8 (diff)
Merge "Sonar fix use logger"
Diffstat (limited to 'vnfmarket-be/vnf-sdk-marketplace')
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java14
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPModelBase.java5
2 files changed, 12 insertions, 7 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java
index 3ea5e410..7789e55c 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java
@@ -87,13 +87,13 @@ public final class FileUtil {
boolean isFileExist = file.exists();
if (!isFileExist) {
if (isFileDeleted) {
- logger.info("delete " + hintInfo + file.getAbsolutePath());
+ logger.info("delete {} {}" ,hintInfo, file.getAbsolutePath());
} else {
isFileDeleted = true;
- logger.info("file not exist. no need delete " + hintInfo + file.getAbsolutePath());
+ logger.info("file not exist. no need delete {} {}" ,hintInfo , file.getAbsolutePath());
}
} else {
- logger.info("fail to delete " + hintInfo + file.getAbsolutePath());
+ logger.info("fail to delete {} {} " , hintInfo , file.getAbsolutePath());
}
return isFileDeleted;
}
@@ -151,7 +151,7 @@ public final class FileUtil {
}
public static boolean writeJsonDatatoFile(String fileAbsPath, Object obj) {
- logger.info("Write JsonData to file :" + fileAbsPath);
+ logger.info("Write JsonData to file : {} " , fileAbsPath);
boolean bResult = false;
if (checkFileExists(fileAbsPath)) {
@@ -174,11 +174,11 @@ public final class FileUtil {
public static <T> Object readJsonDatafFromFile(String fileAbsPath, Class<T> clazz) {
if (!checkFileExists(fileAbsPath)) {
- logger.info("read JsonData from file , file not found :" + fileAbsPath);
+ logger.info("read JsonData from file , file not found : {}" ,fileAbsPath);
return null;
}
- logger.info("read JsonData from file :" + fileAbsPath);
+ logger.info("read JsonData from file : {}" , fileAbsPath);
T obj = null;
ObjectMapper mapper = new ObjectMapper();
@@ -246,7 +246,7 @@ public final class FileUtil {
}
if (MAX_PACKAGE_SIZE < fileData.length()) {
- logger.error("File size is greater than 50 MB", fileData.length());
+ logger.error("File size is greater than 50 MB {}", fileData.length());
return false;
}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPModelBase.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPModelBase.java
index f9ec6b5c..599fb774 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPModelBase.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPModelBase.java
@@ -16,11 +16,15 @@
package org.onap.vtp;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class VTPModelBase {
+ public static final Logger logger = LoggerFactory.getLogger(VTPModelBase.class);
+
public String toJsonString() {
return toJsonString(this);
}
@@ -32,6 +36,7 @@ public class VTPModelBase {
objectMapper.setSerializationInclusion(Include.NON_EMPTY);
return objectMapper.writeValueAsString(obj);
} catch (JsonProcessingException e) {
+ logger.error("Exception while processing json {}", e.getMessage());
return "{}";
}
}