Commit 67fd171f authored by Stephan Kreutzer's avatar Stephan Kreutzer

json_to_xml_2: Support for empty JSON object.

parent f663c67e
......@@ -74,9 +74,25 @@ public class ParserJson
protected int HandleObjectContent() throws IOException
{
consumeWhitespace();
JsonNode node = lookAhead();
if (node == null)
{
throw constructTermination("messageParserNoMoreTokens", null, null);
}
if (node.getToken().equals("}") == true)
{
nextNode();
return 0;
}
do
{
consumeWhitespace();
match("\"");
String name = HandleString().toString();
......@@ -92,7 +108,7 @@ public class ParserJson
match(":");
consumeWhitespace();
JsonNode node = nextNode();
node = nextNode();
if (node.getToken().equals("{") == true)
{
......@@ -269,6 +285,11 @@ public class ParserJson
{
node = lookAhead();
if (node == null)
{
throw constructTermination("messageParserNoMoreTokens", null, null);
}
if (node.getToken().length() < 4)
{
throw constructTermination("messageParserEscapeSequenceIncomplete", null, null, "\\u" + node.getToken());
......
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