Skip to content
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

Opening non-existing files throws NPE #35

Closed
dscho opened this issue Jun 5, 2014 · 4 comments
Closed

Opening non-existing files throws NPE #35

dscho opened this issue Jun 5, 2014 · 4 comments
Assignees

Comments

@dscho
Copy link
Contributor

dscho commented Jun 5, 2014

It shows this exception:

(Fiji Is Just) ImageJ 2.0.0-rc-2; Java 1.6.0_24 [64-bit]; Linux 3.2.0-64-generic; 27MB of 10279MB (<1%)

java.lang.UnsupportedOperationException: Attempting to read or write from a io.scif.io.VirtualHandle. There is no source to operate on.
    at io.scif.io.VirtualHandle.readFully(VirtualHandle.java:141)
    at io.scif.io.RandomAccessInputStream.readFully(RandomAccessInputStream.java:474)
    at io.scif.io.RandomAccessInputStream.readString(RandomAccessInputStream.java:397)
    at io.scif.ome.formats.OMEXMLFormat$Checker.isFormat(OMEXMLFormat.java:232)
    at io.scif.AbstractChecker.isFormat(AbstractChecker.java:91)
    at io.scif.services.DefaultFormatService.getFormatList(DefaultFormatService.java:289)
    at io.scif.services.DefaultFormatService.getFormat(DefaultFormatService.java:271)
    at net.imagej.DefaultDatasetService.canOpen(DefaultDatasetService.java:215)
    at net.imagej.io.DatasetIOPlugin.supportsOpen(DatasetIOPlugin.java:66)
    at org.scijava.io.DefaultIOService.getOpener(DefaultIOService.java:66)
    at net.imagej.legacy.plugin.DefaultLegacyOpener.open(DefaultLegacyOpener.java:129)
    at net.imagej.legacy.DefaultLegacyHooks.interceptFileOpen(DefaultLegacyHooks.java:427)
    at net.imagej.legacy.DefaultLegacyHooks.interceptRunPlugIn(DefaultLegacyHooks.java:156)
    at ij.IJ.runPlugIn(IJ.java)
    at ij.Executer.runCommand(Executer.java:131)
    at ij.Executer.run(Executer.java:64)
    at java.lang.Thread.run(Thread.java:662)

and the console shows a lot of similar stack traces like the following (with different formats):

11:51:56.167 [Open...] DEBUG loci.formats.FormatHandler - 
java.io.FileNotFoundException: /tmp/a1.pg (No such file or directory)
    at java.io.RandomAccessFile.open(Native Method) ~[na:1.6.0_24]
    at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212) ~[na:1.6.0_24]
    at loci.common.NIOFileHandle.<init>(NIOFileHandle.java:127) ~[formats-common-5.0.2.jar:na]
    at loci.common.NIOFileHandle.<init>(NIOFileHandle.java:143) ~[formats-common-5.0.2.jar:na]
    at loci.common.NIOFileHandle.<init>(NIOFileHandle.java:152) ~[formats-common-5.0.2.jar:na]
    at loci.common.Location.getHandle(Location.java:323) ~[formats-common-5.0.2.jar:na]
    at loci.common.Location.getHandle(Location.java:293) ~[formats-common-5.0.2.jar:na]
    at loci.common.Location.getHandle(Location.java:283) ~[formats-common-5.0.2.jar:na]
    at loci.common.Location.getHandle(Location.java:273) ~[formats-common-5.0.2.jar:na]
    at loci.common.RandomAccessInputStream.<init>(RandomAccessInputStream.java:102) ~[formats-common-5.0.2.jar:na]
    at loci.formats.FormatReader.isThisType(FormatReader.java:612) ~[formats-api-5.0.2.jar:na]
    at loci.formats.ImageReader.isThisType(ImageReader.java:247) [formats-api-5.0.2.jar:na]
    at io.scif.bf.BioFormatsFormat$Checker.isFormat(BioFormatsFormat.java:199) [scifio-bf-compat-1.7.2.jar:1.7.2]
    at io.scif.services.DefaultFormatService.getFormatList(DefaultFormatService.java:289) [scifio-0.14.1.jar:0.14.1]
    at io.scif.services.DefaultFormatService.getFormat(DefaultFormatService.java:271) [scifio-0.14.1.jar:0.14.1]
    at net.imagej.DefaultDatasetService.canOpen(DefaultDatasetService.java:215) [imagej-common-0.7.2.jar:0.7.2]
    at net.imagej.io.DatasetIOPlugin.supportsOpen(DatasetIOPlugin.java:66) [imagej-common-0.7.2.jar:0.7.2]
    at org.scijava.io.DefaultIOService.getOpener(DefaultIOService.java:66) [scijava-common-2.22.3.jar:2.22.3]
    at net.imagej.legacy.plugin.DefaultLegacyOpener.open(DefaultLegacyOpener.java:129) [imagej-legacy-0.5.3.jar:0.5.3]
    at net.imagej.legacy.DefaultLegacyHooks.interceptFileOpen(DefaultLegacyHooks.java:427) [imagej-legacy-0.5.3.jar:0.5.3]
    at net.imagej.legacy.DefaultLegacyHooks.interceptRunPlugIn(DefaultLegacyHooks.java:156) [imagej-legacy-0.5.3.jar:0.5.3]
    at ij.IJ.runPlugIn(IJ.java) [na:1.49b]
    at ij.Executer.runCommand(Executer.java:131) [na:1.49b]
    at ij.Executer.run(Executer.java:64) [na:1.49b]
    at java.lang.Thread.run(Thread.java:662) [na:1.6.0_24]

@hinerm I fear that we need something clever here, to be able to pass virtual handles as well as real files...

@ctrueden
Copy link
Member

ctrueden commented Jun 5, 2014

Maybe we should just bite the bullet and tackle scifio/scifio#181?

@hinerm
Copy link
Member

hinerm commented Jun 9, 2014

Since these formats (OMEXML and BioFormats) weren't in the main SCIFIO component I didn't review them when I was updating checkers to ensure valid streams before reading.

Should be simple fixes in both cases.

@hinerm
Copy link
Member

hinerm commented Jun 9, 2014

... should be simple fix in the OMEXMLFormat case...

@hinerm
Copy link
Member

hinerm commented Jun 9, 2014

The formats are now fixed. And with imagej/imagej-plugins-commands@0086d09 we will now actually display the error when it happens. I don't think there's anything else to do for this issue right now.

@hinerm hinerm closed this as completed Jun 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants