Fix rollback during resource creation 90/118390/4
authorandre.schmid <andre.schmid@est.tech>
Fri, 19 Feb 2021 16:52:51 +0000 (16:52 +0000)
committerChristophe Closset <christophe.closset@intl.att.com>
Thu, 25 Feb 2021 13:27:05 +0000 (13:27 +0000)
Change-Id: If4014483da98857895ebd9528c82fd337aa5ddf8
Issue-ID: SDC-3474
Signed-off-by: andre.schmid <andre.schmid@est.tech>
catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java

index 8cfd8c7..3676844 100644 (file)
@@ -149,7 +149,6 @@ import org.openecomp.sdc.be.model.category.CategoryDefinition;
 import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
 import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations;
 import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation;
-import org.openecomp.sdc.be.model.jsonjanusgraph.operations.exception.ToscaOperationException;
 import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
 import org.openecomp.sdc.be.model.operations.StorageException;
 import org.openecomp.sdc.be.model.operations.api.ICapabilityTypeOperation;
@@ -1745,19 +1744,16 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        ASDCKpiApi.countCreatedResourcesKPI();
                        return resource;
 
-        } catch (final ComponentException | StorageException e) {
-            rollback(inTransaction, resource, createdArtifacts, nodeTypesNewCreatedArtifacts);
-            throw e;
-        } catch (final ToscaOperationException e) {
-            log.error("An error has occurred during resource and resource instance creation", e);
-            rollback(inTransaction, resource, createdArtifacts, nodeTypesNewCreatedArtifacts);
-            log.error(EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR, ResourceBusinessLogic.class.getName(),
-                               "catalog-be", e.getMessage());
-            throw new ByActionStatusComponentException(ActionStatus.GENERAL_ERROR);
         } catch (final BusinessLogicException e) {
-            log.error("An error has occurred during resource and resource instance creation", e);
+                       log.error(EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR, ResourceBusinessLogic.class.getName(),
+                               "An error has occurred during resource and resource instance creation", e);
             rollback(inTransaction, resource, createdArtifacts, nodeTypesNewCreatedArtifacts);
             throw new ByResponseFormatComponentException(e.getResponseFormat());
+        } catch (final Exception e) {
+                       log.error(EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR, ResourceBusinessLogic.class.getName(),
+                               "An error has occurred during resource and resource instance creation", e);
+                       rollback(inTransaction, resource, createdArtifacts, nodeTypesNewCreatedArtifacts);
+                       throw new ByActionStatusComponentException(ActionStatus.GENERAL_ERROR);
         } finally {
             if (!inTransaction) {
                 janusGraphDao.commit();