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
* 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 Juergen Hoeller

View File

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