Backport JSONObject.wrap in order to support Jellybean (#3566)

This commit is contained in:
Jason Simmons
2017-04-06 10:15:06 -07:00
committed by GitHub
parent 9e59a83ac1
commit b4088b6479
6 changed files with 72 additions and 5 deletions
@@ -21,7 +21,7 @@ public final class JSONMethodCodec implements MethodCodec {
try {
final JSONObject map = new JSONObject();
map.put("method", methodCall.method);
map.put("args", JSONObject.wrap(methodCall.arguments));
map.put("args", JSONUtil.wrap(methodCall.arguments));
return JSONMessageCodec.INSTANCE.encodeMessage(map);
} catch (JSONException e) {
throw new IllegalArgumentException("Invalid JSON", e);
@@ -49,7 +49,7 @@ public final class JSONMethodCodec implements MethodCodec {
@Override
public ByteBuffer encodeSuccessEnvelope(Object result) {
return JSONMessageCodec.INSTANCE
.encodeMessage(new JSONArray().put(JSONObject.wrap(result)));
.encodeMessage(new JSONArray().put(JSONUtil.wrap(result)));
}
@Override
@@ -58,7 +58,7 @@ public final class JSONMethodCodec implements MethodCodec {
return JSONMessageCodec.INSTANCE.encodeMessage(new JSONArray()
.put(errorCode)
.put(errorMessage)
.put(JSONObject.wrap(errorDetails)));
.put(JSONUtil.wrap(errorDetails)));
}
@Override