<< Back to previous view

[CONTRIB-101] eof-value not working in clojure.contrib.json Created: 16/Nov/10  Updated: 18/Nov/10  Resolved: 18/Nov/10

Status: Closed
Project: Clojure-Contrib
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Pepijn de Vos Assignee: Stuart Sierra
Resolution: Declined Votes: 0
Labels: None
Environment:

1.2 on Snow Leopard



 Description   

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))



 Comments   
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.

Generated at Thu Nov 27 13:51:37 CST 2014 using JIRA 4.4#649-r158309.