Skip to content

Use latest SnakeYAML version 1.23 and get rid of deprecated methods #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion yaml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.18</version>
<version>1.23</version>
</dependency>

<!-- and for testing need annotations -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,20 +189,20 @@ private Feature(boolean defaultState) {
protected DumperOptions _outputOptions;

// for field names, leave out quotes
private final static Character STYLE_NAME = null;
private final static DumperOptions.ScalarStyle STYLE_NAME = DumperOptions.ScalarStyle.PLAIN;

// numbers, booleans, should use implicit
private final static Character STYLE_SCALAR = null;
private final static DumperOptions.ScalarStyle STYLE_SCALAR = DumperOptions.ScalarStyle.PLAIN;
// Strings quoted for fun
private final static Character STYLE_QUOTED = Character.valueOf('"');
private final static DumperOptions.ScalarStyle STYLE_QUOTED = DumperOptions.ScalarStyle.DOUBLE_QUOTED;
// Strings in literal (block) style
private final static Character STYLE_LITERAL = Character.valueOf('|');
private final static DumperOptions.ScalarStyle STYLE_LITERAL = DumperOptions.ScalarStyle.LITERAL;

// Which flow style to use for Base64? Maybe basic quoted?
// 29-Nov-2017, tatu: Actually SnakeYAML uses block style so:
private final static Character STYLE_BASE64 = STYLE_LITERAL;
private final static DumperOptions.ScalarStyle STYLE_BASE64 = STYLE_LITERAL;

private final static Character STYLE_PLAIN = null;
private final static DumperOptions.ScalarStyle STYLE_PLAIN = DumperOptions.ScalarStyle.PLAIN;

/*
/**********************************************************
Expand Down Expand Up @@ -466,7 +466,7 @@ public final void writeStartArray() throws IOException
{
_verifyValueWrite("start an array");
_writeContext = _writeContext.createChildArrayContext();
Boolean style = _outputOptions.getDefaultFlowStyle().getStyleBoolean();
FlowStyle style = _outputOptions.getDefaultFlowStyle();
String yamlTag = _typeId;
boolean implicit = (yamlTag == null);
String anchor = _objectId;
Expand Down Expand Up @@ -494,7 +494,7 @@ public final void writeStartObject() throws IOException
{
_verifyValueWrite("start an object");
_writeContext = _writeContext.createChildObjectContext();
Boolean style = _outputOptions.getDefaultFlowStyle().getStyleBoolean();
FlowStyle style = _outputOptions.getDefaultFlowStyle();
String yamlTag = _typeId;
boolean implicit = (yamlTag == null);
String anchor = _objectId;
Expand Down Expand Up @@ -531,7 +531,7 @@ public void writeString(String text) throws IOException,JsonGenerationException
return;
}
_verifyValueWrite("write String value");
Character style = STYLE_QUOTED;
DumperOptions.ScalarStyle style = STYLE_QUOTED;
if (Feature.MINIMIZE_QUOTES.enabledIn(_formatFeatures) && !isBooleanContent(text)) {
// If this string could be interpreted as a number, it must be quoted.
if (Feature.ALWAYS_QUOTE_NUMBERS_AS_STRINGS.enabledIn(_formatFeatures)
Expand Down Expand Up @@ -806,7 +806,7 @@ protected void _releaseBuffers() {
// ... and sometimes we specifically DO want explicit tag:
private final static ImplicitTuple EXPLICIT_TAGS = new ImplicitTuple(false, false);

protected void _writeScalar(String value, String type, Character style) throws IOException
protected void _writeScalar(String value, String type, DumperOptions.ScalarStyle style) throws IOException
{
_emitter.emit(_scalarEvent(value, style));
}
Expand All @@ -824,7 +824,7 @@ private void _writeScalarBinary(Base64Variant b64variant,
null, null, STYLE_BASE64));
}

protected ScalarEvent _scalarEvent(String value, Character style)
protected ScalarEvent _scalarEvent(String value, DumperOptions.ScalarStyle style)
{
String yamlTag = _typeId;
if (yamlTag != null) {
Expand Down