-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clojure.java.io/file throws Unhandled REPL handler exception processing message
#534
Comments
This is being caused by |
That’d be great!
…On Fri, 15 Jun 2018 at 16:37, Taylor Skidmore ***@***.***> wrote:
This is being caused by get-file-content returning nil and being passed
into re-find in normalize-content-type in cider.nrepl.middleware.slurp. I
have a patch working locally that I can PR if you'd like
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#534 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGVykCO_G5ubZsOuLpFZK-81IA9Bng7ks5t87iLgaJpZM4Upkht>
.
|
@bbatsov I actually am having trouble with one of the tests: |
I'll defer here to @arrdem. |
Sorry I didn't notice this - my GH notification fatigue is real atm. @taylskid AFAIK you shouldn't need to do anything specific, I thought I included the "sum types are cool" png in my original CIDER pr so it should just be in the repo. If it's not, I'd be happy to provide the one I developed against ;) This bug rots, but isn't super surprising. I think I've encountered this behavior as well. It may well be appropriate to add an extra layer of content-type guessing on the CIDER side of things, since there's a very short whitelist of supported content-types ATM. |
@taylskid Any update here? |
I just ran into this as well fwiw, when doing e.g. |
I think this is still a problem. I get it with (io/file ".") and pretty much anything other directory argument. Works when the argument is a file. |
I noted this on the slack channel, but this is related in the error, but not in the issue with directories mentioned above: (URL. "http://www.admin.ch/ch/e/rs/c221_302.html")
;; causes
;; ERROR: Unhandled REPL handler exception processing message {:op slurp, :url http://www.admin.ch/ch/e/rs/c221_302.html, :session <id>, :id <id>} Relevant stack trace:
|
I think one can easily reproduce this bug with: $ lein new foo && cd foo
Generating a project called bar based on the 'default' template.
The default template is intended for library projects, not applications.
To see other templates (app, plugin, etc), try `lein help new`.
$ clojure -Sdeps '{:deps {nrepl {:mvn/version "0.6.0"} cider/cider-nrepl {:mvn/version "0.24.0"}}}' -m nrepl.cmdline --middleware '["cider.nrepl/cider-middleware"]'
nREPL server started on port 45013 on host localhost - nrepl://localhost:45013 Then in emacs after ;; Connected to nREPL server - nrepl://localhost:34877
;; CIDER 0.24.0 (package: 20200215.223) (India), nREPL 0.6.0
;; Clojure 1.10.0, Java 11.0.6
;; Docs: (doc function-name)
;; (find-doc part-of-name)
;; Source: (source function-name)
;; Javadoc: (javadoc java-object-or-class)
;; Exit: <C-c C-q>
;; Results: Stored in vars *1, *2, *3, an exception in *e;
;; ======================================================================
;; [...]
;; ======================================================================
;; Startup: /home/bost/bin/lein update-in :dependencies conj \[nrepl\ \"0.6.0\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.24.0\"\] -- repl :headless :host localhost
foo.core> (clojure.java.io/file "/tmp")
#object[java.io.File 0x378ca1 "/tmp"]ERROR: Unhandled REPL handler exception processing message {:op slurp, :url file:/tmp/, :session cbe12710-4cea-48cb-bd70-6e6fa7531cd8, :id 29}
java.io.IOException: Is a directory
at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at java.base/sun.nio.ch.FileDispatcherImpl.read(FileDispatcherImpl.java:48)
at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:245)
at java.base/sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:223)
at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:109)
at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:103)
at java.base/java.nio.file.Files.read(Files.java:3158)
at java.base/java.nio.file.Files.readAllBytes(Files.java:3212)
at cider.nrepl.middleware.slurp$slurp_url_to_content_PLUS_body.invokeStatic(slurp.clj:90)
at cider.nrepl.middleware.slurp$slurp_url_to_content_PLUS_body.invoke(slurp.clj:82)
at cider.nrepl.middleware.slurp$handle_slurp.invokeStatic(slurp.clj:116)
at cider.nrepl.middleware.slurp$handle_slurp.invoke(slurp.clj:108)
at clojure.lang.Var.invoke(Var.java:388)
at cider.nrepl$wrap_slurp$fn__1586.invoke(nrepl.clj:95)
at nrepl.middleware$wrap_conj_descriptor$fn__628.invoke(middleware.clj:16)
at cider.nrepl$wrap_trace$fn__1734.invoke(nrepl.clj:426)
at nrepl.middleware$wrap_conj_descriptor$fn__628.invoke(middleware.clj:16)
at cider.nrepl$wrap_tracker$fn__1742.invoke(nrepl.clj:444)
at nrepl.middleware$wrap_conj_descriptor$fn__628.invoke(middleware.clj:16)
at nrepl.middleware.session$session$fn__1073.invoke(session.clj:272)
at nrepl.middleware$wrap_conj_descriptor$fn__628.invoke(middleware.clj:16)
at nrepl.server$handle_STAR_.invokeStatic(server.clj:18)
at nrepl.server$handle_STAR_.invoke(server.clj:15)
at nrepl.server$handle$fn__1110.invoke(server.clj:27)
at clojure.core$binding_conveyor_fn$fn__5739.invoke(core.clj:2030)
at clojure.lang.AFn.call(AFn.java:18)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834) Whereby in "plain" clojure-repl it works: $ clojure
Clojure 1.10.1
user=> (clojure.java.io/file "/tmp")
#object[java.io.File 0x1e287667 "/tmp"]
user=> @taylskid what about the patch you mentioned? Thanks. |
I think this features should be off by default. Those who explicitly want images in the repl can work around these edge cases but exposing these rough edges to general users seems to give all the problems without any desire for the benefits. |
I agree this should be off by default (that's on CIDER's end, though), but I also think we should try to fix the existing issues regardless. |
??? feature? |
@Bost See https://docs.cider.mx/cider/repl/configuration.html#_displaying_images_in_the_repl Basically the rich printing functionality is rough around the edges and causes issues like the one reported in this ticket. It's enabled by default, but we should probably disable it (at least until someone finds the time to polish it). |
This seems to be happening because of I think it can be fixed by adding a What do you think? @bbatsov |
Yep.
Yep, I think this is going to address the immediate issue. |
There's also one NPE lurking in |
Expected behavior
Actual behavior
Steps to reproduce the problem
Call
clojure.java.io/file
on a file in the replEnvironment & Version information
cider-nrepl version
0.18.0-SNAPSHOT (head)
Java version
1.8
Operating system
Mac OS X (10.13.5)
The text was updated successfully, but these errors were encountered: