forked from I2P_Developers/i2p.i2p
Util: Update json-simple lib to 2.3.0 2017-10-04
Bundle 2.0 API only; remove 1.1 API Convert DoH, NDT, and i2pcontrol to the 2.x API Fix i2pcontrol handling of number values and serialization for 2.x API Remove xenial dependency on libjson-simple-java, it has only 1.1 Set min and max version constraint on libjson-simple-java for bionic+ Based on patch from Gilles Filippini ref: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=901827 This does not support 3.x but the patch for that will be smaller.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package com.thetransactioncompany.jsonrpc2;
|
||||
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.JsonObject;
|
||||
|
||||
|
||||
/**
|
||||
@@ -220,7 +220,7 @@ public class JSONRPC2Error extends Exception {
|
||||
* @see #toJSONObject
|
||||
*/
|
||||
@Deprecated
|
||||
public JSONObject toJSON() {
|
||||
public JsonObject toJSON() {
|
||||
|
||||
return toJSONObject();
|
||||
}
|
||||
@@ -231,9 +231,9 @@ public class JSONRPC2Error extends Exception {
|
||||
*
|
||||
* @return A JSON object representing this error object.
|
||||
*/
|
||||
public JSONObject toJSONObject() {
|
||||
public JsonObject toJSONObject() {
|
||||
|
||||
JSONObject out = new JSONObject();
|
||||
JsonObject out = new JsonObject();
|
||||
|
||||
out.put("code", code);
|
||||
out.put("message", super.getMessage());
|
||||
|
||||
@@ -5,8 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.json.simple.JSONAware;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.JsonObject;
|
||||
|
||||
|
||||
/**
|
||||
@@ -54,7 +53,7 @@ import org.json.simple.JSONObject;
|
||||
*
|
||||
* @author Vladimir Dzhuvinov
|
||||
*/
|
||||
public abstract class JSONRPC2Message implements JSONAware {
|
||||
public abstract class JSONRPC2Message {
|
||||
|
||||
|
||||
/**
|
||||
@@ -220,7 +219,7 @@ public abstract class JSONRPC2Message implements JSONAware {
|
||||
*
|
||||
* @return The JSON object.
|
||||
*/
|
||||
public abstract JSONObject toJSONObject();
|
||||
public abstract JsonObject toJSONObject();
|
||||
|
||||
|
||||
/**
|
||||
@@ -246,6 +245,6 @@ public abstract class JSONRPC2Message implements JSONAware {
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
return toJSONObject().toString();
|
||||
return toJSONObject().toJson();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.thetransactioncompany.jsonrpc2;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.JsonObject;
|
||||
|
||||
|
||||
/**
|
||||
@@ -414,9 +414,9 @@ public class JSONRPC2Notification extends JSONRPC2Message {
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject toJSONObject() {
|
||||
public JsonObject toJSONObject() {
|
||||
|
||||
JSONObject notf = new JSONObject();
|
||||
JsonObject notf = new JsonObject();
|
||||
|
||||
notf.put("method", method);
|
||||
|
||||
|
||||
@@ -4,9 +4,8 @@ package com.thetransactioncompany.jsonrpc2;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.json.simple.parser.ContainerFactory;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
import org.json.simple.Jsoner;
|
||||
import org.json.simple.DeserializationException;
|
||||
|
||||
|
||||
/**
|
||||
@@ -56,12 +55,6 @@ import org.json.simple.parser.ParseException;
|
||||
public class JSONRPC2Parser {
|
||||
|
||||
|
||||
/**
|
||||
* Reusable JSON parser. Not thread-safe!
|
||||
*/
|
||||
private final JSONParser parser;
|
||||
|
||||
|
||||
/**
|
||||
* If {@code true} the order of the parsed JSON object members must be
|
||||
* preserved.
|
||||
@@ -153,10 +146,7 @@ public class JSONRPC2Parser {
|
||||
public JSONRPC2Parser(final boolean preserveOrder,
|
||||
final boolean ignoreVersion,
|
||||
final boolean parseNonStdAttributes) {
|
||||
|
||||
// Numbers parsed as long/double, requires JSON Smart 1.0.9+
|
||||
parser = new JSONParser();
|
||||
|
||||
|
||||
this.preserveOrder = preserveOrder;
|
||||
this.ignoreVersion = ignoreVersion;
|
||||
this.parseNonStdAttributes = parseNonStdAttributes;
|
||||
@@ -189,13 +179,9 @@ public class JSONRPC2Parser {
|
||||
|
||||
// Parse the JSON string
|
||||
try {
|
||||
//if (preserveOrder)
|
||||
// json = parser.parse(jsonString, ContainerFactory.FACTORY_ORDERED);
|
||||
|
||||
//else
|
||||
json = parser.parse(jsonString);
|
||||
json = Jsoner.deserialize(jsonString);
|
||||
|
||||
} catch (ParseException e) {
|
||||
} catch (DeserializationException e) {
|
||||
|
||||
// Terse message, do not include full parse exception message
|
||||
throw new JSONRPC2ParseException("Invalid JSON",
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.thetransactioncompany.jsonrpc2;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.JsonObject;
|
||||
|
||||
|
||||
/**
|
||||
@@ -472,9 +472,9 @@ public class JSONRPC2Request extends JSONRPC2Message {
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject toJSONObject() {
|
||||
public JsonObject toJSONObject() {
|
||||
|
||||
JSONObject req = new JSONObject();
|
||||
JsonObject req = new JsonObject();
|
||||
|
||||
req.put("method", method);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.thetransactioncompany.jsonrpc2;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.JsonObject;
|
||||
|
||||
|
||||
/**
|
||||
@@ -384,9 +384,9 @@ public class JSONRPC2Response extends JSONRPC2Message {
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject toJSONObject() {
|
||||
public JsonObject toJSONObject() {
|
||||
|
||||
JSONObject out = new JSONObject();
|
||||
JsonObject out = new JsonObject();
|
||||
|
||||
// Result and error are mutually exclusive
|
||||
if (error != null) {
|
||||
|
||||
Reference in New Issue
Block a user