Fork me on GitHub
#cider
<
2019-12-28
>
danielglauser16:12:39

Recently started coding after a bit of a hiatus. Previously when working with files or directories on the file system I’ve passed around http://java.io.File objects. Things work fine for files but I run a function in the REPL that returns a http://java.io.File object that corresponds to a directory I get an exception in the REPL.

( "/tmp")

#object[.File 0x62d0be87 "/tmp"]ERROR: Unhandled REPL handler exception processing message {:op slurp, :url file:/private/tmp/, :session 8e4e013a-57b2-472d-8fb7-bbcaf27fb7ba, :id 39}
.IOException: Is a directory
        at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
        at sun.nio.ch.FileDispatcherImpl.read(FileDispatcherImpl.java:46)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
        at sun.nio.ch.IOUtil.read(IOUtil.java:197)
        at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:159)
        at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
        at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:109)
        at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:103)
        at java.nio.file.Files.read(Files.java:3105)
        at java.nio.file.Files.readAllBytes(Files.java:3158)
        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)

danielglauser16:12:26

Using cider 0.23.0 and cider/cider-nrepl "0.22.4"

dpsutton16:12:03

https://docs.cider.mx/cider/repl/configuration.html see the section on images in the repl. It works by just fetching urls and it’s a bad default I think

👍 1
bozhidar07:12:46

Yeah, probably this should be disabled, but then I doubt we’ll ever fix it that way. The problem is long-standing and no one tried to tackle it so far. I might just delete this functionality and consider it a failed experiment.

👍 1
bozhidar07:12:33

That particular issues seems trivial, though, and is easily fixable.

mikerod22:12:09

This issue has occurred for me before as well. A coworker had it happening and I had to help diagnose it as a cider issue they were seeing. Was an NPE on this content type thing. And he wasn’t trying to look at an image or anything like that.

dpsutton16:12:15

Turn it off and it should be fine

frozenlock17:12:21

@dpsutton Thank you so much for this. I was wondering why I was getting weird things in my repl when handling files.

cider 1
danielglauser17:12:17

Sweet! That worked, thanks Dan.

cider 1