diff --git a/core/build.gradle b/core/build.gradle index af78309dff..ae435cb63e 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -170,7 +170,7 @@ dependencies { "ch.qos.logback:logback-classic:1.4.5", "ch.qos.logback:logback-access:1.4.5", 'org.json:json:20230227', - 'org.yaml:snakeyaml:1.33', + 'org.yaml:snakeyaml:2.0', 'com.github.spullara.cli-parser:cli-parser:1.1.6', 'org.apache.httpcomponents:httpclient:4.5.14', 'com.sun.mail:javax.mail:1.6.2', diff --git a/core/src/main/java/org/mapfish/print/config/ConfigurationFactory.java b/core/src/main/java/org/mapfish/print/config/ConfigurationFactory.java index 817ff53ac8..c20ff5c196 100644 --- a/core/src/main/java/org/mapfish/print/config/ConfigurationFactory.java +++ b/core/src/main/java/org/mapfish/print/config/ConfigurationFactory.java @@ -44,12 +44,8 @@ public final void init() { if (maxAliases != null) { loaderOptions.setMaxAliasesForCollections(Integer.parseInt(maxAliases)); } - Representer representer = new Representer(); DumperOptions dumperOptions = new DumperOptions(); - dumperOptions.setDefaultFlowStyle(representer.getDefaultFlowStyle()); - dumperOptions.setDefaultScalarStyle(representer.getDefaultScalarStyle()); - dumperOptions.setAllowReadOnlyProperties(representer.getPropertyUtils().isAllowReadOnlyProperties()); - dumperOptions.setTimeZone(representer.getTimeZone()); + Representer representer = new Representer(dumperOptions); this.yaml = new Yaml(constructor, representer, dumperOptions, loaderOptions); } diff --git a/core/src/main/java/org/mapfish/print/config/MapfishPrintConstructor.java b/core/src/main/java/org/mapfish/print/config/MapfishPrintConstructor.java index 409d948eb5..6319c3fd69 100644 --- a/core/src/main/java/org/mapfish/print/config/MapfishPrintConstructor.java +++ b/core/src/main/java/org/mapfish/print/config/MapfishPrintConstructor.java @@ -4,6 +4,7 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.ConfigurableApplicationContext; +import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.TypeDescription; import org.yaml.snakeyaml.constructor.Constructor; import org.yaml.snakeyaml.nodes.Node; @@ -34,7 +35,7 @@ public final class MapfishPrintConstructor extends Constructor { * @param context the application context object for creating */ public MapfishPrintConstructor(final ConfigurableApplicationContext context) { - super(new TypeDescription(Configuration.class, CONFIGURATION_TAG)); + super(new TypeDescription(Configuration.class, CONFIGURATION_TAG), new LoaderOptions()); this.context = context; Map yamlObjects = context.getBeansOfType(ConfigurationObject.class); for (Map.Entry entry: yamlObjects.entrySet()) {