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:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user