From 6f847d623544bce0faf7ad265f8295df8774824e Mon Sep 17 00:00:00 2001 From: Yegor Borovikov Date: Wed, 25 Apr 2018 13:31:09 -0700 Subject: [PATCH] Fix #81 (update snakeyaml version to 1.21) --- yaml/pom.xml | 2 +- .../fasterxml/jackson/dataformat/yaml/YAMLGenerator.java | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/yaml/pom.xml b/yaml/pom.xml index 363c556cb..48a0b6228 100644 --- a/yaml/pom.xml +++ b/yaml/pom.xml @@ -30,7 +30,7 @@ org.yaml snakeyaml - 1.19 + 1.21 diff --git a/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java b/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java index c86f5e75e..9e9b3666f 100644 --- a/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java +++ b/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java @@ -10,6 +10,7 @@ import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.DumperOptions.FlowStyle; +import org.yaml.snakeyaml.DumperOptions.ScalarStyle; import org.yaml.snakeyaml.emitter.Emitter; import org.yaml.snakeyaml.events.*; import org.yaml.snakeyaml.nodes.Tag; @@ -173,7 +174,7 @@ private Feature(boolean defaultState) { // 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 ScalarStyle STYLE_BASE64 = ScalarStyle.createStyle(STYLE_LITERAL); private final static Character STYLE_PLAIN = null; @@ -428,7 +429,7 @@ public final void writeStartArray() throws IOException { _verifyValueWrite("start an array"); _outputContext = _outputContext.createChildArrayContext(); - Boolean style = _outputOptions.getDefaultFlowStyle().getStyleBoolean(); + FlowStyle style = _outputOptions.getDefaultFlowStyle(); String yamlTag = _typeId; boolean implicit = (yamlTag == null); String anchor = _objectId; @@ -456,7 +457,7 @@ public final void writeStartObject() throws IOException { _verifyValueWrite("start an object"); _outputContext = _outputContext.createChildObjectContext(); - Boolean style = _outputOptions.getDefaultFlowStyle().getStyleBoolean(); + FlowStyle style = _outputOptions.getDefaultFlowStyle(); String yamlTag = _typeId; boolean implicit = (yamlTag == null); String anchor = _objectId; @@ -799,6 +800,6 @@ protected ScalarEvent _scalarEvent(String value, Character style) // 29-Nov-2017, tatu: Not 100% sure why we don't force explicit tags for // type id, but trying to do so seems to double up tag output... return new ScalarEvent(anchor, yamlTag, NO_TAGS, value, - null, null, style); + null, null, ScalarStyle.createStyle(style)); } }