dave
2018-10-28 23:10:15 UTC
Hi,
I am attempting to upgrade from TomEE 7.0.4 (Johnzon 1.0.0) to TomEE 7.1.0
(Johnzon 1.0.1) and have encountered a change in behaviour with JSON
deserialization. The below test passes with Johnzon 1.0.0 but fails with
1.0.1.
Tracing this through with the different Johnzon versions it appears the
cause is FieldAccessMode.field() method excluding final fields in 1.0.1.
Johnzon no longer regards the map field "m" as writeable so silently skips
attempting to put its contents. Removing the final modifier from the map
avoids the issue.
Is this behaviour considered erroneous?
Thanks,
Dave
public class JohnzonMapperTest
{
@Test
public void testFinalMap()
throws Exception
{
WithFinalMap o = new
MapperBuilder().build().readObject("{\"m\":{\"A\":\"a\"}}", WithMap.class);
assertEquals("a", o.m.get("A"));
}
public static class WithFinalMap
{
public final Map<String, Object> m = new HashMap<>();
}
}
--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html
I am attempting to upgrade from TomEE 7.0.4 (Johnzon 1.0.0) to TomEE 7.1.0
(Johnzon 1.0.1) and have encountered a change in behaviour with JSON
deserialization. The below test passes with Johnzon 1.0.0 but fails with
1.0.1.
Tracing this through with the different Johnzon versions it appears the
cause is FieldAccessMode.field() method excluding final fields in 1.0.1.
Johnzon no longer regards the map field "m" as writeable so silently skips
attempting to put its contents. Removing the final modifier from the map
avoids the issue.
Is this behaviour considered erroneous?
Thanks,
Dave
public class JohnzonMapperTest
{
@Test
public void testFinalMap()
throws Exception
{
WithFinalMap o = new
MapperBuilder().build().readObject("{\"m\":{\"A\":\"a\"}}", WithMap.class);
assertEquals("a", o.m.get("A"));
}
public static class WithFinalMap
{
public final Map<String, Object> m = new HashMap<>();
}
}
--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html