Clojure-Contrib

eof-value not working in clojure.contrib.json

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • 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))

Activity

Hide
Stuart Sierra added a comment -

References old github.com/richhickey repository; this has already been fixed.

Show
Stuart Sierra added a comment - References old github.com/richhickey repository; this has already been fixed.
Hide
Stuart Sierra added a comment -

You're using an old repository. This has been fixed. https://github.com/clojure/clojure-contrib

Show
Stuart Sierra added a comment - You're using an old repository. This has been fixed. https://github.com/clojure/clojure-contrib

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: