Skip to content

Commit

Permalink
Merge branch '2.12' into 2.13
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Apr 24, 2021
2 parents fb6c73a + 7149799 commit 4b92a98
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ protected boolean _suitableType(JavaType type)
|| (cls == CharSequence.class) || (cls == Iterable.class) || (cls == Iterator.class)
// 06-Feb-2019, tatu: [modules-base#74] and:
|| (cls == java.io.Serializable.class)
// 23-Apr-2021, tatu: [modules-base#132] minimal patch
|| (cls == java.util.TimeZone.class)
) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ protected byte[] encodeInUTF32BE(String input)
return result;
}

public String quote(String str) {
public String q(String str) {
return '"'+str+'"';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ public void testIterable() throws Exception

public void testStringLike() throws Exception
{
CharSequence seq = MAPPER.readValue(quote("abc"), CharSequence.class);
CharSequence seq = MAPPER.readValue(q("abc"), CharSequence.class);
assertEquals("abc", (String) seq);
}

// [modules-base#74]: more types to skip
public void testSerializable() throws Exception
{
// Serializable value = MAPPER.readValue(quote("abc"), Serializable.class);
Serializable value = new ObjectMapper().readValue(quote("abc"), Serializable.class);
Serializable value = new ObjectMapper().readValue(q("abc"), Serializable.class);
assertEquals("abc", (String) value);
}

Expand All @@ -90,4 +90,19 @@ public void testIntAsString() throws Exception
assertEquals(EXP_JSON, VANILLA_MAPPER.writeValueAsString(new Bean117UsingJsonSerialize()));
assertEquals(EXP_JSON, MAPPER.writeValueAsString(new Bean117UsingJsonSerialize()));
}

// [modules-base#132]: Don't block "java.util.TimeZone"
public void testUtilTimeZone() throws Exception
{
final String json = q("PST");

TimeZone tz1 = VANILLA_MAPPER.readValue(json, TimeZone.class);
assertNotNull(tz1);

TimeZone tz2 = MAPPER.readValue(json, TimeZone.class);
assertNotNull(tz2);

assertEquals(tz1.getID(), tz2.getID());
}
}

5 changes: 3 additions & 2 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ Modules:

2.12.4 (not yet released

#131: Failing to serialize `Thread` returned by `Thread.currentThread()` when Afterburner
or Blackbird registered
#131: (afterburner) Failing to serialize `Thread` returned by `Thread.currentThread()`
when Afterburner or Blackbird registered
(reported by Liudapeng@github)
#132: (mrbean) (minimal) Prevent Mr Bean from materializing `java.util.TimeZone`

2.12.3 (12-Apr-2021)
2.12.2 (03-Mar-2021)
Expand Down

0 comments on commit 4b92a98

Please sign in to comment.