felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Leangen (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FELIX-5358) Cannot deserialize empty Map
Date Fri, 23 Sep 2016 12:50:20 GMT
David Leangen created FELIX-5358:

             Summary: Cannot deserialize empty Map
                 Key: FELIX-5358
                 URL: https://issues.apache.org/jira/browse/FELIX-5358
             Project: Felix
          Issue Type: Bug
          Components: Converter
            Reporter: David Leangen

This is the stack trace:
java.lang.IllegalArgumentException: Malformatted JSON key-value pair: 
	at org.apache.felix.serializer.impl.json.JsonParser.parseKeyValue(JsonParser.java:93)
	at org.apache.felix.serializer.impl.json.JsonParser.parseObject(JsonParser.java:136)
	at org.apache.felix.serializer.impl.json.JsonParser.<init>(JsonParser.java:79)
	at org.apache.felix.serializer.impl.json.JsonDeserializingImpl.from(JsonDeserializingImpl.java:55)

Here is a test case that fails (with the above Exception):
    public void testEmptyMapSerialization() {
        Map<String, Object> m = new LinkedHashMap<>();
        String expected = "{}";
        assertEquals(expected, new JsonSerializerImpl().serialize(m).toString());
        Map<String, Object> m2 = new LinkedHashMap<>();
        Object o = new JsonSerializerImpl().deserialize( Map.class ).from( expected );

This message was sent by Atlassian JIRA

View raw message