You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2017/06/22 19:45:00 UTC

[jira] [Commented] (WICKET-6400) Object with array property fails on NPE when construction JSON object

    [ https://issues.apache.org/jira/browse/WICKET-6400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16059901#comment-16059901 ] 

Martin Grigorov commented on WICKET-6400:
-----------------------------------------

As discussed at https://github.com/openjson/openjson/issues/9 the fix will behave as JSON.org, i.e. it will produce an empty object.

> Object with array property fails on NPE when construction JSON object
> ---------------------------------------------------------------------
>
>                 Key: WICKET-6400
>                 URL: https://issues.apache.org/jira/browse/WICKET-6400
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 7.7.0
>         Environment: Windows 8.1 64-bit, JDK8_121, Wicket 7.7.0, Jetty 9 / WebSphere 9
>            Reporter: David Rain
>              Labels: json, open-json
>
> If we have an Object (POJO) that includes array(s), it fails on java.lang.NullPointerException when I pass it as an argument to the JSONObject constructor.
> The cause is that JSONArray cannot be included in tje JSONObject anymore because of absence of some readMethods (it fails on NPE at line 234 in JSONObject). I assume this is caused by switching to open-json.
> Simpliest example:
> {code:java}
>     public static void main(final String[] args) {
>         final JSONArray array = new JSONArray(new Object[] { 1, 2, 3 });
>         new JSONObject(array);
>     }
> {code}
> fails on:
> {noformat}
> Exception in thread "main" java.lang.NullPointerException
> 	at org.apache.wicket.ajax.json.JSONObject.propertiesAsMap(JSONObject.java:234)
> 	at org.apache.wicket.ajax.json.JSONObject.<init>(JSONObject.java:225)
> 	at cz.kb.dcs.module_frontend_base.components.graph.renderer.GraphRendererJSONUtils.main(GraphRendererJSONUtils.java:53)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)