diff --git a/java-api/src/org/servalproject/json/JsonParser.java b/java-api/src/org/servalproject/json/JsonParser.java index e6abca93..451b3436 100644 --- a/java-api/src/org/servalproject/json/JsonParser.java +++ b/java-api/src/org/servalproject/json/JsonParser.java @@ -111,7 +111,7 @@ public class JsonParser { if (current != ch) { return false; } - read(); + current=0; return true; } @@ -122,14 +122,8 @@ public class JsonParser { private void requireConstString(String str) throws IOException, JsonParseException{ // Check for every character, without attempting to read past the end - for(int i=0;i extends JsonTab } } + @Override + public T next() throws IOException, JsonParser.JsonParseException, E { + if (closed) + return null; + try { + return super.next(); + }catch (IOException | JsonParser.JsonParseException e){ + // don't throw if a close was triggered from another thread + if (closed) + return null; + throw e; + } + } + public void close() throws IOException { if (closed)