File tree 3 files changed +11
-2
lines changed
main/java/com/fasterxml/jackson/dataformat/yaml
test/java/com/fasterxml/jackson/dataformat/yaml/ser
3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,9 @@ Active Maintainers:
16
16
17
17
2.15.0 (not yet released)
18
18
19
- -
19
+ #373 : Positive numbers with plus sign not quoted correctly with
20
+ `ALWAYS_QUOTE_NUMBERS_AS_STRINGS`
21
+ (requested by @dyadyaJora)
20
22
21
23
2.14.2 (28 -Jan-2023 )
22
24
Original file line number Diff line number Diff line change @@ -217,7 +217,7 @@ private Feature(boolean defaultState) {
217
217
218
218
protected final static long MIN_INT_AS_LONG = (long ) Integer .MIN_VALUE ;
219
219
protected final static long MAX_INT_AS_LONG = (long ) Integer .MAX_VALUE ;
220
- protected final static Pattern PLAIN_NUMBER_P = Pattern .compile ("- ?[0-9]*(\\ .[0-9]*)?" );
220
+ protected final static Pattern PLAIN_NUMBER_P = Pattern .compile ("[+-] ?[0-9]*(\\ .[0-9]*)?" );
221
221
protected final static String TAG_BINARY = Tag .BINARY .toString ();
222
222
223
223
/*
Original file line number Diff line number Diff line change @@ -177,6 +177,8 @@ public void testLiteralStringsMultiLine() throws Exception
177
177
178
178
public void testQuoteNumberStoredAsString () throws Exception
179
179
{
180
+ // [dataformats-text#182]
181
+
180
182
YAMLFactory f = new YAMLFactory ();
181
183
// verify default settings
182
184
assertFalse (f .isEnabled (YAMLGenerator .Feature .MINIMIZE_QUOTES ));
@@ -206,6 +208,11 @@ public void testQuoteNumberStoredAsString() throws Exception
206
208
yaml = mapper .writeValueAsString (Collections .singletonMap ("key" , "-60.25" )).trim ();
207
209
assertEquals ("---\n " +
208
210
"key: \" -60.25\" " , yaml );
211
+
212
+ // [dataformats-text#373]
213
+ yaml = mapper .writeValueAsString (Collections .singletonMap ("key" , "+125" )).trim ();
214
+ assertEquals ("---\n " +
215
+ "key: \" +125\" " , yaml );
209
216
}
210
217
211
218
public void testNonQuoteNumberStoredAsString () throws Exception
You can’t perform that action at this time.
0 commit comments