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] [Closed] (FLEECE-7) JsonValue.java (json_1.0_spec) throws NPE
Date Sat, 12 Jul 2014 09:11:04 GMT

     [ https://issues.apache.org/jira/browse/FLEECE-7?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Hendrik Saly closed FLEECE-7.
-----------------------------

    Resolution: Fixed

> 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.
> {code}
> public String toString() {
>      return String.valueOf(null); //Line 38
> }
> {code}
> String.valueOf(null) is translated to String.valueOf((char[]) null) and that gives a
NPE.
> This can be fixed with
> {code}
> return String.valueOf((String)null));
> //or just
> return "null";
> {code}
> Consequence is that a test like the below would fail with NullPointerException:
> {code}
> @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()));
> }
> {code}



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

Mime
View raw message