Merge branch '2.0.x'

pull/13085/merge
Stephane Nicoll 7 years ago
commit 9cf68a2de4

@ -23,6 +23,7 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.BaseConstructor; import org.yaml.snakeyaml.constructor.BaseConstructor;
import org.yaml.snakeyaml.constructor.Constructor; import org.yaml.snakeyaml.constructor.Constructor;
@ -64,7 +65,9 @@ class OriginTrackedYamlLoader extends YamlProcessor {
Representer representer = new Representer(); Representer representer = new Representer();
DumperOptions dumperOptions = new DumperOptions(); DumperOptions dumperOptions = new DumperOptions();
LimitedResolver resolver = new LimitedResolver(); LimitedResolver resolver = new LimitedResolver();
return new Yaml(constructor, representer, dumperOptions, resolver); LoaderOptions loaderOptions = new LoaderOptions();
loaderOptions.setAllowDuplicateKeys(false);
return new Yaml(constructor, representer, dumperOptions, loaderOptions, resolver);
} }
public List<Map<String, Object>> load() { public List<Map<String, Object>> load() {
@ -76,7 +79,7 @@ class OriginTrackedYamlLoader extends YamlProcessor {
/** /**
* {@link Constructor} that tracks property origins. * {@link Constructor} that tracks property origins.
*/ */
private class OriginTrackingConstructor extends StrictMapAppenderConstructor { private class OriginTrackingConstructor extends Constructor {
@Override @Override
protected Object constructObject(Node node) { protected Object constructObject(Node node) {

Loading…
Cancel
Save