imagej / imagej-legacy

ImageJ+ImageJ2 compatibility layer
https://imagej.net/libs/imagej-legacy
BSD 2-Clause "Simplified" License
16 stars 25 forks source link

FileNotFoundException on directory drag and drop, SCIFIO on #284

Closed karlduderstadt closed 1 year ago

karlduderstadt commented 1 year ago

I discovered that I get a FileNotFoundException when dragging and dropping a directory with SCIFIO turned on. After the exception comes up the Image Sequence dialog also appears. With SCIFIO turned off, I do not get an exception.

Screenshot 2022-09-22 at 08 30 11
ctrueden commented 1 year ago

This issue happens due to a bug in SciJava Common's TextService, which was recently fixed: scijava/scijava-common@aa7fe2e241c9e5dcca2ffad7945475aca47dc72c. I have now released scijava-common 2.89.1 including this fix, and uploaded it to the core update site.

ksugar commented 1 year ago

@ctrueden Great!!! Using the fixed version, I could perform drag-and-drop of a directory with SCIFIO turned on without giving this error. I noticed that a directory with a name ending .txt (it's unusual) still gives this error. Is it the expected behavior?

ksugar commented 1 year ago

It seems that it's using TableIOPlugin.

[ERROR] java.io.FileNotFoundException: /home/user/directory.txt (Is a directory)
    at java.io.RandomAccessFile.open0(Native Method)
    at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
    at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
    at org.scijava.io.handle.FileHandle.initRAF(FileHandle.java:317)
    at org.scijava.io.handle.FileHandle.reader(FileHandle.java:298)
    at org.scijava.io.handle.FileHandle.length(FileHandle.java:112)
    at org.scijava.table.DefaultTableIOPlugin.open(DefaultTableIOPlugin.java:171)
    at org.scijava.table.DefaultTableIOPlugin.open(DefaultTableIOPlugin.java:158)
    at org.scijava.table.DefaultTableIOPlugin.open(DefaultTableIOPlugin.java:61)
    at org.scijava.table.io.TableIOPlugin.open(TableIOPlugin.java:48)
    at org.scijava.table.io.TableIOPlugin.open(TableIOPlugin.java:44)
    at org.scijava.io.AbstractIOPlugin.open(AbstractIOPlugin.java:82)
    at net.imagej.legacy.plugin.DefaultLegacyOpener.open(DefaultLegacyOpener.java:134)
    at net.imagej.legacy.DefaultLegacyHooks.interceptDragAndDropFile(DefaultLegacyHooks.java:417)
    at ij.plugin.DragAndDrop.openFile(DragAndDrop.java)
    at ij.plugin.DragAndDrop.run(DragAndDrop.java:160)
    at java.lang.Thread.run(Thread.java:748)
ctrueden commented 1 year ago

@ksugar Thanks for the report about the table plugin. I fixed it (scijava/scijava-table@f3b17b78) and released scijava-table 1.0.0. The scijava-plugins-io-table component is now retired, merged with scijava-table. I pushed the update to the core update site. Let me know how it works for you.