Menu

Possible Stream left open?

Dan Rollo
2004-12-13
2013-06-05
  • Dan Rollo

    Dan Rollo - 2004-12-13

    I'm having a problem where after I compress a file using the code below (via APESimple), something seems to have the original source file locked, such that later sourceFile.delete() operations never succeed. This happens on Win2k using jdk1.4.2. Just to make things even stranger, this NEVER happens under FedoraCore2, jdk 1.4.2 or FC2 jdk1.5. Any thoughts?

        private static File tmpPCMToLosslessEncoding(final File sourceFile,
                final ProgressListener progListener)
                throws IOException {

            final File tmpFile = File.createTempFile(sourceFile.getName(), ".ape", sourceFile.getParentFile());
            tmpFile.deleteOnExit();
            try {
                APESimple.CompressFile(sourceFile.getAbsolutePath(), tmpFile.getAbsolutePath(),
                        CompressionLevel.COMPRESSION_LEVEL_FAST, new JMacProgWrapper(progListener));
            } catch (JMACStoppedByUserException e) {
                throw new FileCompressionException( sourceFile, null, e );
            }

            return tmpFile;
        }

    Thanks!
    Dan

     
    • Dmitry Vagin

      Dmitry Vagin - 2004-12-16

      Oh I think I see the problem. The finalize() method of APECompress class is protected. It should be public. So, yes, the close() method for output file is never called.

      Please, fix it in your current sources of JMAC. I will release the new version with this and some other fixes soon.

      Thanks for your help.

      Dmitry

       

Log in to post a comment.

MongoDB Logo MongoDB