Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6400

Object with array property fails on NPE when construction JSON object

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 7.7.0
    • Fix Version/s: 6.27.0, 7.8.0, 8.0.0-M7
    • Component/s: wicket
    • Labels:
    • Environment:
      Windows 8.1 64-bit, JDK8_121, Wicket 7.7.0, Jetty 9 / WebSphere 9

      Description

      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:

          public static void main(final String[] args) {
              final JSONArray array = new JSONArray(new Object[] { 1, 2, 3 });
              new JSONObject(array);
          }
      

      fails on:

      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)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mgrigorov Martin Tzvetanov Grigorov
                Reporter:
                davesman David Rain
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: