diff options
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.java | 14 | ||||
-rw-r--r-- | vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPModelBase.java | 5 |
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 "{}"; } } |