throw new SerializationException("Error parsing JSON, unmatched brace.");\r
else\r
throw new SerializationException("Error parsing JSON, unmatched bracket.");\r
+ } else if (parseRuntimeEx != null) {\r
+ throw new SerializationException("Error parsing JSON: " + new String(data), parseRuntimeEx);\r
}\r
JsonValue root = this.root;\r
this.root = null;\r
\r
private void addChild (String name, JsonValue child) {\r
child.setName(name);\r
- if (current.isArray() || current.isObject())\r
+ if (current == null) {\r
+ current = child;\r
+ root = child;\r
+ } else if (current.isArray() || current.isObject())\r
current.addChild(child);\r
else\r
root = current;\r
int lineNumber = 1;\r
for (int i = 0; i < p; i++)\r
if (data[i] == '\n') lineNumber++;\r
- throw new SerializationException("Error parsing JSON on line " + lineNumber + " near: " + new String(data, p, pe - p), parseRuntimeEx);\r
+ throw new SerializationException("Error parsing JSON on line " + lineNumber + " near: " + new String(data, p, pe - p),\r
+ parseRuntimeEx);\r
} else if (elements.size != 0) {\r
JsonValue element = elements.peek();\r
elements.clear();\r
throw new SerializationException("Error parsing JSON, unmatched brace.");\r
else\r
throw new SerializationException("Error parsing JSON, unmatched bracket.");\r
+ } else if (parseRuntimeEx != null) {\r
+ throw new SerializationException("Error parsing JSON: " + new String(data), parseRuntimeEx);\r
}\r
JsonValue root = this.root;\r
this.root = null;\r
\r
private void addChild (String name, JsonValue child) {\r
child.setName(name);\r
- if (current.isArray() || current.isObject())\r
+ if (current == null) {\r
+ current = child;\r
+ root = child;\r
+ } else if (current.isArray() || current.isObject())\r
current.addChild(child);\r
else\r
root = current;\r