summaryrefslogtreecommitdiffstats
path: root/vnfmarket-be/vnf-sdk-marketplace/src/main
diff options
context:
space:
mode:
authorArindam Mondal <arind.mondal@samsung.com>2019-06-10 17:26:09 +0900
committerarind.mondal <arind.mondal@samsung.com>2019-06-10 17:26:35 +0900
commit39ad17e19c7cf49c1b3ef475d9cf9a4fd3f1b6e8 (patch)
tree508029944852555a32531b307e9c3fa5ac61db90 /vnfmarket-be/vnf-sdk-marketplace/src/main
parent376b459da5fb1acc56ea364a5f68f4e64dc19e1c (diff)
Sonar fix use logger
+) Add logger to report exception-->VTPModelBase.java ++) Format logger-->FileUtil.java Issue-ID: VNFSDK-416 Change-Id: I6e7b13fd504aba37ca6a08119f4f0ed2674d4243 Signed-off-by: Arindam Mondal <arind.mondal@samsung.com>
Diffstat (limited to 'vnfmarket-be/vnf-sdk-marketplace/src/main')
-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 "{}";
}
}