diff options
author | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2019-10-04 14:42:10 +0200 |
---|---|---|
committer | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2019-10-04 14:43:43 +0200 |
commit | fc898de560ab3a62ced5a67b719b6f071e0b5866 (patch) | |
tree | 97d4b87eba84631783d6d2b70a9bcce93da772ac /bpmn/so-bpmn-tasks/src/main/java | |
parent | 8fee4fd7a88ec025e142bafa50cc7e0dc8610b0d (diff) |
bug fix with wrong json handling in ConfigAssignVnf
Change-Id: Ib1a51a69bf421e33e439da6f1cb0abafd760cca2
Issue-ID: SO-2382
Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java index 9413e8ef2e..e73a504291 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java @@ -124,12 +124,14 @@ public class ConfigAssignVnf { private Service getServiceFromRequestUserParams(List<Map<String, Object>> userParams) throws Exception { Map<String, Object> serviceMap = userParams.stream().filter(key -> key.containsKey("service")).findFirst() .orElseThrow(() -> new Exception("Can not find service in userParams section in generalBuildingBlock")); - return convertServiceFromJsonToServiceObject((String) serviceMap.get("service")); + return getServiceObjectFromServiceMap(serviceMap); } - private Service convertServiceFromJsonToServiceObject(String serviceFromJson) throws Exception { + private Service getServiceObjectFromServiceMap(Map<String, Object> serviceMap) throws Exception { + ObjectMapper objectMapper = new ObjectMapper(); + String serviceFromJson = objectMapper.writeValueAsString(serviceMap.get("service")); try { - return new ObjectMapper().readValue(serviceFromJson, Service.class); + return objectMapper.readValue(serviceFromJson, Service.class); } catch (Exception e) { logger.error(String.format( "An exception occurred while converting json object to Service object. The json is: %s", @@ -150,5 +152,4 @@ public class ConfigAssignVnf { genericVnfModelCustomizationUuid)); } } - } |