Skip to content

Commit

Permalink
Backported #84 implementation to 2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed May 15, 2018
1 parent 52e0851 commit a05200c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
5 changes: 5 additions & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ Fabrice Delhoste (spifd@github)
* Reported #74 (properties): `JavaPropsMapper` issue deserializing multiple byte array properties
(2.9.5)

Thomas Hauk (thauk-copperleaf@github)

* Contibuted #84 (yaml): Add option to allow use of platform-linefeed
(`YAMLGenerator.Feature.USE_PLATFORM_LINE_BREAKS`)
(2.9.6)
6 changes: 6 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ Modules:
=== Releases ===
------------------------------------------------------------------------

2.9.6 (not yet released)

#84 (yaml): Add option to allow use of platform-linefeed
(`YAMLGenerator.Feature.USE_PLATFORM_LINE_BREAKS`)
(contributed by Thomas H)

2.9.5 (26-Mar-2018)

#74 (properties): `JavaPropsMapper` issue deserializing multiple byte array properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,18 @@ public enum Feature implements FormatFeature // since 2.9
*
* @since 2.9
*/
INDENT_ARRAYS(false)
INDENT_ARRAYS(false),

/**
* Option passed to SnakeYAML that determines if the line breaks used for
* serialization should be same as what the default is for current platform.
* If disabled, Unix linefeed ({@code \n}) will be used.
* <p>
* Default value is `false` for backwards compatibility.
*
* @since 2.9.6
*/
USE_PLATFORM_LINE_BREAKS(false),
;

protected final boolean _defaultState;
Expand Down Expand Up @@ -266,6 +277,10 @@ protected DumperOptions buildDumperOptions(int jsonFeatures, int yamlFeatures,
opt.setIndicatorIndent(1);
opt.setIndent(2);
}
// 14-May-2018: [dataformats-text#84] allow use of platform linefeed
if (Feature.USE_PLATFORM_LINE_BREAKS.enabledIn(_formatFeatures)) {
opt.setLineBreak(DumperOptions.LineBreak.getPlatformLineBreak());
}
return opt;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.fasterxml.jackson.dataformat.yaml.ModuleTestBase;
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature;

public class GeneratorFeatureTest extends ModuleTestBase
{
Expand Down

0 comments on commit a05200c

Please sign in to comment.