Skip to content

Commit

Permalink
Merge pull request #332 from basil/snakeyaml
Browse files Browse the repository at this point in the history
Forward compatibility with SnakeYAML 2.0
  • Loading branch information
jtnord committed Jul 20, 2023
2 parents 5531e5f + 4ed9601 commit c61afac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;

Expand All @@ -37,7 +38,7 @@
public class Manifests {
private static final String DEFAULT_ENCODING = "UTF-8";

static Yaml yaml = new Yaml(new SafeConstructor());
static Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions()));
private List<ManifestObject> objects = new ArrayList<ManifestObject>();

/** ManifestObject wrapper that encapsulates an object spec loaded from a supplied manifest. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;

Expand Down Expand Up @@ -108,7 +109,7 @@ public void testToYamlReturnsProperly() throws Exception {
}

private static boolean yamlEquals(String expectedYaml, String testYaml) throws IOException {
Yaml yaml = new Yaml(new SafeConstructor());
Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions()));
Map<String, Object> testConfig = yaml.load(new BufferedReader(new StringReader(testYaml)));
Map<String, Object> expectedConfig =
yaml.load(new BufferedReader(new StringReader(expectedYaml)));
Expand Down

0 comments on commit c61afac

Please sign in to comment.