johnzon-dev mailing list archives

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

             Summary: (json_1.0_spec) throws NPE
                 Key: FLEECE-7
             Project: Fleece
          Issue Type: Bug
            Reporter: Hendrik Saly
            Priority: Blocker

On line 38 in the file
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:

    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

View raw message