Skip to content

Commit c7729d8

Browse files
authored
Merge pull request #101 from asomov/snakeyaml-1-23
Use latest SnakeYAML version 1.23 and get rid of deprecated methods
2 parents d17eb5c + 250744a commit c7729d8

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

yaml/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<dependency>
3131
<groupId>org.yaml</groupId>
3232
<artifactId>snakeyaml</artifactId>
33-
<version>1.18</version>
33+
<version>1.23</version>
3434
</dependency>
3535

3636
<!-- and for testing need annotations -->

yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,20 +189,20 @@ private Feature(boolean defaultState) {
189189
protected DumperOptions _outputOptions;
190190

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

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

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

205-
private final static Character STYLE_PLAIN = null;
205+
private final static DumperOptions.ScalarStyle STYLE_PLAIN = DumperOptions.ScalarStyle.PLAIN;
206206

207207
/*
208208
/**********************************************************
@@ -466,7 +466,7 @@ public final void writeStartArray() throws IOException
466466
{
467467
_verifyValueWrite("start an array");
468468
_writeContext = _writeContext.createChildArrayContext();
469-
Boolean style = _outputOptions.getDefaultFlowStyle().getStyleBoolean();
469+
FlowStyle style = _outputOptions.getDefaultFlowStyle();
470470
String yamlTag = _typeId;
471471
boolean implicit = (yamlTag == null);
472472
String anchor = _objectId;
@@ -494,7 +494,7 @@ public final void writeStartObject() throws IOException
494494
{
495495
_verifyValueWrite("start an object");
496496
_writeContext = _writeContext.createChildObjectContext();
497-
Boolean style = _outputOptions.getDefaultFlowStyle().getStyleBoolean();
497+
FlowStyle style = _outputOptions.getDefaultFlowStyle();
498498
String yamlTag = _typeId;
499499
boolean implicit = (yamlTag == null);
500500
String anchor = _objectId;
@@ -531,7 +531,7 @@ public void writeString(String text) throws IOException,JsonGenerationException
531531
return;
532532
}
533533
_verifyValueWrite("write String value");
534-
Character style = STYLE_QUOTED;
534+
DumperOptions.ScalarStyle style = STYLE_QUOTED;
535535
if (Feature.MINIMIZE_QUOTES.enabledIn(_formatFeatures) && !isBooleanContent(text)) {
536536
// If this string could be interpreted as a number, it must be quoted.
537537
if (Feature.ALWAYS_QUOTE_NUMBERS_AS_STRINGS.enabledIn(_formatFeatures)
@@ -806,7 +806,7 @@ protected void _releaseBuffers() {
806806
// ... and sometimes we specifically DO want explicit tag:
807807
private final static ImplicitTuple EXPLICIT_TAGS = new ImplicitTuple(false, false);
808808

809-
protected void _writeScalar(String value, String type, Character style) throws IOException
809+
protected void _writeScalar(String value, String type, DumperOptions.ScalarStyle style) throws IOException
810810
{
811811
_emitter.emit(_scalarEvent(value, style));
812812
}
@@ -824,7 +824,7 @@ private void _writeScalarBinary(Base64Variant b64variant,
824824
null, null, STYLE_BASE64));
825825
}
826826

827-
protected ScalarEvent _scalarEvent(String value, Character style)
827+
protected ScalarEvent _scalarEvent(String value, DumperOptions.ScalarStyle style)
828828
{
829829
String yamlTag = _typeId;
830830
if (yamlTag != null) {

0 commit comments

Comments
 (0)