summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
authoreschcam <cameron.scholes@est.tech>2023-04-17 17:13:01 +0100
committerMichael Morris <michael.morris@est.tech>2023-05-30 14:40:38 +0000
commitc2942fe4f0d079874e8bafaf5302df5df307df79 (patch)
tree4dac55caa262fb1525e0ab3a512d38d8d5f7ccd5 /catalog-be/src/main
parentc176abb79ebc5b35d340258ba1bdbfa2939e103a (diff)
Fix certain default values breaking VFC
For string default values in VFC, only alphanumeric characters should be allowed Issue-ID: SDC-4475 Signed-off-by: eschcam <cameron.scholes@est.tech> Change-Id: Id4ca2943f1423b8cc7d3182254298ba19c8a7ee3
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PropertyConvertor.java9
1 files changed, 8 insertions, 1 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 bb89d99b2e..734b5ac7be 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
@@ -79,6 +79,7 @@ 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;
+import org.yaml.snakeyaml.scanner.ScannerException;
@Service
public class PropertyConvertor {
@@ -321,7 +322,13 @@ public class PropertyConvertor {
} catch (JsonParseException e) {
log.trace("{} not parsable as JSON. Convert as YAML instead", value);
- return new Yaml().load(value);
+ try {
+ return new Yaml().load(value);
+ } catch (ScannerException ex) {
+ log.trace("{} not parsable as YAML. Returning as string", value);
+ return value;
+ }
+
} catch (Exception e) {
log.debug("convertToToscaValue failed to parse json value :", e);
return null;