Changeset 16767 in josm


Ignore:
Timestamp:
2020-07-14T20:01:42+02:00 (4 weeks ago)
Author:
simon04
Message:

fix #19436 - RequestProcessor: do not add null objects to a JsonArray (patch by taylor.smock, modified)

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java

    r16587 r16767  
    408408        JsonArrayBuilder json = Json.createArrayBuilder();
    409409        for (String s : Utils.firstNonNull(handlers, RequestProcessor.handlers.keySet())) {
    410             json.add(getHandlerInfoAsJSON(s));
     410            JsonObject infoAsJson = getHandlerInfoAsJSON(s);
     411            if (infoAsJson != null) {
     412                json.add(infoAsJson);
     413            }
    411414        }
    412415        return json.build();
     
    420423    public static JsonObject getHandlerInfoAsJSON(String cmd) {
    421424        RequestHandler handler;
     425        if (cmd == null) {
     426            return null;
     427        }
     428        if (!cmd.startsWith("/")) {
     429            cmd = "/" + cmd;
     430        }
    422431        try {
    423432            Class<?> c = handlers.get(cmd);
Note: See TracChangeset for help on using the changeset viewer.