String s = "{\"a\": [],}";
var tokener = new JSONTokener(s);
var value = tokener.nextValue();
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.json.JSONParserConfiguration.isStrictMode()" because "jsonParserConfiguration" is null
at org.json.JSONObject.<init>(JSONObject.java:280)
at org.json.JSONTokener.nextValue(JSONTokener.java:429)
at Scratch.main(scratch_3.java:8)
String s = "[1,]";
var tokener = new JSONTokener(s);
var value = tokener.nextValue();
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.json.JSONParserConfiguration.isStrictMode()" because "jsonParserConfiguration" is null
at org.json.JSONArray.<init>(JSONArray.java:144)
at org.json.JSONTokener.nextValue(JSONTokener.java:436)
at Scratch.main(scratch_3.java:8)
It looks like the parsing implementations in the JSONObject and JSONArray constructors that take a JSONTokener don't check if the configuration is null when encountering non-standard JSON input.