summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java/org
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2022-05-26 09:41:11 +0100
committerAndr� Schmid <andre.schmid@est.tech>2022-05-27 11:35:18 +0000
commit577c692dc7a78d19c5bcecdf0387bbabc1dadcd6 (patch)
tree1b83c5dc042c4066f1816bf8a801cbec1426b69c /catalog-be/src/main/java/org
parentf9c261d6349d53b30ba12c7a3db755ba8c31d2f6 (diff)
Fix error handling valid yaml property values
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-4022 Change-Id: Ic30f29e350d47d29c00744271e1e81b08db3edb9
Diffstat (limited to 'catalog-be/src/main/java/org')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PropertyConvertor.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PropertyConvertor.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PropertyConvertor.java
index 5d3fe1bf77..5bb3d116f8 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PropertyConvertor.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PropertyConvertor.java
@@ -21,6 +21,7 @@ package org.openecomp.sdc.be.tosca;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
+import com.google.gson.JsonParseException;
import com.google.gson.JsonParser;
import com.google.gson.stream.JsonReader;
import fj.data.Either;
@@ -48,6 +49,7 @@ import org.openecomp.sdc.be.tosca.model.ToscaSchemaDefinition;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.tosca.datatypes.ToscaFunctions;
import org.springframework.stereotype.Service;
+import org.yaml.snakeyaml.Yaml;
@Service
public class PropertyConvertor {
@@ -176,6 +178,10 @@ public class PropertyConvertor {
.convertDataTypeToToscaObject(innerType, dataTypes, innerConverter, isScalar, jsonElement, preserveEmptyValue);
}
return convertedValue;
+
+ } catch (JsonParseException e) {
+ log.trace("{} not parsable as JSON. Convert as YAML instead", value);
+ return new Yaml().load(value);
} catch (Exception e) {
log.debug("convertToToscaValue failed to parse json value :", e);
return null;