Bugfix - Submit failed for existing VSP 55/19055/2
authorojasdubey <ojas.dubey@amdocs.com>
Mon, 16 Oct 2017 10:37:29 +0000 (16:07 +0530)
committerojasdubey <ojas.dubey@amdocs.com>
Mon, 16 Oct 2017 12:06:08 +0000 (17:36 +0530)
Added preventive null checks for
onboardingMethod attribute

Issue ID: SDC-466

Change-Id: I061b608446b895568724f71ae46c2ef8859cb600
Signed-off-by: ojasdubey <ojas.dubey@amdocs.com>
openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java

index 0a34285..1891cdd 100644 (file)
@@ -329,7 +329,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
         validateQuestionnaire(vspDetails.getId(), vspDetails.getVersion(), vspDetails
             .getOnboardingMethod()));
 
-    if (vspDetails.getOnboardingMethod().equals("Manual")) {
+    if ("Manual".equals(vspDetails.getOnboardingMethod())) {
       Collection<ErrorCode> deploymentFlavourValidationErrList =
           deploymentFlavorValidation(vspDetails.getId(), vspDetails.getVersion());
       if (validationResponse.getVspErrors() != null) {
@@ -527,7 +527,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
     if (vspDetails.getSubCategory() == null) {
       errors.add(createMissingMandatoryFieldError("sub category"));
     }
-    if (vspDetails.getOnboardingMethod().equals("Manual")) {
+    if ("Manual".equals(vspDetails.getOnboardingMethod())) {
       //Manual Onboarding specific validations
       Collection<DeploymentFlavorEntity> deploymentFlavorEntities = vendorSoftwareProductDao
           .listDeploymentFlavors(vspDetails.getId(), vspDetails.getVersion());
@@ -729,7 +729,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
     mdcDataDebugMessage.debugEntryMessage("VSP id", vspDetails.getId());
 
     VspDetails retrieved = vspInfoDao.get(vspDetails);
-    if (!retrieved.getOnboardingMethod().equals(vspDetails.getOnboardingMethod())) {
+    if (!Objects.equals(retrieved.getOnboardingMethod(), vspDetails.getOnboardingMethod())) {
       final ErrorCode onboardingMethodUpdateErrorCode = OnboardingMethodErrorBuilder
           .getOnboardingUpdateError();