Polish SnakeYAML 2.0 upgrade

See gh-30048
This commit is contained in:
Brian Clozel 2023-05-22 14:52:59 +02:00
parent 097758baf3
commit 40543e0a58
3 changed files with 12 additions and 11 deletions

View File

@ -64,7 +64,7 @@ import org.springframework.lang.Nullable;
* Note that the value of "foo" in the first document is not simply replaced * Note that the value of "foo" in the first document is not simply replaced
* with the value in the second, but its nested values are merged. * with the value in the second, but its nested values are merged.
* *
* <p>Requires SnakeYAML 1.18 or higher, as of Spring Framework 5.0.6. * <p>Requires SnakeYAML 2.0 or higher, as of Spring Framework 6.1.0.
* *
* @author Dave Syer * @author Dave Syer
* @author Juergen Hoeller * @author Juergen Hoeller

View File

@ -33,6 +33,7 @@ import org.apache.commons.logging.LogFactory;
import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.composer.ComposerException;
import org.yaml.snakeyaml.constructor.Constructor; import org.yaml.snakeyaml.constructor.Constructor;
import org.yaml.snakeyaml.inspector.TagInspector; import org.yaml.snakeyaml.inspector.TagInspector;
import org.yaml.snakeyaml.nodes.Tag; import org.yaml.snakeyaml.nodes.Tag;
@ -49,7 +50,7 @@ import org.springframework.util.StringUtils;
/** /**
* Base class for YAML factories. * Base class for YAML factories.
* *
* <p>Requires SnakeYAML 1.18 or higher, as of Spring Framework 5.0.6. * <p>Requires SnakeYAML 2.0 or higher, as of Spring Framework 6.1.0.
* *
* @author Dave Syer * @author Dave Syer
* @author Juergen Hoeller * @author Juergen Hoeller
@ -134,7 +135,7 @@ public abstract class YamlProcessor {
* <p>If no supported types are configured, only Java standard classes * <p>If no supported types are configured, only Java standard classes
* (as defined in {@link org.yaml.snakeyaml.constructor.SafeConstructor}) * (as defined in {@link org.yaml.snakeyaml.constructor.SafeConstructor})
* encountered in YAML documents will be supported. * encountered in YAML documents will be supported.
* If an unsupported type is encountered, an {@link IllegalStateException} * If an unsupported type is encountered, an {@link ComposerException}
* will be thrown when the corresponding YAML node is processed. * will be thrown when the corresponding YAML node is processed.
* @param supportedTypes the supported types, or an empty array to clear the * @param supportedTypes the supported types, or an empty array to clear the
* supported types * supported types
@ -175,12 +176,12 @@ public abstract class YamlProcessor {
/** /**
* Create the {@link Yaml} instance to use. * Create the {@link Yaml} instance to use.
* <p>The default implementation sets the "allowDuplicateKeys" flag to {@code false}, * <p>The default implementation sets the "allowDuplicateKeys" flag to {@code false},
* enabling built-in duplicate key handling in SnakeYAML 1.18+. * enabling built-in duplicate key handling.
* <p>As of Spring Framework 5.1.16, if custom {@linkplain #setSupportedTypes * <p>If custom {@linkplain #setSupportedTypes supported types} have been configured,
* supported types} have been configured, the default implementation creates * the default implementation creates a {@code Yaml} instance that filters out
* a {@code Yaml} instance that filters out unsupported types encountered in * unsupported types encountered in YAML documents.
* YAML documents. If an unsupported type is encountered, an * If an unsupported type is encountered, an {@link ComposerException} will be
* {@link IllegalStateException} will be thrown when the node is processed. * thrown when the node is processed.
* @see LoaderOptions#setAllowDuplicateKeys(boolean) * @see LoaderOptions#setAllowDuplicateKeys(boolean)
*/ */
protected Yaml createYaml() { protected Yaml createYaml() {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2023 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -74,7 +74,7 @@ import org.springframework.lang.Nullable;
* servers[1]=foo.bar.com * servers[1]=foo.bar.com
* </pre> * </pre>
* *
* <p>Requires SnakeYAML 1.18 or higher, as of Spring Framework 5.0.6. * <p>Requires SnakeYAML 2.0 or higher, as of Spring Framework 6.1.0.
* *
* @author Dave Syer * @author Dave Syer
* @author Stephane Nicoll * @author Stephane Nicoll