clojure url exception

91 views
Skip to first unread message

Brent Millare

unread,
Mar 3, 2012, 12:45:06 PM3/3/12
to clo...@googlegroups.com
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"

Andy Fingerhut

unread,
Mar 3, 2012, 3:08:42 PM3/3/12
to clo...@googlegroups.com
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

Andy Fingerhut

unread,
Mar 3, 2012, 3:23:21 PM3/3/12
to clo...@googlegroups.com
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

Brent Millare

unread,
Mar 17, 2012, 5:00:59 PM3/17/12
to clo...@googlegroups.com
I still see this in 1.4.0-beta5

Brent Millare

unread,
Mar 18, 2012, 8:38:55 PM3/18/12
to clo...@googlegroups.com
I created an issue, doesn't look like we are getting a big response on the clojure group, maybe clojure dev?

Michael Fogus

unread,
Mar 19, 2012, 10:07:57 AM3/19/12
to clo...@googlegroups.com
Explanation/clarification added to the ticket.
Reply all
Reply to author
Forward
0 new messages