Fixing JSON parser.
authorTomas Zezula <tzezula@netbeans.org>
Thu, 30 Jan 2014 11:42:10 +0100
changeset 18135ec73b98ea30c
parent 18134 0dc992ef29e3
child 18136 f7eb8650b427
Fixing JSON parser.
Fixing missing debugger ActionsManager.
dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/AbstractCommandHandler.java
json/src/org/netbeans/modules/json/support/JSON.java
     1.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/AbstractCommandHandler.java	Thu Jan 30 09:46:18 2014 +0100
     1.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/AbstractCommandHandler.java	Thu Jan 30 11:42:10 2014 +0100
     1.3 @@ -82,7 +82,7 @@
     1.4              if (!(jpda instanceof JPDADebuggerImpl)) {
     1.5                  throw new IllegalStateException("Wrong debugger service.");    //NOI18N
     1.6              }
     1.7 -            final ActionsManager actionsManager = debugSession.lookupFirst(null, ActionsManager.class);
     1.8 +            final ActionsManager actionsManager = debugSession.getCurrentEngine().getActionsManager();
     1.9              if (actionsManager == null) {
    1.10                  throw new IllegalStateException("No ActionsManager.");    //NOI18N
    1.11              }
     2.1 --- a/json/src/org/netbeans/modules/json/support/JSON.java	Thu Jan 30 09:46:18 2014 +0100
     2.2 +++ b/json/src/org/netbeans/modules/json/support/JSON.java	Thu Jan 30 11:42:10 2014 +0100
     2.3 @@ -51,6 +51,7 @@
     2.4  import java.util.logging.Level;
     2.5  import java.util.logging.Logger;
     2.6  import net.java.html.json.Model;
     2.7 +import org.json.simple.JSONArray;
     2.8  import org.json.simple.JSONObject;
     2.9  import org.json.simple.JSONValue;
    2.10  
    2.11 @@ -89,6 +90,14 @@
    2.12              for (int i = 0; i < props.length; i++) {
    2.13                  try {
    2.14                      values[i] = obj.containsKey(props[i]) ? obj.get(props[i]) : null;
    2.15 +                    if (values[i] instanceof JSONArray) {
    2.16 +                        JSONArray jsarr = (JSONArray) values[i];
    2.17 +                        Object[] arr = new Object[jsarr.size()];
    2.18 +                        for (int j=0; j< jsarr.size(); j++) {
    2.19 +                            arr[j] = jsarr.get(j);
    2.20 +                        }
    2.21 +                        values[i] = arr;
    2.22 +                    }
    2.23                  } catch (Exception ex) {
    2.24                      LOG.log(Level.SEVERE, "Can't read " + props[i] + " from " + jsonObject, ex);
    2.25                  }