summaryrefslogtreecommitdiffstats
path: root/vnfmarket-be
diff options
context:
space:
mode:
authorMurali Mohan Murthy Potham <murali.p@huawei.com>2017-09-23 10:41:42 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-23 10:41:42 +0000
commit9d433d0d8cb7dd510c3bf3250f9a1b2df72ead05 (patch)
tree9969d34256d04e0163300cac8e430896880713e2 /vnfmarket-be
parentf4d85387b5e7a5d6699f4f24a25cd5bcba558211 (diff)
parente13d8ef522c0d88db2ad11407b1e2e1ee38e3743 (diff)
Merge "catch IOException inside function"
Diffstat (limited to 'vnfmarket-be')
-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();
}
/**