Skip to content

Commit 21efb26

Browse files
committed
Merge branch 'master' into snakeyaml-engine
# Conflicts: # yaml/pom.xml # yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java
2 parents 2cfc7d7 + 9ab1357 commit 21efb26

File tree

3 files changed

+78
-33
lines changed

3 files changed

+78
-33
lines changed

release-notes/CREDITS-2.x

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,19 @@ Fabrice Delhoste (spifd@github)
2121
* Reported #74 (properties): `JavaPropsMapper` issue deserializing multiple byte array properties
2222
(2.9.5)
2323

24+
Thomas Hauk (thauk-copperleaf@github)
25+
26+
* Contibuted #84 (yaml): Add option to allow use of platform-linefeed
27+
(`YAMLGenerator.Feature.USE_PLATFORM_LINE_BREAKS`)
28+
(2.9.6)
29+
30+
Yegor Borovikov (yborovikov@gitub)
31+
32+
* Reported #81 (yaml): Jackson 2.9.5, 2.9.6 incompatible with snakeyaml 1.20, 1.21
33+
(2.9.7)
34+
35+
Andrey Somov (asomov@github)
36+
37+
* Contributed #101: Use latest SnakeYAML version 1.23 and get rid of deprecated methods
38+
(2.10.0)
39+

release-notes/VERSION-2.x

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@ Modules:
88
=== Releases ===
99
------------------------------------------------------------------------
1010

11+
2.10.0 (not yet released)
12+
13+
#101: Use latest SnakeYAML version 1.23 and get rid of deprecated methods
14+
(contributed by Andrey S)
15+
16+
2.9.7 (not yet released)
17+
18+
#81: Jackson 2.9.5, 2.9.6 incompatible with snakeyaml 1.20, 1.21
19+
(reported by Yegor B)
20+
21+
2.9.6 (12-Jun-2018)
22+
23+
#84 (yaml): Add option to allow use of platform-linefeed
24+
(`YAMLGenerator.Feature.USE_PLATFORM_LINE_BREAKS`)
25+
(contributed by Thomas H)
26+
1127
2.9.5 (26-Mar-2018)
1228

1329
#74 (properties): `JavaPropsMapper` issue deserializing multiple byte array properties

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

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,22 @@ public enum Feature implements FormatFeature
105105
*/
106106
LITERAL_BLOCK_STYLE(false),
107107

108+
/**
109+
* Option passed to SnakeYAML that determines if the line breaks used for
110+
* serialization should be same as what the default is for current platform.
111+
* If disabled, Unix linefeed ({@code \n}) will be used.
112+
* <p>
113+
* Default value is `false` for backwards compatibility.
114+
*/
115+
USE_PLATFORM_LINE_BREAKS(false),
116+
108117
/**
109118
* Feature enabling of which adds indentation for array entry generation
110119
* (default indentation being 2 spaces).
111120
*<p>
112121
* Default value is `false` for backwards compatibility
113122
*/
114-
INDENT_ARRAYS(false)
123+
INDENT_ARRAYS(false),
115124
;
116125

117126
protected final boolean _defaultState;
@@ -146,9 +155,9 @@ private Feature(boolean defaultState) {
146155
}
147156

148157
/*
149-
/**********************************************************
158+
/**********************************************************************
150159
/* Internal constants
151-
/**********************************************************
160+
/**********************************************************************
152161
*/
153162

154163
protected final static long MIN_INT_AS_LONG = (long) Integer.MIN_VALUE;
@@ -157,9 +166,9 @@ private Feature(boolean defaultState) {
157166
protected final static String TAG_BINARY = Tag.BINARY.toString();
158167

159168
/*
160-
/**********************************************************
169+
/**********************************************************************
161170
/* Configuration
162-
/**********************************************************
171+
/**********************************************************************
163172
*/
164173

165174
final protected IOContext _ioContext;
@@ -192,9 +201,9 @@ private Feature(boolean defaultState) {
192201
private final static ScalarStyle STYLE_PLAIN = ScalarStyle.PLAIN;
193202

194203
/*
195-
/**********************************************************
204+
/**********************************************************************
196205
/* Output state
197-
/**********************************************************
206+
/**********************************************************************
198207
*/
199208

200209
protected Emitter _emitter;
@@ -212,9 +221,9 @@ private Feature(boolean defaultState) {
212221
protected String _typeId;
213222

214223
/*
215-
/**********************************************************
224+
/**********************************************************************
216225
/* Life-cycle
217-
/**********************************************************
226+
/**********************************************************************
218227
*/
219228

220229
public YAMLGenerator(ObjectWriteContext writeContext, IOContext ioCtxt,
@@ -265,13 +274,17 @@ protected DumpSettings buildDumperOptions(int jsonFeatures, int yamlFeatures,
265274
opt.setIndicatorIndent(1);
266275
opt.setIndent(2);
267276
}
277+
// 14-May-2018: [dataformats-text#84] allow use of platform linefeed
278+
if (Feature.USE_PLATFORM_LINE_BREAKS.enabledIn(_formatFeatures)) {
279+
opt.setLineBreak(DumperOptions.LineBreak.getPlatformLineBreak());
280+
}
268281
return opt;
269282
}
270283

271284
/*
272-
/**********************************************************
285+
/**********************************************************************
273286
/* Versioned
274-
/**********************************************************
287+
/**********************************************************************
275288
*/
276289

277290
@Override
@@ -280,9 +293,9 @@ public Version version() {
280293
}
281294

282295
/*
283-
/**********************************************************
296+
/**********************************************************************
284297
/* Overridden methods, configuration
285-
/**********************************************************
298+
/**********************************************************************
286299
*/
287300

288301
/**
@@ -333,9 +346,9 @@ public boolean canUseSchema(FormatSchema schema) {
333346
//@Override public void setSchema(FormatSchema schema)
334347

335348
/*
336-
/**********************************************************
349+
/**********************************************************************
337350
/* Extended API, configuration
338-
/**********************************************************
351+
/**********************************************************************
339352
*/
340353

341354
public YAMLGenerator enable(Feature f) {
@@ -409,9 +422,9 @@ private final void _writeFieldName(String name)
409422
}
410423

411424
/*
412-
/**********************************************************
425+
/**********************************************************************
413426
/* Public API: low-level I/O
414-
/**********************************************************
427+
/**********************************************************************
415428
*/
416429

417430
@Override
@@ -432,9 +445,9 @@ public void close() throws IOException
432445
}
433446

434447
/*
435-
/**********************************************************
448+
/**********************************************************************
436449
/* Public API: structural output
437-
/**********************************************************
450+
/**********************************************************************
438451
*/
439452

440453
@Override
@@ -493,9 +506,9 @@ public final void writeEndObject() throws IOException
493506
}
494507

495508
/*
496-
/**********************************************************
509+
/**********************************************************************
497510
/* Output method implementations, textual
498-
/**********************************************************
511+
/**********************************************************************
499512
*/
500513

501514
@Override
@@ -555,9 +568,9 @@ public final void writeUTF8String(byte[] text, int offset, int len)
555568
}
556569

557570
/*
558-
/**********************************************************
571+
/**********************************************************************
559572
/* Output method implementations, unprocessed ("raw")
560-
/**********************************************************
573+
/**********************************************************************
561574
*/
562575

563576
@Override
@@ -596,9 +609,9 @@ public void writeRawValue(char[] text, int offset, int len) throws IOException {
596609
}
597610

598611
/*
599-
/**********************************************************
612+
/**********************************************************************
600613
/* Output method implementations, base64-encoded binary
601-
/**********************************************************
614+
/**********************************************************************
602615
*/
603616

604617
@Override
@@ -616,9 +629,9 @@ public void writeBinary(Base64Variant b64variant, byte[] data, int offset, int l
616629
}
617630

618631
/*
619-
/**********************************************************
632+
/**********************************************************************
620633
/* Output method implementations, scalars
621-
/**********************************************************
634+
/**********************************************************************
622635
*/
623636

624637
@Override
@@ -704,9 +717,9 @@ public void writeNull() throws IOException
704717
}
705718

706719
/*
707-
/**********************************************************
720+
/**********************************************************************
708721
/* Public API, write methods, Native Ids
709-
/**********************************************************
722+
/**********************************************************************
710723
*/
711724

712725
@Override
@@ -749,9 +762,9 @@ public void writeObjectId(Object id)
749762
}
750763

751764
/*
752-
/**********************************************************
765+
/**********************************************************************
753766
/* Implementations for methods from base class
754-
/**********************************************************
767+
/**********************************************************************
755768
*/
756769

757770
@Override
@@ -770,9 +783,9 @@ protected void _releaseBuffers() {
770783
}
771784

772785
/*
773-
/**********************************************************
786+
/**********************************************************************
774787
/* Internal methods
775-
/**********************************************************
788+
/**********************************************************************
776789
*/
777790

778791
// Implicit means that (type) tags won't be shown, right?

0 commit comments

Comments
 (0)