[CONTRIB-101] eof-value not working in clojure.contrib.json Created: 16/Nov/10 Updated: 18/Nov/10 Resolved: 18/Nov/10
|Reporter:||Pepijn de Vos||Assignee:||Stuart Sierra|
1.2 on Snow Leopard
The docs of read-json-from promise eof-error? and eof-value, but these fail to work. This is caused by lines 116-121: https://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/json.clj#L116-121
At EOF read returns -1, but evaluating (char -1) on the repl reveals that this does not work, and thus an exception is raised before eof-value could be returned.
This is easily fixed by checking if i is in a valid range, or at least not -1, by doing something like (and (not= i -1) (char i))
|Comment by Stuart Sierra [ 18/Nov/10 5:05 PM ]|
You're using an old repository. This has been fixed. https://github.com/clojure/clojure-contrib
|Comment by Stuart Sierra [ 18/Nov/10 5:07 PM ]|
References old github.com/richhickey repository; this has already been fixed.