Commit 51dba333 authored by Spiros Koulouzis's avatar Spiros Koulouzis

check if key is present

parent 698454ae
...@@ -468,33 +468,34 @@ public class DeployService { ...@@ -468,33 +468,34 @@ public class DeployService {
jo.put("result", result); jo.put("result", result);
} }
} }
JSONObject invocation = ((JSONObject) (result).get("invocation")); if (result.has("invocation")) {
if (invocation.has("module_args")) { JSONObject invocation = ((JSONObject) (result).get("invocation"));
JSONObject module_args = (JSONObject) invocation.get("module_args"); if (invocation.has("module_args")) {
if (module_args.has("msg")) { JSONObject module_args = (JSONObject) invocation.get("module_args");
if (module_args.has("msg")) {
String msg;
try {
msg = (String) module_args.get("msg");
} catch (java.lang.ClassCastException ex) {
JSONObject message = (JSONObject) module_args.get("msg");
msg = Converter.jsonObject2String(message.toString());
module_args.put("msg", msg);
invocation.put("module_args", module_args);
}
}
}
if (invocation.has("msg")) {
String msg; String msg;
try { try {
msg = (String) module_args.get("msg"); msg = (String) invocation.get("msg");
} catch (java.lang.ClassCastException ex) { } catch (java.lang.ClassCastException ex) {
JSONObject message = (JSONObject) module_args.get("msg"); JSONObject message = (JSONObject) invocation.get("msg");
msg = Converter.jsonObject2String(message.toString()); msg = Converter.jsonObject2String(message.toString());
module_args.put("msg", msg); invocation.put("msg", msg);
invocation.put("module_args", module_args); result.put("invocation", invocation);
} }
} }
} }
if (invocation.has("msg")) {
String msg;
try {
msg = (String) invocation.get("msg");
} catch (java.lang.ClassCastException ex) {
JSONObject message = (JSONObject) invocation.get("msg");
msg = Converter.jsonObject2String(message.toString());
invocation.put("msg", msg);
result.put("invocation", invocation);
}
}
newJa.put(jo); newJa.put(jo);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment