Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.5:Update
tesla-polyglot
polyglot-snakeyaml-2.2.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File polyglot-snakeyaml-2.2.patch of Package tesla-polyglot
--- polyglot-maven-polyglot-0.4.5/polyglot-yaml/src/main/java/org/sonatype/maven/polyglot/yaml/ModelConstructor.java 2024-04-22 05:45:18.127841878 +0200 +++ polyglot-maven-polyglot-0.4.5/polyglot-yaml/src/main/java/org/sonatype/maven/polyglot/yaml/ModelConstructor.java 2024-04-22 05:45:37.617878164 +0200 @@ -9,6 +9,7 @@ import org.apache.maven.model.*; import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.TypeDescription; import org.yaml.snakeyaml.constructor.Construct; import org.yaml.snakeyaml.constructor.Constructor; @@ -39,8 +40,8 @@ */ private final Map<Class<?>, Construct> pomConstructors = new HashMap<>(); - public ModelConstructor() { - super(Model.class); + public ModelConstructor(LoaderOptions loadingConfig) { + super(Model.class, loadingConfig); yamlConstructors.put(XPP3DOM_TAG, new ConstructXpp3Dom()); yamlClassConstructors.put(NodeId.mapping, new MavenObjectConstruct()); --- polyglot-maven-polyglot-0.4.5/polyglot-yaml/src/main/java/org/sonatype/maven/polyglot/yaml/ModelRepresenter.java 2024-04-22 05:45:18.127841878 +0200 +++ polyglot-maven-polyglot-0.4.5/polyglot-yaml/src/main/java/org/sonatype/maven/polyglot/yaml/ModelRepresenter.java 2024-04-22 05:47:28.544723549 +0200 @@ -14,6 +14,7 @@ import org.apache.maven.model.Plugin; import org.codehaus.plexus.util.xml.Xpp3Dom; import org.yaml.snakeyaml.error.YAMLException; +import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.introspector.Property; import org.yaml.snakeyaml.nodes.Node; import org.yaml.snakeyaml.nodes.NodeTuple; @@ -34,7 +35,8 @@ * @since 0.7 */ class ModelRepresenter extends Representer { - public ModelRepresenter() { + public ModelRepresenter(DumperOptions options) { + super(options); this.representers.put(Xpp3Dom.class, new RepresentXpp3Dom()); Represent stringRepresenter = this.representers.get(String.class); this.representers.put(Boolean.class, stringRepresenter); @@ -96,7 +98,7 @@ private static final String ATTRIBUTE_PREFIX = "attr/"; public Node representData(Object data) { - return representMapping(Tag.MAP, toMap((Xpp3Dom) data), null); + return representMapping(Tag.MAP, toMap((Xpp3Dom) data), DumperOptions.FlowStyle.AUTO); } private Map<String, Object> toMap(Xpp3Dom node) { --- polyglot-maven-polyglot-0.4.5/polyglot-yaml/src/main/java/org/sonatype/maven/polyglot/yaml/YamlModelReader.java 2024-04-22 05:45:18.127841878 +0200 +++ polyglot-maven-polyglot-0.4.5/polyglot-yaml/src/main/java/org/sonatype/maven/polyglot/yaml/YamlModelReader.java 2024-04-22 05:45:37.617878164 +0200 @@ -13,6 +13,7 @@ import org.codehaus.plexus.component.annotations.Component; import org.sonatype.maven.polyglot.io.ModelReaderSupport; import org.yaml.snakeyaml.DumperOptions; +import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.representer.Representer; @@ -33,8 +34,9 @@ private final Yaml yaml; public YamlModelReader() { - ModelConstructor constructor = new ModelConstructor(); - yaml = new Yaml(constructor, new Representer(), new DumperOptions(), new ModelResolver()); + ModelConstructor constructor = new ModelConstructor(new LoaderOptions()); + DumperOptions options = new DumperOptions(); + yaml = new Yaml(constructor, new Representer(options), options, new ModelResolver()); } public Model read(Reader input, Map<String, ?> options) throws IOException, ModelParseException { --- polyglot-maven-polyglot-0.4.5/polyglot-yaml/src/main/java/org/sonatype/maven/polyglot/yaml/YamlModelWriter.java 2024-04-22 05:45:18.127841878 +0200 +++ polyglot-maven-polyglot-0.4.5/polyglot-yaml/src/main/java/org/sonatype/maven/polyglot/yaml/YamlModelWriter.java 2024-04-22 05:45:37.617878164 +0200 @@ -33,12 +33,12 @@ @Component(role = ModelWriter.class, hint = "yaml") public class YamlModelWriter extends ModelWriterSupport { public void write(Writer output, Map<String, Object> o, Model model) throws IOException { - //TODO improve SnakeYAML API (A. Somov) DumperOptions dumperOptions = new DumperOptions(); dumperOptions.setIndent(2); dumperOptions.setWidth(80); + dumperOptions.setDefaultScalarStyle(DumperOptions.ScalarStyle.PLAIN); Serializer serializer = new Serializer(new Emitter(output, dumperOptions), new ModelResolver(), dumperOptions, Tag.MAP); - Representer representer = new ModelRepresenter(); + Representer representer = new ModelRepresenter(dumperOptions); try { serializer.open(); Node node = representer.represent(model); --- polyglot-maven-polyglot-0.4.5/polyglot-yaml/src/test/java/org/sonatype/maven/polyglot/yaml/CompactFormatTest.java 2024-04-22 05:45:18.127841878 +0200 +++ polyglot-maven-polyglot-0.4.5/polyglot-yaml/src/test/java/org/sonatype/maven/polyglot/yaml/CompactFormatTest.java 2024-04-22 05:45:37.617878164 +0200 @@ -98,11 +98,13 @@ @Test public void testColonInFlowContext() throws Exception { + // support for colon in the flow context is improved + // in SnakeYAML 2.0 try { getModel("dependencies-colon-issue.yaml"); - throw new UnsupportedOperationException("Colon in flow context should not be accepted."); } catch (Exception e) { - assertTrue(e.getMessage().contains("http://pyyaml.org/wiki/YAMLColonInFlowContext")); + String message = e.getMessage(); + assertTrue(message, message.contains("Unable to find property 'groupId:log4j' on class: org.apache.maven.model.Exclusion")); } } --- polyglot-maven-polyglot-0.4.5/polyglot-yaml/src/test/java/org/sonatype/maven/polyglot/yaml/ModelRepresenterTest.java 2024-04-22 05:45:18.127841878 +0200 +++ polyglot-maven-polyglot-0.4.5/polyglot-yaml/src/test/java/org/sonatype/maven/polyglot/yaml/ModelRepresenterTest.java 2024-04-22 05:45:37.617878164 +0200 @@ -22,7 +22,7 @@ @Before public void setUp() throws Exception { - modelRepresenter = new ModelRepresenter(); + modelRepresenter = new ModelRepresenter(new DumperOptions()); } @Test
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor