<< Back to previous view

[CONTRIB-83] clojure.contrib.shell broken with clojure commit 37d8f7a Created: 12/May/10  Updated: 08/Jan/11

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

Type: Defect Priority: Minor
Reporter: Assembla Importer Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


clojure.core/byte was modified a couple weeks ago as follows:

(defn byte
"Coerce to byte"
{:tag Byte
:inline (fn [x] `(. clojure.lang.RT (byteCast ~x)))}

  • [^Number x] (. x (byteValue)))
    + [^Number x] (clojure.lang.RT/byteCast x))

byteValue and byteCast behave differently with values outside the
range of byte values:
user=> (. 255 (byteValue))
user=> (clojure.lang.RT/byteCast 255)
java.lang.IllegalArgumentException: Value out of range for byte: 255

The new version breaks clojure.contrib.shell/sh's :out :bytes mode (mapping byte over values returned by InputStream.read in shell.clj, line 125).
Perhaps have sh use #(.byteValue %) instead of byte? (untested)

Comment by Assembla Importer [ 24/Aug/10 11:01 AM ]

Converted from http://www.assembla.com/spaces/clojure/tickets/83

Comment by Allen Rohner [ 08/Jan/11 1:58 PM ]

I've tested that using #(.byteValue %) rather than byte? fixes the problem.

Generated at Wed Jan 24 05:05:39 CST 2018 using JIRA 4.4#649-r158309.