From f48e46c31a7ea43739d8608aca17fd53b486fff6 Mon Sep 17 00:00:00 2001
From: nancylizi
Date: Mon, 28 Nov 2016 11:32:10 +0800
Subject: Modify the error message when basicInfo is null.
Change-Id: Ia40a670e678369a8f920a7d5b1b9298c1c7e7a6f
Issue-id:TOSCA-194
Signed-off-by: nancylizi
---
.../java/org/openo/commontosca/catalog/wrapper/PackageWrapper.java | 6 ++++++
.../org/openo/commontosca/catalog/wrapper/PackageWrapperUtil.java | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
(limited to 'catalog-core/catalog-mgr/src')
diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapper.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapper.java
index 4cf64d30..cf879d95 100644
--- a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapper.java
+++ b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapper.java
@@ -124,6 +124,12 @@ public class PackageWrapper {
if (isEnd) {
PackageBasicInfo basicInfo = new PackageBasicInfo();
basicInfo = PackageWrapperUtil.getPacageBasicInfo(fileLocation);
+ if (null == basicInfo.getType() || null == basicInfo.getProvider()
+ || null == basicInfo.getVersion()) {
+ LOG.error(
+ "Package basicInfo is incorrect ! basicIonfo = " + ToolUtil.objectToString(basicInfo));
+ return Response.serverError().build();
+ }
String path =
basicInfo.getType().toString() + File.separator + basicInfo.getProvider() + File.separator
+ fileName.replace(".csar", "") + File.separator + basicInfo.getVersion();
diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapperUtil.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapperUtil.java
index 3a286cd3..3e494e20 100644
--- a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapperUtil.java
+++ b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapperUtil.java
@@ -389,7 +389,7 @@ public class PackageWrapperUtil {
}
}
} catch (IOException e1) {
- LOG.error("judge package type error !");
+ LOG.error("judge package type error ! " + e1.getMessage());
}
if (isXmlCsar) {
basicInfo.setFormat(CommonConstant.PACKAGE_XML_FORMAT);
--
cgit 1.2.3-korg