MastodonC/kixi.hecuba

Most uses of read-string in hecuba should be replaced.

Opened this issue · 2 comments

sw1nn commented

If we are reading user data, in particular numbers, we cannot use read-string because it has features that users of the api do not expect.

e.g. measurements where the value is '09'

(read-string "09")
NumberFormatException Invalid number: 09  clojure.lang.LispReader.readNumber (LispReader.java:256)         

There's an example in kixi.hecuba.time/in-interval? which parses dates with read-string

This won't work if the start or the end time is HH:08 or HH:09

My recommendation is that numbers are always parsed with

Integer/parseInt or Long/parseLong or Float/parseFloat or Double/parseDouble

dates and times should always be parsed with a date/time library (clj-time), 'cos the rules are so arcane that no reasonable person can be expected to know them.

Sorry, I added a new file to the gist.
This exception is in: https://gist.github.com/Eleonore9/f747540d919f6f1a8fde#file-log-dse00-18092015-rollups