clojure url exception

91 megtekintés
Ugrás az első olvasatlan üzenetre

Brent Millare

olvasatlan,
2012. márc. 3. 12:45:062012. 03. 03.
– 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

olvasatlan,
2012. márc. 3. 15:08:422012. 03. 03.
– 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

olvasatlan,
2012. márc. 3. 15:23:212012. 03. 03.
– 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

olvasatlan,
2012. márc. 17. 17:00:592012. 03. 17.
– clo...@googlegroups.com
I still see this in 1.4.0-beta5

Brent Millare

olvasatlan,
2012. márc. 18. 20:38:552012. 03. 18.
– 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

olvasatlan,
2012. márc. 19. 10:07:572012. 03. 19.
– clo...@googlegroups.com
Explanation/clarification added to the ticket.
Válasz mindenkinek
Válasz a szerzőnek
Továbbítás
0 új üzenet