eclipse-ee4j / eclipse-ee4j/parsson
JsonReader consumes/skips-over trailing content in input stream
- Dominant language
- Java
- Stars
- 17
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
The JsonReader seems to be greedy, in that it consumes any content after the first JSON value it finds in the input stream. E.g., in the following example, the trailing " 0" content is skipped over.
```
public static void main(String[] args) throws IOException {
StringReader sr = new StringReader("[] 0"); // Note, string has trailing content.
JsonReader jr = Json.createReader(sr);
JsonStructure js = jr.read();
if (sr.read() != -1) {
throw null;
}
System.out.println(js);
}
```
Is this intentional? It would seem more logical to either not consume the trailing content, or to throw a parsing exception.
Contributor guide
Assessment
This issue has not been assessed yet.