File tree Expand file tree Collapse file tree
main/java/com/fasterxml/jackson/dataformat/yaml
test/java/com/fasterxml/jackson/dataformat/yaml/ser Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,9 @@ Active Maintainers:
1616
17172.15.0 (not yet released)
1818
19- -
19+ #373 : Positive numbers with plus sign not quoted correctly with
20+ `ALWAYS_QUOTE_NUMBERS_AS_STRINGS `
21+ (requested by @dyadyaJora)
2022
21232.14.2 (28 -Jan-2023 )
2224
Original file line number Diff line number Diff line change @@ -217,7 +217,7 @@ private Feature(boolean defaultState) {
217217
218218 protected final static long MIN_INT_AS_LONG = (long ) Integer .MIN_VALUE ;
219219 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]*)?" );
221221 protected final static String TAG_BINARY = Tag .BINARY .toString ();
222222
223223 /*
Original file line number Diff line number Diff line change @@ -177,6 +177,8 @@ public void testLiteralStringsMultiLine() throws Exception
177177
178178 public void testQuoteNumberStoredAsString () throws Exception
179179 {
180+ // [dataformats-text#182]
181+
180182 YAMLFactory f = new YAMLFactory ();
181183 // verify default settings
182184 assertFalse (f .isEnabled (YAMLGenerator .Feature .MINIMIZE_QUOTES ));
@@ -206,6 +208,11 @@ public void testQuoteNumberStoredAsString() throws Exception
206208 yaml = mapper .writeValueAsString (Collections .singletonMap ("key" , "-60.25" )).trim ();
207209 assertEquals ("---\n " +
208210 "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 );
209216 }
210217
211218 public void testNonQuoteNumberStoredAsString () throws Exception
You can’t perform that action at this time.
0 commit comments