Issue #632 Fixed locking file after opening (cannot save, etc.)

This commit is contained in:
Jindra Petřík
2014-09-16 10:17:49 +02:00
parent 04d9160226
commit 3c7bec740e

View File

@@ -231,8 +231,9 @@ public class Main {
InputStream inputStream = sourceInfo.getInputStream();
SWFBundle bundle = null;
FileInputStream fis = null;
if (inputStream == null) {
inputStream = new BufferedInputStream(new FileInputStream(sourceInfo.getFile()));
inputStream = new BufferedInputStream(fis = new FileInputStream(sourceInfo.getFile()));
bundle = sourceInfo.getBundle(false, SearchMode.ALL);
logger.log(Level.INFO, "Load file: {0}", sourceInfo.getFile());
} else if (inputStream instanceof SeekableInputStream
@@ -274,9 +275,9 @@ public class Main {
result.add(swf);
}
if (inputStream instanceof FileInputStream) {
if (fis != null) {
logger.log(Level.INFO, "File loaded in {0} seconds.", (sw.getElapsedMilliseconds() / 1000));
inputStream.close();
fis.close();
} else {
logger.log(Level.INFO, "Stream loaded in {0} seconds.", (sw.getElapsedMilliseconds() / 1000));
}