Upgrade to SnakeYAML 2.0

Closes gh-35982
This commit is contained in:
Andy Wilkinson 2023-06-19 12:16:49 +01:00
parent a94ac2fb44
commit 1f9ce508f7
4 changed files with 14 additions and 32 deletions

View File

@ -1375,7 +1375,7 @@ bom {
]
}
}
library("SnakeYAML", "1.33") {
library("SnakeYAML", "2.0") {
group("org.yaml") {
modules = [
"snakeyaml"

View File

@ -17,6 +17,17 @@ configurations {
remoteSpringApplicationExample
springApplicationExample
testSlices
asciidoctorExtensions {
resolutionStrategy {
eachDependency { dependency ->
// Downgrade SnakeYAML as Asciidoctor fails due to an incompatibility
// in the Pysch gem
if (dependency.requested.group.equals("org.yaml")) {
dependency.useVersion("1.33")
}
}
}
}
}
jar {

View File

@ -23,7 +23,7 @@ import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.yaml.snakeyaml.constructor.ConstructorException;
import org.yaml.snakeyaml.composer.ComposerException;
import org.springframework.boot.origin.OriginTrackedValue;
import org.springframework.boot.origin.TextResourceOrigin;
@ -134,7 +134,7 @@ class OriginTrackedYamlLoaderTests {
String yaml = "value: !!java.net.URL [!!java.lang.String [!!java.lang.StringBuilder [\"http://localhost:9000/\"]]]";
Resource resource = new ByteArrayResource(yaml.getBytes(StandardCharsets.UTF_8));
this.loader = new OriginTrackedYamlLoader(resource);
assertThatExceptionOfType(ConstructorException.class).isThrownBy(this.loader::load);
assertThatExceptionOfType(ComposerException.class).isThrownBy(this.loader::load);
}
@Test

View File

@ -1,29 +0,0 @@
/*
* Copyright 2012-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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.env;
import org.springframework.boot.testsupport.classpath.ClassPathOverrides;
/**
* Tests for {@link YamlPropertySourceLoader} with SnakeYAML 2.0.
*
* @author Andy Wilkinson
*/
@ClassPathOverrides("org.yaml:snakeyaml:2.0")
class YamlPropertySourceLoaderSnakeYaml20Tests extends YamlPropertySourceLoaderTests {
}