From 396cb378ab8940b1adb8ba1adc656d0b4ad66f99 Mon Sep 17 00:00:00 2001 From: Divesh Mirchandani Date: Thu, 14 Sep 2017 19:14:21 +0530 Subject: Fixed SONAR issues Fixed blocker, critical, major & minor SONAR issues. Issue-ID: SDC-343 Change-Id: I72e5a3a7fa7d7407a92f98f77e4334827f70f926 Signed-off-by: dd4616 --- .../sdc/action/impl/ActionManagerImpl.java | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'openecomp-be/backend/openecomp-sdc-action-manager/src/main') diff --git a/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java b/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java index 36493e2b14..f9b6bfe8a9 100644 --- a/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java @@ -694,11 +694,13 @@ public class ActionManagerImpl implements ActionManager { String artifactName = artifactMetadata.getArtifactName(); String generatedArtifactUuId = generateActionArtifactUuId(action, artifactName); if (generatedArtifactUuId.equals(artifactUuId)) { - ActionArtifactEntity artifactDeleteEntity = - new ActionArtifactEntity(artifact.getArtifactUuId(), - getEffectiveVersion(action.getVersion())); - actionLogPreProcessor(ActionSubOperation.DELETE_ACTION_ARTIFACT, TARGET_ENTITY_DB); - actionArtifactDao.delete(artifactDeleteEntity); + if (artifact != null) { + ActionArtifactEntity artifactDeleteEntity = + new ActionArtifactEntity(artifact.getArtifactUuId(), + getEffectiveVersion(action.getVersion())); + actionLogPreProcessor(ActionSubOperation.DELETE_ACTION_ARTIFACT, TARGET_ENTITY_DB); + actionArtifactDao.delete(artifactDeleteEntity); + } actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); log.metrics(""); } @@ -1041,11 +1043,11 @@ public class ActionManagerImpl implements ActionManager { action.setActionUuId(existingAction.getActionUuId()); } catch (IllegalArgumentException iae) { String message = iae.getMessage(); - switch (message) { - case VERSION_STRING_VIOLATION_MSG: - throw new ActionException(ACTION_UPDATE_NOT_ALLOWED_CODE, message); - default: - throw iae; + if(message == VERSION_STRING_VIOLATION_MSG) { + throw new ActionException(ACTION_UPDATE_NOT_ALLOWED_CODE, message); + } + else { + throw iae; } } } -- cgit 1.2.3-korg