clojure url exception

Showing 1-6 of 6 messages
clojure url exception Brent Millare 3/3/12 9:45 AM
Is this a reader bug?

;user=> *clojure-version*
{:major 1, :minor 4, :incremental 0, :qualifier "alpha5"}
;user=> (.getProtocol #java.net.URL["file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"])
MalformedURLException no protocol: /home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs  java.net.URL.<init> (URL.java:583)
;user=> (.getProtocol (java.net.URL. "file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"))
"file"

Re: clojure url exception Andy Fingerhut 3/3/12 12:08 PM
I'm not sure what it is, but here is another transcript that may provide additional clues, and with a slightly later version of Clojure:

user=> (clojure-version)
"1.4.0-beta1"
user=> (def x #java.net.URL["file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"])
#'user/x
user=> x
#<URL file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs>
user=> (.getProtocol x)
"file"


user=> (.getProtocol #java.net.URL["file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"])
CompilerException java.lang.RuntimeException: Can't embed object in code, maybe print-dup not defined: file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs, compiling:(NO_SOURCE_PATH:5)
user=> (defmethod print-dup java.net.URL [o, ^java.io.Writer w] (.write w (str o)))
#<MultiFn clojure.lang.MultiFn@2e694f12>

user=> (.getProtocol #java.net.URL["file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"])
ClassCastException clojure.lang.Symbol cannot be cast to java.net.URL  user/eval11 (NO_SOURCE_FILE:7)
user=>


Andy

On Mar 3, 2012, at 9:45 AM, Brent Millare wrote:

> (.getProtocol #java.net.URL["file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"])

Re: clojure url exception Andy Fingerhut 3/3/12 12:23 PM
And another transcript that might help narrow this down:

user=> (clojure-version)
"1.4.0-beta1"
user=> (def x #java.net.URL["file:///home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"])
#'user/x
user=> (printf "(class x)=%s x='%s'\n" (class x) x)
(class x)=class java.net.URL x='file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs'
nil
user=> (let [x #java.net.URL["file:///home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"]]
(printf "(class x)=%s x='%s'\n" (class x) x))
CompilerException java.lang.RuntimeException: Can't embed object in code, maybe print-dup not defined: file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs, compiling:(NO_SOURCE_PATH:4)

user=> (defmethod print-dup java.net.URL [o, ^java.io.Writer w] (.write w (str o)))
#<MultiFn clojure.lang.MultiFn@3362a63>
user=> (let [x #java.net.URL["file:///home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"]]
(printf "(class x)=%s x='%s'\n" (class x) x))
(class x)=class clojure.lang.Symbol x='file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs'
nil

Andy

Re: clojure url exception Brent Millare 3/17/12 2:00 PM
I still see this in 1.4.0-beta5

Re: clojure url exception Brent Millare 3/18/12 5:38 PM
I created an issue, doesn't look like we are getting a big response on the clojure group, maybe clojure dev?

http://dev.clojure.org/jira/browse/CLJ-955 


On Saturday, March 17, 2012 5:00:59 PM UTC-4, Brent Millare wrote:
I still see this in 1.4.0-beta5

Re: clojure url exception Fogus 3/19/12 7:07 AM
Explanation/clarification added to the ticket.