fleece-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hendrik Saly (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FLEECE-7) JsonValue.java (json_1.0_spec) throws NPE
Date Fri, 11 Jul 2014 23:17:05 GMT
Hendrik Saly created FLEECE-7:
---------------------------------

             Summary: JsonValue.java (json_1.0_spec) throws NPE
                 Key: FLEECE-7
                 URL: https://issues.apache.org/jira/browse/FLEECE-7
             Project: Fleece
          Issue Type: Bug
            Reporter: Hendrik Saly
            Priority: Blocker


On line 38 in the file http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonValue.java?revision=1598683&view=markup
a NPE will occur.

public String toString() {

38:   return String.valueOf(null);

}


String.valueOf(null) is translated to String.valueOf((char[]) null) and that gives a NPE.

This can be fixed with

return String.valueOf((String)null));

or just

return "null";


Consequence is that a test like the below would fail with NullPointerException:

@Test
    public void nullLiteralArray() {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream();      Json.createGenerator(baos).writeStartArray().writeNull().write(JsonValue.NULL).writeEnd().close();
        assertEquals("[null,null]", new String(baos.toByteArray()));
    }




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message