productFamilyId not found error catching 91/19591/1
authorArthur Martella <amartell@research.att.com>
Wed, 18 Oct 2017 19:22:26 +0000 (15:22 -0400)
committerArthur Martella <amartell@research.att.com>
Wed, 18 Oct 2017 19:24:25 +0000 (15:24 -0400)
Properly catch JsonException in case when productFamilyId is not present to let if block handle case where it's missing.

Change-Id: Id6eb2aaf10bc8636470ced3fe96c1149bb7e905e
Issue-id: SO-236
Signed-off-by: Arthur Martella <amartell@research.att.com>
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy

index 9416e68..80d7148 100644 (file)
@@ -37,6 +37,7 @@ import org.camunda.bpm.engine.runtime.Execution
 import org.apache.commons.lang3.*
 import org.apache.commons.codec.binary.Base64;
 import org.springframework.web.util.UriUtils
+import org.json.JSONException;
 
 /**
  * This groovy class supports the <class>CreateGenericALaCarteServiceInstance.bpmn</class> process.
@@ -85,7 +86,12 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
                        execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source"))
                        execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName"))
                        execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback"))
-                       String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId")
+                       String productFamilyId = null;
+                       try { 
+                               productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId")
+                       } catch (JSONException e) {
+                               productFamilyId = null;
+                       }
                        if (isBlank(productFamilyId))
                        {
                                msg = "Input productFamilyId is null"