From: MichaelMorris Date: Tue, 31 Jan 2023 15:23:35 +0000 (+0000) Subject: Fix NPE when deleting interface operation X-Git-Tag: 1.12.2~40 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=125398fd17bc923b561998972e7106d9b5bf0165;hp=e61d26cb2a74813b526e10864af4d73f04df2650;p=sdc.git Fix NPE when deleting interface operation Signed-off-by: MichaelMorris Issue-ID: SDC-4364 Change-Id: If4072bd37e2fd361a59eb5c3e503c152c93b5d96 --- diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java index 69f7ee0f88..fa93e8b3a4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java @@ -130,8 +130,9 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { if (validateDeleteOperationContainsNoMappedOutputResponse.isRight()) { return Either.right(validateDeleteOperationContainsNoMappedOutputResponse.right().value()); } - String artifactUniqueId = storedOperation.getImplementation().getUniqueId(); - if (artifactUniqueId != null && !InterfaceOperationUtils.isArtifactInUse(storedComponent, operationId, artifactUniqueId)) { + final ArtifactDataDefinition implementation = storedOperation.getImplementation(); + if (implementation != null && implementation.getUniqueId() != null && !InterfaceOperationUtils.isArtifactInUse(storedComponent, operationId, implementation.getUniqueId())) { + final String artifactUniqueId = implementation.getUniqueId(); Either getArtifactEither = artifactToscaOperation .getArtifactById(storedComponent.getUniqueId(), artifactUniqueId); if (getArtifactEither.isLeft()) { @@ -142,7 +143,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { janusGraphDao.rollback(); ResponseFormat responseFormatByArtifactId = componentsUtils .getResponseFormatByArtifactId(componentsUtils.convertFromStorageResponse(removeArifactFromComponent.right().value()), - storedOperation.getImplementation().getArtifactDisplayName()); + implementation.getArtifactDisplayName()); return Either.right(responseFormatByArtifactId); } CassandraOperationStatus cassandraStatus = artifactCassandraDao.deleteArtifact(artifactUniqueId); @@ -150,7 +151,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { janusGraphDao.rollback(); ResponseFormat responseFormatByArtifactId = componentsUtils.getResponseFormatByArtifactId( componentsUtils.convertFromStorageResponse(componentsUtils.convertToStorageOperationStatus(cassandraStatus)), - storedOperation.getImplementation().getArtifactDisplayName()); + implementation.getArtifactDisplayName()); return Either.right(responseFormatByArtifactId); } }