Upgrade to snakeyaml 2.0

This has some API changes.  Closes #169.
This commit is contained in:
Andrew Gaul 2023-04-16 16:27:38 +09:00 committed by Andrew Gaul
parent 788f75f937
commit f82e94c337
3 changed files with 5 additions and 3 deletions

View File

@ -70,7 +70,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.32</version>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.google.auto.service</groupId>

View File

@ -25,6 +25,7 @@ import java.util.Map;
import org.jclouds.byon.Node;
import org.jclouds.util.Closeables2;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
@ -111,7 +112,7 @@ public class YamlNode {
InputStream in = null;
try {
in = byteSource.openStream();
return (YamlNode) new Yaml(new Constructor(YamlNode.class)).load(in);
return (YamlNode) new Yaml(new Constructor(YamlNode.class, new LoaderOptions())).load(in);
} catch (IOException ioe) {
throw Throwables.propagate(ioe);
} finally {

View File

@ -29,6 +29,7 @@ import javax.inject.Singleton;
import org.jclouds.byon.Node;
import org.jclouds.byon.domain.YamlNode;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.TypeDescription;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
@ -80,7 +81,7 @@ public class NodesFromYamlStream implements Function<ByteSource, LoadingCache<St
@Override
public LoadingCache<String, Node> apply(ByteSource source) {
Constructor constructor = new Constructor(Config.class);
Constructor constructor = new Constructor(Config.class, new LoaderOptions());
TypeDescription nodeDesc = new TypeDescription(YamlNode.class);
nodeDesc.putListPropertyType("tags", String.class);