Delete package from temp directory and HTTP server while parse package failed.
authornancylizi <li.zi30@zte.com.cn>
Sat, 22 Oct 2016 08:38:24 +0000 (16:38 +0800)
committernancylizi <li.zi30@zte.com.cn>
Sat, 22 Oct 2016 08:41:24 +0000 (16:41 +0800)
Change-Id: I19fad483b26e36ec8554a5319b1f4b0f616498ea
Issue-id:TOSCA-133
Signed-off-by: nancylizi <li.zi30@zte.com.cn>
catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapper.java

index 9025523..43e7091 100644 (file)
@@ -151,6 +151,11 @@ public class PackageWrapper {
           LOG.info("Package parse success ! serviceTemplateId = " + serviceTemplateId);
         } catch (Exception e1) {
           LOG.error("Parse package error ! ");
+          String packagePath = PackageWrapperUtil.getPackagePath(packageData.getCsarId());
+          FileManagerFactory.createFileManager().delete(packagePath);
+          if (tempDirName != null) {
+            ToolUtil.deleteDir(new File(tempDirName));
+          }
           PackageManager.getInstance().deletePackage(packateDbData.getCsarId());
           throw new Exception(e1);
         }