From 5c50d66c0ddcc3de44ed897151ea8431550af07b Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Fri, 19 Feb 2021 16:52:51 +0000 Subject: Fix rollback during resource creation Change-Id: If4014483da98857895ebd9528c82fd337aa5ddf8 Issue-ID: SDC-3474 Signed-off-by: andre.schmid --- .../sdc/be/components/impl/ResourceBusinessLogic.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'catalog-be') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java index 8cfd8c7007..3676844516 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java @@ -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(); -- cgit 1.2.3-korg