<< Back to previous view

[CLJ-912] clojure.java.browse/browse-url fails to open http://localhost:3000 with swing backend Created: 17/Jan/12  Updated: 12/Mar/12  Resolved: 12/Mar/12

Status: Closed
Project: Clojure
Component/s: None
Affects Version/s: Release 1.3
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Dmitri Naumov Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: None


 Description   

I've got the following exception after launching (clojure.java.browse/browse-url "http://localhost:3000"):

java.lang.RuntimeException: java.io.FileNotFoundException: http://localhost:3000
at clojure.lang.Util.runtimeException(Util.java:165)
at clojure.lang.Reflector.invokeConstructor(Reflector.java:193)
at clojure.java.browse_ui$open_url_in_swing.invoke(browse_ui.clj:15)
at clojure.lang.Var.invoke(Var.java:401)
at clojure.java.browse$open_url_in_swing.invoke(browse.clj:44)
at clojure.java.browse$browse_url.invoke(browse.clj:52)
at user$eval1689.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6465)
at clojure.lang.Compiler.eval(Compiler.java:6431)
at clojure.core$eval.invoke(core.clj:2795)
at swank.commands.basic$eval_region.invoke(basic.clj:47)
at swank.commands.basic$eval_region.invoke(basic.clj:37)
at swank.commands.basic$eval845$listener_eval__846.invoke(basic.clj:71)
at clojure.lang.Var.invoke(Var.java:401)
at user$eval1687.invoke(NO_SOURCE_FILE)
at clojure.lang.Compiler.eval(Compiler.java:6465)
at clojure.lang.Compiler.eval(Compiler.java:6431)
at clojure.core$eval.invoke(core.clj:2795)
at swank.core$eval_in_emacs_package.invoke(core.clj:92)
at swank.core$eval_for_emacs.invoke(core.clj:239)
at clojure.lang.Var.invoke(Var.java:409)
at clojure.lang.AFn.applyToHelper(AFn.java:167)
at clojure.lang.Var.applyTo(Var.java:518)
at clojure.core$apply.invoke(core.clj:600)
at swank.core$eval_from_control.invoke(core.clj:99)
at swank.core$eval_loop.invoke(core.clj:104)
at swank.core$spawn_repl_thread$fn_527$fn_528.invoke(core.clj:309)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:600)
at swank.core$spawn_repl_thread$fn__527.doInvoke(core.clj:306)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.run(AFn.java:24)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.io.FileNotFoundException: http://localhost:3000
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1458)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1452)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1106)
at javax.swing.JEditorPane.getStream(JEditorPane.java:827)
at javax.swing.JEditorPane.setPage(JEditorPane.java:433)
at javax.swing.JEditorPane.setPage(JEditorPane.java:939)
at javax.swing.JEditorPane.<init>(JEditorPane.java:273)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at clojure.lang.Reflector.invokeConstructor(Reflector.java:183)
... 32 more
Caused by: java.io.FileNotFoundException: http://localhost:3000
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1401)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:397)
at javax.swing.JEditorPane.getStream(JEditorPane.java:792)
... 40 more

It works with urls like http://google.com:80, so probably the problem is in the combination of one-segment domen and port.

Note: I use Ubuntu 11.10 with Chromium as a default browser. I'm not sure why browse-url fails to open urls via standart browser. Should I create another issue for that or is it a java problem?



 Comments   
Comment by Andy Fingerhut [ 29/Feb/12 1:38 PM ]

Dmitri: CLJ-896 has a patch that changes browse-url to use the command line tool xdg-open instead of Java Swing. If the command:

xdg-open http://localhost:3000

works on your system from the command line, then that patch will probably also make (browse-url "http://localhost:3000") work, too.

I tried (browse-url "http://localhost:3000") on an Ubuntu 10.04 LTS system using Sun/Oracle's JVM 1.6.0_26, and it worked. Which JVM are you using?

Comment by Dmitri Naumov [ 12/Mar/12 1:09 PM ]

I tried it again and now I can't reproduce it - browse-url works as expected and Swing gui also works when launched manually. I use openjdk, so maybe it was a problem with its classes? Anyway, the issue should be closed.
Sorry for bothering you.

Comment by Andy Fingerhut [ 12/Mar/12 1:17 PM ]

I'm not sure if this should be marked with a Resolution of Declined or Completed, if the issue cannot be reproduced. I'm picking Declined for this change. Feel free to change it if I've picked incorrectly.

Comment by Dmitri Naumov [ 12/Mar/12 1:24 PM ]

Yeah, I also think Declined is correct.

Generated at Tue Jul 29 03:45:57 CDT 2014 using JIRA 4.4#649-r158309.