Skip to content
Commits on Source (6)
......@@ -3,11 +3,12 @@
## Overview ##
[YAML](http://yaml.org) is a data serialization format designed for human readability and interaction with scripting languages.
SnakeYAML is a YAML processor for the Java Virtual Machine.
SnakeYAML is a YAML 1.1 processor for the Java Virtual Machine version 6.
For YAML 1.2 (which is a superset of JSON) you may have a look at [SnakeYAML Engine](https://bitbucket.org/asomov/snakeyaml-engine)
## SnakeYAML features ##
* a **complete** [YAML 1.1 processor](http://yaml.org/spec/1.1/current.html). In particular, SnakeYAML can parse all examples from the specification.
* a **complete** [YAML 1.1 processor](http://yaml.org/spec/1.1/current.html). (If you need YAML **1.2** support have a look [here](https://bitbucket.org/asomov/snakeyaml-engine)). In particular, SnakeYAML can parse all examples from the specification.
* Unicode support including UTF-8/UTF-16 input/output.
* high-level API for serializing and deserializing native Java objects.
* support for all types from the [YAML types repository](http://yaml.org/type/index.html).
......
......@@ -3,7 +3,7 @@
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: maven:3-jdk-9-slim
image: maven:3.5.4-jdk-8
pipelines:
default:
......@@ -11,4 +11,4 @@ pipelines:
caches:
- maven
script: # Modify the commands below to build your repository.
- mvn -V -B -Pwith-java9-tests clean install
- mvn -V -B -Pwith-java8-tests clean install
snakeyaml (1.23-1) unstable; urgency=medium
* Team upload.
* New upstream release.
- Fixes the test failure with Java 11 (Closes: #912389)
* Standards-Version updated to 4.2.1
-- Emmanuel Bourg <ebourg@apache.org> Wed, 07 Nov 2018 01:12:28 +0100
snakeyaml (1.21-1) unstable; urgency=medium
* Team upload.
......
......@@ -15,7 +15,7 @@ Build-Depends:
libspring-context-java,
maven-debian-helper (>= 1.6.5),
velocity
Standards-Version: 4.1.4
Standards-Version: 4.2.1
Vcs-Git: https://salsa.debian.org/java-team/snakeyaml.git
Vcs-Browser: https://salsa.debian.org/java-team/snakeyaml
Homepage: https://bitbucket.org/asomov/snakeyaml
......
......@@ -2,6 +2,3 @@
%:
dh $@ --buildsystem=maven
get-orig-source:
uscan --force-download --download-current-version --repack --compression xz
version=4
opts=uversionmangle=s/(\d)[\.\-]?((?:rc|RC|pre)(?:\.|-)?\d+(?:-\d+)?)$/$1~$2/,
opts=repack,compression=xz,uversionmangle=s/(\d)[\.\-]?((?:rc|RC|pre)(?:\.|-)?\d+(?:-\d+)?)$/$1~$2/,
https://bitbucket.org/asomov/snakeyaml/downloads?tab=tags .*/snakeyaml-(\d\S+)\.tar\.gz
#!/usr/bin/env bash
./docker-run.sh 9-slim -Pwith-java9-tests
./docker-run.sh 11-slim -Pwith-java11-tests
......@@ -5,6 +5,6 @@ docker run --rm -it \
-v ~:/my-home \
-e "HOME=/my-home" \
-w /work \
maven:3-jdk-$1 \
maven:3.5.4-jdk-$1 \
mvn -Dmaven.repo.local=/my-home/.m2/repository clean test $2
......@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.21</version>
<version>1.23</version>
<packaging>bundle</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
......@@ -42,7 +42,7 @@
<connection>scm:hg:http://bitbucket.org/asomov/snakeyaml</connection>
<developerConnection>scm:hg:ssh://hg@bitbucket.org/asomov/snakeyaml</developerConnection>
<url>https://bitbucket.org/asomov/snakeyaml/src</url>
<tag>snakeyaml-1.21</tag>
<tag>snakeyaml-1.23</tag>
</scm>
<licenses>
<license>
......@@ -536,10 +536,10 @@
</build>
</profile>
<profile>
<id>with-java9-tests</id>
<id>with-java11-tests</id>
<properties>
<maven.compiler.source>9</maven.compiler.source>
<maven.compiler.target>9</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<build>
<plugins>
......@@ -565,7 +565,7 @@
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-java9-test-source</id>
<id>add-java11-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
......@@ -574,7 +574,7 @@
<sources>
<source>${basedir}/src/test/java7/</source>
<source>${basedir}/src/test/java8/</source>
<source>${basedir}/src/test/java9/</source>
<source>${basedir}/src/test/java11/</source>
</sources>
</configuration>
</execution>
......
......@@ -5,6 +5,33 @@
<title>YAML 1.1 parser and emitter</title>
</properties>
<body>
<release version="1.23" date="2018-08-27" description="Maintenance">
<action dev="asomov" type="fix" issue="412">
Add another getter for ScalarStyle to support backwards compatibility (2018-08-27)
</action>
</release>
<release version="1.22" date="2018-08-25" description="Maintenance">
<action dev="asomov" type="update">
Run tests under Java 11 (2018-08-19)
</action>
<action dev="asomov" type="update">
Use Maven 3.5.4 (2018-08-19)
</action>
<action dev="asomov" type="fix" issue="412">
Restore the Boolean constructors for Events and Nodes for binary compatibility
of dependent projects (2018-08-17)
</action>
<action dev="asomov" type="fix" issue="411">
System Property "java.runtime.name" is not required to be defined (2018-08-12)
Ensure Compatibility with Graal
</action>
<action dev="asomov" type="fix" issue="409">
Dumping Enum breaks when Enum value is Anonymous inner class (2018-08-07)
Solution: refactor the way to detect if the full tag can be omitted (and !!str is used instead).
Instead of checking whether the class for property and the class for the actual value is the same
we can just check that the property class is not java.lang.Enum
</action>
</release>
<release version="1.21" date="2018-04-13" description="Maintenance">
<action dev="asomov" type="update">
Scanner throws IndexOutOfBoundsException if no more token left but getToken()
......@@ -23,7 +50,7 @@
Plain scalars with colons in flow sequences/mappings are valid YAML (2018-03-03)
</action>
</release>
<release version="1.20-SNAPSHOT" date="2018-02-28" description="Maintenance">
<release version="1.20" date="2018-02-28" description="Maintenance">
<action dev="maslovalex" type="fix" issue="393">
Improve reflective access operation to avoid warning under Java 9 (2018-02-24)
</action>
......
From: Andrey Somov <public.somov@gmail.com>
To: yaml-core@lists.sourceforge.net
Subject: [ANN] SnakeYAML-1.20 final is available
Subject: [ANN] SnakeYAML-1.22 final is available
==========================
Announcing SnakeYAML-1.20
Announcing SnakeYAML-1.22
==========================
A new release of SnakeYAML is now available:
......@@ -11,6 +11,7 @@ A new release of SnakeYAML is now available:
http://www.snakeyaml.org
This release delivers minor changes and bug fixes.
This is the last release to support Java 6. As of the next release Java 7 will be required.
The complete list of changes is here: https://bitbucket.org/asomov/snakeyaml/wiki/Changes
......@@ -20,8 +21,8 @@ Resources
SnakeYAML homepage: http://www.snakeyaml.org
SnakeYAML documentation: https://bitbucket.org/asomov/snakeyaml/wiki/Home
JAR package: http://repo2.maven.org/maven2/org/yaml/snakeyaml/1.20/snakeyaml-1.20.jar
Android: http://repo2.maven.org/maven2/org/yaml/snakeyaml/1.20/snakeyaml-1.20-android.jar
JAR package: http://repo2.maven.org/maven2/org/yaml/snakeyaml/1.22/snakeyaml-1.22.jar
Android: http://repo2.maven.org/maven2/org/yaml/snakeyaml/1.22/snakeyaml-1.22-android.jar
YAML homepage: http://yaml.org/
YAML-core mailing list: http://lists.sourceforge.net/lists/listinfo/yaml-core
......
......@@ -89,6 +89,18 @@ public class DumperOptions {
private FlowStyle(Boolean flowStyle) {
styleBoolean = flowStyle;
}
/*
* Convenience for legacy constructors that took {@link Boolean} arguments since replaced by {@link FlowStyle}.
* Introduced in v1.22 but only to support that for backwards compatibility.
* @deprecated Since restored in v1.22. Use the {@link FlowStyle} constants in your code instead.
*/
@Deprecated
public static FlowStyle fromBoolean(Boolean flowStyle) {
return flowStyle==null ? AUTO
: flowStyle ? FLOW
: BLOCK;
}
public Boolean getStyleBoolean() {
return styleBoolean;
......
......@@ -442,7 +442,7 @@ public class Yaml {
* Java object.
*
* @param io
* data to load from (BOM is respected and removed)
* data to load from (BOM is respected to detect encoding and removed from the data)
* @param <T>
* the class of the instance to be created
* @return parsed object
......@@ -508,7 +508,7 @@ public class Yaml {
* @param <T>
* Class is defined by the second argument
* @param input
* data to load from (BOM is respected and removed)
* data to load from (BOM is respected to detect encoding and removed from the data)
* @param type
* Class of the object to be created
* @return parsed object
......@@ -525,12 +525,12 @@ public class Yaml {
}
/**
* Parse all YAML documents in a String and produce corresponding Java
* Parse all YAML documents in the Reader and produce corresponding Java
* objects. The documents are parsed only when the iterator is invoked.
*
* @param yaml
* YAML data to load from (BOM must not be present)
* @return an iterator over the parsed Java objects in this String in proper
* @return an Iterable over the parsed Java objects in this String in proper
* sequence
*/
public Iterable<Object> loadAll(Reader yaml) {
......@@ -575,7 +575,7 @@ public class Yaml {
*
* @param yaml
* YAML data to load from (BOM must not be present)
* @return an iterator over the parsed Java objects in this String in proper
* @return an Iterable over the parsed Java objects in this String in proper
* sequence
*/
public Iterable<Object> loadAll(String yaml) {
......@@ -587,8 +587,8 @@ public class Yaml {
* objects. The documents are parsed only when the iterator is invoked.
*
* @param yaml
* YAML data to load from (BOM is respected and ignored)
* @return an iterator over the parsed Java objects in this stream in proper
* YAML data to load from (BOM is respected to detect encoding and removed from the data)
* @return an Iterable over the parsed Java objects in this stream in proper
* sequence
*/
public Iterable<Object> loadAll(InputStream yaml) {
......@@ -746,5 +746,4 @@ public class Yaml {
constructor.addTypeDescription(td);
representer.addTypeDescription(td);
}
}
......@@ -161,7 +161,7 @@ public class Composer {
nodeTag = new Tag(tag);
}
Node node = new ScalarNode(nodeTag, resolved, ev.getValue(), ev.getStartMark(),
ev.getEndMark(), ev.getStyle());
ev.getEndMark(), ev.getScalarStyle());
if (anchor != null) {
anchors.put(anchor, node);
}
......
......@@ -764,7 +764,7 @@ public final class Emitter implements Emitable {
if (analysis == null) {
analysis = analyzeScalar(ev.getValue());
}
if (!ev.isPlain() && ev.getStyle() == DumperOptions.ScalarStyle.DOUBLE_QUOTED || this.canonical) {
if (!ev.isPlain() && ev.getScalarStyle() == DumperOptions.ScalarStyle.DOUBLE_QUOTED || this.canonical) {
return DumperOptions.ScalarStyle.DOUBLE_QUOTED;
}
if (ev.isPlain() && ev.getImplicit().canOmitTagInPlainScalar()) {
......@@ -773,12 +773,12 @@ public final class Emitter implements Emitable {
return null;
}
}
if (!ev.isPlain() && (ev.getStyle() == DumperOptions.ScalarStyle.LITERAL || ev.getStyle() == DumperOptions.ScalarStyle.FOLDED)) {
if (!ev.isPlain() && (ev.getScalarStyle() == DumperOptions.ScalarStyle.LITERAL || ev.getScalarStyle() == DumperOptions.ScalarStyle.FOLDED)) {
if (flowLevel == 0 && !simpleKeyContext && analysis.allowBlock) {
return ev.getStyle();
return ev.getScalarStyle();
}
}
if (ev.isPlain() || ev.getStyle() == DumperOptions.ScalarStyle.SINGLE_QUOTED) {
if (ev.isPlain() || ev.getScalarStyle() == DumperOptions.ScalarStyle.SINGLE_QUOTED) {
if (analysis.allowSingleQuoted && !(simpleKeyContext && analysis.multiline)) {
return DumperOptions.ScalarStyle.SINGLE_QUOTED;
}
......
......@@ -44,6 +44,16 @@ public final class Mark implements Serializable {
public Mark(String name, int index, int line, int column, char[] str, int pointer) {
this(name, index, line, column, toCodePoints(str), pointer);
}
/*
* Existed in older versions but replaced with {@code char[]}-based constructor.
* Restored in v1.22 for backwards compatibility.
* @deprecated Since restored in v1.22. Use {@link Mark#Mark(String, int, int, int, char[], int)}.
*/
@Deprecated
public Mark(String name, int index, int line, int column, String buffer, int pointer) {
this(name, index, line, column, buffer.toCharArray(), pointer);
}
public Mark(String name, int index, int line, int column, int[] buffer, int pointer) {
super();
......@@ -60,9 +70,6 @@ public final class Mark implements Serializable {
}
public String get_snippet(int indent, int max_length) {
if (buffer == null) {
return null;
}
float half = max_length / 2 - 1;
int start = pointer;
String head = "";
......
......@@ -23,6 +23,7 @@ import org.yaml.snakeyaml.error.Mark;
public final class AliasEvent extends NodeEvent {
public AliasEvent(String anchor, Mark startMark, Mark endMark) {
super(anchor, startMark, endMark);
if(anchor == null) throw new NullPointerException();
}
@Override
......
......@@ -37,6 +37,17 @@ public abstract class CollectionStartEvent extends NodeEvent {
if(flowStyle == null) throw new NullPointerException("Flow style must be provided.");
this.flowStyle = flowStyle;
}
/*
* Existed in older versions but replaced with {@link DumperOptions.FlowStyle}-based constructor.
* Restored in v1.22 for backwards compatibility.
* @deprecated Since restored in v1.22. Use {@link CollectionStartEvent#CollectionStartEvent(String, String, boolean, Mark, Mark, org.yaml.snakeyaml.DumperOptions.FlowStyle) }.
*/
@Deprecated
public CollectionStartEvent(String anchor, String tag, boolean implicit, Mark startMark,
Mark endMark, Boolean flowStyle) {
this(anchor, tag, implicit, startMark, endMark, DumperOptions.FlowStyle.fromBoolean(flowStyle));
}
/**
* Tag of this collection.
......
......@@ -38,6 +38,17 @@ public final class MappingStartEvent extends CollectionStartEvent {
super(anchor, tag, implicit, startMark, endMark, flowStyle);
}
/*
* Existed in older versions but replaced with {@link DumperOptions.FlowStyle}-based constructor.
* Restored in v1.22 for backwards compatibility.
* @deprecated Since restored in v1.22. Use {@link MappingStartEvent#CollectionStartEvent(String, String, boolean, Mark, Mark, org.yaml.snakeyaml.DumperOptions.FlowStyle) }.
*/
@Deprecated
public MappingStartEvent(String anchor, String tag, boolean implicit, Mark startMark,
Mark endMark, Boolean flowStyle) {
this(anchor, tag, implicit, startMark, endMark, DumperOptions.FlowStyle.fromBoolean(flowStyle));
}
@Override
public boolean is(Event.ID id) {
return ID.MappingStart == id;
......
......@@ -37,11 +37,23 @@ public final class ScalarEvent extends NodeEvent {
super(anchor, startMark, endMark);
this.tag = tag;
this.implicit = implicit;
if (value == null) throw new NullPointerException("Value must be provided.");
this.value = value;
if (style == null) throw new NullPointerException("Style must be provided.");
this.style = style;
}
/*
* Existed in older versions but replaced with {@link DumperOptions.ScalarStyle}-based constructor.
* Restored in v1.22 for backwards compatibility.
* @deprecated Since restored in v1.22. Use {@link ScalarEvent#ScalarEvent(String, String, ImplicitTuple, String, Mark, Mark, org.yaml.snakeyaml.DumperOptions.ScalarStyle) }.
*/
@Deprecated
public ScalarEvent(String anchor, String tag, ImplicitTuple implicit, String value,
Mark startMark, Mark endMark, Character style) {
this(anchor, tag, implicit, value, startMark, endMark, DumperOptions.ScalarStyle.createStyle(style));
}
/**
* Tag of this scalar.
*
......@@ -71,10 +83,19 @@ public final class ScalarEvent extends NodeEvent {
* Combinations</a>
* @return Style of the scalar.
*/
public DumperOptions.ScalarStyle getStyle() {
public DumperOptions.ScalarStyle getScalarStyle() {
return this.style;
}
/**
* @deprecated use getScalarStyle() instead
* @return char which is a value behind ScalarStyle
*/
@Deprecated
public Character getStyle() {
return this.style.getChar();
}
/**
* String representation of the value.
* <p>
......