Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3406: change default of DeserializationFeature.FAIL_ON_TRAILING_TOKENS to true #4902

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ Versions: 3.x (for earlier see VERSION-2.x)
#3046: Rename `JsonSerializable` as `JacksonSerializable`
#3047: Rename `Bean[De]SerializerModifier` as `Value[De]SerializerModifier`
#3070: Change default for `SerializationFeature.FAIL_ON_EMPTY_BEANS` to `false`
#3406: Change default of `DeserializationFeature.FAIL_ON_TRAILING_TOKENS` to `true` for 3.0
(suggested by @yawkat)
#3522: Support serializing `ByteArrayOutputStream` as "simple" Binary value
#3536: Create new exception type `JsonNodeException` for use by `JsonNode`-related problems
#3542: Rename "com.fasterxml.jackson" -> "tools.jackson"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,9 @@ public enum DeserializationFeature implements ConfigFeature
* for binding the full value, and nothing more (except for possible ignorable
* white space or comments, if supported by data format).
*<p>
* Feature is disabled by default (so that no check is made for possible trailing
* token(s)) for backwards compatibility reasons.
* Feature is enabled by default as of Jackson 3.0 (in 2.x it was disabled).
*/
FAIL_ON_TRAILING_TOKENS(false),
FAIL_ON_TRAILING_TOKENS(true),

/**
* Feature that determines whether Jackson code should catch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class TestBlocking
* quite yet.
*/
@Test
public void testEagerAdvance() throws IOException
public void testEagerAdvance() throws Exception
{
ObjectMapper mapper = jsonMapperBuilder()
.disable(DeserializationFeature.FAIL_ON_TRAILING_TOKENS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ public void testAddModuleWithDeserializerTwiceThenOnlyLatestIsKept() throws Exce
}

@Test
public void testAddModuleWithDeserializerTwiceThenOnlyLatestIsKept_reverseOrder() throws Exception {
public void testAddModuleWithDeserializerTwiceThenOnlyLatestIsKept_reverseOrder() throws Exception
{
SimpleModule firstModule = new SimpleModule()
.addDeserializer(Test3787Bean.class, new Deserializer3787A());
SimpleModule secondModule = new SimpleModule()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public void testMultiple() throws Exception
.disable(DeserializationFeature.FAIL_ON_TRAILING_TOKENS)
.build();
String JSON = "12 \"string\" [ 1, 2, 3 ]";
JsonParser p = mapper.createParser(new StringReader(JSON));
JsonParser p = mapper.createParser(JSON);
JsonNode result = mapper.readTree(p);

assertTrue(result.isIntegralNumber());
Expand Down
Loading