Skip to content

Commit ee1e08e

Browse files
committed
Fixed #480 (prev commit actuall)
1 parent c98ad85 commit ee1e08e

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

release-notes/CREDITS-2.x

+4-1
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,7 @@ Doug Roper (htmldoug@github)
155155
* Suggested #463: Ensure that `skipChildren()` of non-blocking `JsonParser` will throw
156156
exception if not enough input
157157
(2.9.6)
158-
158+
159+
Philippe Marschall (marschall@github)
160+
* Requested #480: `SerializableString` value can not directly render to Writer
161+
(2.10.0)

release-notes/VERSION-2.x

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ JSON library.
1616

1717
2.10.0 (not yet released)
1818

19-
- to be filled -
19+
#480: `SerializableString` value can not directly render to Writer
20+
(requested by Philippe M)
2021

2122
2.9.7 (not yet released)
2223

src/test/java/com/fasterxml/jackson/core/json/TestGeneratorWithSerializedString.java

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.fasterxml.jackson.core.json;
22

33
import java.io.*;
4+
import java.util.Random;
45

56
import com.fasterxml.jackson.core.*;
67
import com.fasterxml.jackson.core.io.SerializedString;
@@ -12,7 +13,7 @@ public class TestGeneratorWithSerializedString
1213
final static String NAME_WITH_LATIN1 = "P\u00f6ll\u00f6";
1314

1415
final static String VALUE_WITH_QUOTES = "\"Value\"";
15-
final static String VALUE2 = "Slightly longer value";
16+
final static String VALUE2 = _generateLongName(9000);
1617

1718
private final JsonFactory JSON_F = new JsonFactory();
1819

@@ -163,4 +164,21 @@ private void _verifySimpleValues(JsonParser p) throws Exception
163164
assertToken(JsonToken.END_ARRAY, p.nextToken());
164165
assertNull(p.nextToken());
165166
}
167+
168+
private static String _generateLongName(int minLen)
169+
{
170+
StringBuilder sb = new StringBuilder();
171+
Random rnd = new Random(123);
172+
while (sb.length() < minLen) {
173+
int ch = rnd.nextInt(96);
174+
if (ch < 32) { // ascii (single byte)
175+
sb.append((char) (48 + ch));
176+
} else if (ch < 64) { // 2 byte
177+
sb.append((char) (128 + ch));
178+
} else { // 3 byte
179+
sb.append((char) (4000 + ch));
180+
}
181+
}
182+
return sb.toString();
183+
}
166184
}

0 commit comments

Comments
 (0)