summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarry Huang <huangxiangyu5@huawei.com>2017-09-23 17:43:59 +0800
committerHarry Huang <huangxiangyu5@huawei.com>2017-09-23 17:44:50 +0800
commite13d8ef522c0d88db2ad11407b1e2e1ee38e3743 (patch)
treef5be04ee6a38d79b8d0491ef3977a68f162794f4
parent3ba9e52591b9bc295c2e7b3721cd7123c399f534 (diff)
catch IOException inside function
major: L172 L415 Change-Id: Idf61115ba45477f66323af0423f29c6eb5b5028b Signed-off-by: Harry Huang <huangxiangyu5@huawei.com> Issue-Id: VNFSDK-85
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java35
1 files changed, 22 insertions, 13 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java
index 97b96b88..b3773c5f 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java
@@ -170,12 +170,16 @@ public class PackageWrapper {
* @throws Exception e
*/
public Response uploadPackage(InputStream uploadedInputStream,
- FormDataContentDisposition fileDetail, String details, HttpHeaders head) throws IOException, MarketplaceResourceException
+ FormDataContentDisposition fileDetail, String details, HttpHeaders head) throws MarketplaceResourceException
{
LOG.info("Upload/Reupload request Received !!!!");
-
- String packageId = MarketplaceDbUtil.generateId();
- return handlePackageUpload(packageId,uploadedInputStream, fileDetail, details, head);
+ try {
+ String packageId = MarketplaceDbUtil.generateId();
+ return handlePackageUpload(packageId,uploadedInputStream, fileDetail, details, head);
+ } catch (IOException e) {
+ LOG.error("can't get package id", e);
+ }
+ return Response.status(Status.INTERNAL_SERVER_ERROR).build();
}
/**
@@ -416,12 +420,12 @@ public class PackageWrapper {
InputStream uploadedInputStream,
FormDataContentDisposition fileDetail,
String details,
- HttpHeaders head) throws IOException, MarketplaceResourceException
+ HttpHeaders head) throws MarketplaceResourceException
{
LOG.info("Reupload request Received !!!!");
- //STEP 1: Validate Input Data
- //----------------------------
+ //STEP 1: Validate Input Data
+ //----------------------------
boolean bResult = handleDataValidate(csarId,uploadedInputStream,fileDetail);
if(!bResult)
{
@@ -429,13 +433,18 @@ public class PackageWrapper {
return Response.status(Status.EXPECTATION_FAILED).build();
}
- //STEP 2: Delete All Package Data based on package id
- //----------------------------------------------------
- deletePackageDataById(csarId);
+ try {
+ //STEP 2: Delete All Package Data based on package id
+ //----------------------------------------------------
+ deletePackageDataById(csarId);
- //STEP 3: upload package with same package id
- //-------------------------------------------
- return handlePackageUpload(csarId,uploadedInputStream, fileDetail, details, head);
+ //STEP 3: upload package with same package id
+ //-------------------------------------------
+ return handlePackageUpload(csarId,uploadedInputStream, fileDetail, details, head);
+ } catch (IOException e) {
+ LOG.error("delete package failed", e);
+ }
+ return Response.status(Status.INTERNAL_SERVER_ERROR).build();
}
/**