Skip to content

Commit

Permalink
Merge pull request #217 from basil/snakeyaml
Browse files Browse the repository at this point in the history
Forward compatibility with SnakeYAML 2.0
  • Loading branch information
rsandell authored Jun 1, 2023
2 parents 4fe812c + 1d3024a commit 85c638d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,18 @@ protected Yaml newYaml() {
//Need everything just to be able to specify constructor and LoaderOptions
LoaderOptions loaderOptions = new LoaderOptions();
loaderOptions.setMaxAliasesForCollections(maxAliasesForCollections);
Representer representer = new Representer();
Representer representer = new Representer(new DumperOptions());
//The Yaml constructors does this internally, so just in case...
DumperOptions dumperOptions = new DumperOptions();
dumperOptions.setDefaultFlowStyle(representer.getDefaultFlowStyle());
dumperOptions.setDefaultScalarStyle(representer.getDefaultScalarStyle());
dumperOptions.setAllowReadOnlyProperties(representer.getPropertyUtils().isAllowReadOnlyProperties());
dumperOptions.setTimeZone(representer.getTimeZone());
// Use SafeConstructor to limit objects to standard Java objects like List or Long
return new Yaml(new SafeConstructor(), representer, dumperOptions, loaderOptions);
return new Yaml(new SafeConstructor(new LoaderOptions()), representer, dumperOptions, loaderOptions);
} else {
// Use SafeConstructor to limit objects to standard Java objects like List or Long
return new Yaml(new SafeConstructor());
return new Yaml(new SafeConstructor(new LoaderOptions()));
}
}
}
Expand Down

0 comments on commit 85c638d

Please sign in to comment.