2010/5/11 Stuart Halloway <[email protected]>
> Assembla Ticket #311 [1] calls for the promotion of clojure.contrib.iointo
> clojure (as
> clojure.java.io). I have attached a patch, and am requesting comments and
> code review from the community.
I think I have found a bug in the clojure.contrib.io code.
The current 1.2 master branch contains the following :
(extend Socket
IOFactory
(assoc default-streams-impl
:make-input-stream (fn [^Socket x opts] (.getInputStream x))
:output-stream (fn [^Socket x opts] (output-stream (.getOutputStream
x) opts))))
Note that :output-stream is not part of the IOFactory protocol. The intended
keyword was most probably :make-output-stream. Also, the body should not
contain a call to output-stream, since it calls make-output-stream. I
propose that the last line is changed so that the code becomes the
following:
(extend Socket
IOFactory
(assoc default-streams-impl
:make-input-stream (fn [^Socket x opts] (.getInputStream x))
:make-output-stream (fn [^Socket x opts] (.getOutputStream x))))
Now, one can make output streams from sockets again (this threw an
exception[1] before):
(output-stream (Socket. "example.com" 1234))
So what is the next step for me now? I am not formally a contributor yet. It
will take approx a week until my signed CA arrives. I will gladly help with
whatever I can do in the mean time...
// raek
[1] The exception: java.lang.IllegalArgumentException: Cannot open <#<Socket
Socket[addr=clojure.org/75.126.104.177,port=80,localport=50897]>> as an
OutputStream.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en