summaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-adapter-utils/src/main/java')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java6
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java20
2 files changed, 18 insertions, 8 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
index f50a6fd1bd..97e1627fd3 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
@@ -1047,7 +1047,11 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
}
} else if (type.equalsIgnoreCase("json")) {
try {
- return JSON_MAPPER.writeValueAsString(inputValue);
+ if (inputValue instanceof String) {
+ return JSON_MAPPER.readTree(inputValue.toString());
+ }
+ //will already marshal to json without intervention
+ return inputValue;
}
catch (Exception e) {
logger.debug("Unable to convert {} to a JsonNode!", inputValue);
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index a0fbd485d1..012c560689 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -38,6 +38,8 @@ import com.woorea.openstack.keystone.Keystone;
import com.woorea.openstack.keystone.model.Access;
import com.woorea.openstack.keystone.model.Authentication;
import com.woorea.openstack.keystone.utils.KeystoneUtils;
+
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@@ -1356,18 +1358,22 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
}
} else if ("json".equalsIgnoreCase(type)) {
Object jsonObj = inputs.get(key);
- String jsonString;
+ Object json;
try {
- jsonString = JSON_MAPPER.writeValueAsString(jsonObj);
- } catch (JsonProcessingException e) {
+ if (jsonObj instanceof String) {
+ json = JSON_MAPPER.readTree(jsonObj.toString());
+ } else {
+ //will already marshal to json without intervention
+ json = jsonObj;
+ }
+ } catch (IOException e) {
logger.error("failed to map to json, directly converting to string instead", e);
- jsonString = jsonObj.toString();
+ json = jsonObj.toString();
}
if (alias)
- newInputs.put(realName, jsonString);
+ newInputs.put(realName, json);
else
- newInputs.put(key, jsonString);
- //}
+ newInputs.put(key, json);
} else if ("comma_delimited_list".equalsIgnoreCase(type)) {
String commaSeparated = inputs.get(key).toString();
try {