Here is a snippet of code that fails on data.json 2.5.0:
clj -Sdeps '{:deps {org.clojure/data.json {:mvn/version "2.5.0"}}}' -M -e '((requiring-resolve (quote clojure.data.json/read)) (clojure.lang.LineNumberingPushbackReader. (java.io.StringReader. "[\n {\n \"name\": \"position\",\n \"type\": \"float32\",\n \"count\": 3,\n \"data\": [0,0,0]\n },\n {\n \"name\": \"normal\",\n \"type\": \"float32\",\n \"count\": 3,\n \"data\": [0,0,0]\n },\n {\n \"name\": \"texcoord0\",\n \"type\": \"float32\",\n \"count\": 2,\n \"data\": [0,0]\n }\n]")))'
Execution error (IOException) at java.io.PushbackReader/unread (PushbackReader.java:166).
Pushback buffer overflow
The same code succeeds on 2.4.0:
clj -Sdeps '{:deps {org.clojure/data.json {:mvn/version "2.4.0"}}}' -M -e '((requiring-resolve (quote clojure.data.json/read)) (clojure.lang.LineNumberingPushbackReader. (java.io.StringReader. "[\n {\n \"name\": \"position\",\n \"type\": \"float32\",\n \"count\": 3,\n \"data\": [0,0,0]\n },\n {\n \"name\": \"normal\",\n \"type\": \"float32\",\n \"count\": 3,\n \"data\": [0,0,0]\n },\n {\n \"name\": \"texcoord0\",\n \"type\": \"float32\",\n \"count\": 2,\n \"data\": [0,0]\n }\n]")))'
[{"name" "position", "type" "float32", "count" 3, "data" [0 0 0]} {"name" "normal", "type" "float32", "count" 3, "data" [0 0 0]} {"name" "texcoord0", "type" "float32", "count" 2, "data" [0 0]}]
The gist of the problem: previously, Clojure's line numbering pushback reader could be used as an input to read
. Now it can't: it throws an exception.
For reference, this is a json repro (a valid json!):
[
{
"name": "position",
"type": "float32",
"count": 3,
"data": [0,0,0]
},
{
"name": "normal",
"type": "float32",
"count": 3,
"data": [0,0,0]
},
{
"name": "texcoord0",
"type": "float32",
"count": 2,
"data": [0,0]
}
]
And, the formatted code: that uses the json:
(clojure.data.json/read
(clojure.lang.LineNumberingPushbackReader.
(java.io.StringReader. "...")))
It seems the problem is introduced in https://clojure.atlassian.net/browse/DJSON-50