You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Holger Knublauch <ho...@knublauch.com> on 2013/10/14 02:00:06 UTC
JSON.parse("") causes follow-up errors
Test case:
import org.apache.jena.atlas.json.JSON;
import org.junit.Test;
public class JSONTest {
@Test
public void testRepeat() {
try {
JSON.parse("");
}
catch(Exception ex) {
// Ignore
System.out.println("Expected error " + ex);
}
JSON.parse("{}");
}
}
works fine if the first JSON.parse gets commented out, but reports
org.apache.jena.atlas.json.JsonParseException: Not a JSON object START:
[null]
at
org.apache.jena.atlas.json.io.parser.ParserBase.exception(ParserBase.java:130)
at org.apache.jena.atlas.json.io.parser.JSONP.parse(JSONP.java:49)
at
org.apache.jena.atlas.json.io.parser.JSONParser.parse(JSONParser.java:58)
at
org.apache.jena.atlas.json.io.parser.JSONParser.parse(JSONParser.java:52)
at org.apache.jena.atlas.json.JSON._parse(JSON.java:125)
at org.apache.jena.atlas.json.JSON._parse(JSON.java:105)
at org.apache.jena.atlas.json.JSON.parse(JSON.java:44)
at org.topbraid.jenax.test.JSONTest.testRepeat(JSONTest.java:17)
otherwise. The first parsing should not have an effect on subsequent
calls. Our work-around is not to ever call JSON.parse with an empty
string, so it's not high priority but I thought I'd report it anyway in
case there is a deeper problem (e.g. with concurrency of this class).
Thanks
Holger
Re: JSON.parse("") causes follow-up errors
Posted by Andy Seaborne <an...@apache.org>.
Holger,
Thanks - this is now fixed (the word "static" involved!)
Andy
BTW JIRA helps the project record what has done and helps other users
looking for related issues.
https://issues.apache.org/jira/browse/JENA-564
On 14/10/13 01:00, Holger Knublauch wrote:
> Test case:
>
> import org.apache.jena.atlas.json.JSON;
> import org.junit.Test;
>
> public class JSONTest {
>
> @Test
> public void testRepeat() {
> try {
> JSON.parse("");
> }
> catch(Exception ex) {
> // Ignore
> System.out.println("Expected error " + ex);
> }
> JSON.parse("{}");
> }
> }
>
> works fine if the first JSON.parse gets commented out, but reports
>
> org.apache.jena.atlas.json.JsonParseException: Not a JSON object START:
> [null]
> at
> org.apache.jena.atlas.json.io.parser.ParserBase.exception(ParserBase.java:130)
>
> at org.apache.jena.atlas.json.io.parser.JSONP.parse(JSONP.java:49)
> at
> org.apache.jena.atlas.json.io.parser.JSONParser.parse(JSONParser.java:58)
> at
> org.apache.jena.atlas.json.io.parser.JSONParser.parse(JSONParser.java:52)
> at org.apache.jena.atlas.json.JSON._parse(JSON.java:125)
> at org.apache.jena.atlas.json.JSON._parse(JSON.java:105)
> at org.apache.jena.atlas.json.JSON.parse(JSON.java:44)
> at org.topbraid.jenax.test.JSONTest.testRepeat(JSONTest.java:17)
>
> otherwise. The first parsing should not have an effect on subsequent
> calls. Our work-around is not to ever call JSON.parse with an empty
> string, so it's not high priority but I thought I'd report it anyway in
> case there is a deeper problem (e.g. with concurrency of this class).
>
> Thanks
> Holger
>