Data loss - window closable while save in progress

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Data loss - window closable while save in progress

Michael Doube
Hi all,

I've struck a rather nasty (dangerous!) bug where it is possible to close an image while a save is in progress, resulting in loss of all image data.

For example, I have a 1GB stack and I hit [s] to save it.  While the write is in progress I hit [w] to close the window.  The window closes, IJ throws an exception and all the stack's data is gone.  The expected behaviour is for IJ to wait until it is finished saving, then to close the image.

The exception is this:

java.lang.NullPointerException
        at java.io.FileOutputStream.writeBytes(Native Method)
        at java.io.FileOutputStream.write(Unknown Source)
        at java.io.BufferedOutputStream.write(Unknown Source)
        at java.io.DataOutputStream.write(Unknown Source)
        at ij.io.ImageWriter.write8BitImage(ImageWriter.java:28)
        at ij.io.ImageWriter.write8BitStack(ImageWriter.java:38)
        at ij.io.ImageWriter.write(ImageWriter.java:214)
        at ij.io.TiffEncoder.write(TiffEncoder.java:118)
        at ij.io.TiffEncoder.write(TiffEncoder.java:138)
        at ij.io.FileSaver.saveAsTiffStack(FileSaver.java:126)
        at ij.io.FileSaver.saveAsTiff(FileSaver.java:80)
        at ij.io.FileSaver.save(FileSaver.java:58)
        at ij.plugin.Commands.save(Commands.java:55)
        at ij.plugin.Commands.run(Commands.java:27)
        at ij.IJ.runPlugIn(IJ.java:148)
        at ij.Executer.runCommand(Executer.java:121)
        at ij.Executer.run(Executer.java:58)
        at java.lang.Thread.run(Unknown Source)

I am using IJ 1.43b and Java 64-bit 1.6.0_12 on Vista.

I hope this message prevents other people from losing their work.

Mike
Reply | Threaded
Open this post in threaded view
|

Re: Data loss - window closable while save in progress

Wayne Rasband
This bug is fixed in the 1.43c daily build.

-wayne

On Jun 25, 2009, at 3:38 AM, Doube, Michael wrote:

> Hi all,
>
> I've struck a rather nasty (dangerous!) bug where it is possible to
> close an image while a save is in progress, resulting in loss of all
> image data.
>
> For example, I have a 1GB stack and I hit [s] to save it.  While the
> write is in progress I hit [w] to close the window.  The window
> closes, IJ throws an exception and all the stack's data is gone.  The
> expected behaviour is for IJ to wait until it is finished saving, then
> to close the image.
>
> The exception is this:
>
> java.lang.NullPointerException
> at java.io.FileOutputStream.writeBytes(Native Method)
> at java.io.FileOutputStream.write(Unknown Source)
> at java.io.BufferedOutputStream.write(Unknown Source)
> at java.io.DataOutputStream.write(Unknown Source)
> at ij.io.ImageWriter.write8BitImage(ImageWriter.java:28)
> at ij.io.ImageWriter.write8BitStack(ImageWriter.java:38)
> at ij.io.ImageWriter.write(ImageWriter.java:214)
> at ij.io.TiffEncoder.write(TiffEncoder.java:118)
> at ij.io.TiffEncoder.write(TiffEncoder.java:138)
> at ij.io.FileSaver.saveAsTiffStack(FileSaver.java:126)
> at ij.io.FileSaver.saveAsTiff(FileSaver.java:80)
> at ij.io.FileSaver.save(FileSaver.java:58)
> at ij.plugin.Commands.save(Commands.java:55)
> at ij.plugin.Commands.run(Commands.java:27)
> at ij.IJ.runPlugIn(IJ.java:148)
> at ij.Executer.runCommand(Executer.java:121)
> at ij.Executer.run(Executer.java:58)
> at java.lang.Thread.run(Unknown Source)
>
> I am using IJ 1.43b and Java 64-bit 1.6.0_12 on Vista.
>
> I hope this message prevents other people from losing their work.
>
> Mike