From e0c37bb06114561a5b03514333edfa69363d6f32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=F8=EDk?= Date: Sat, 24 Aug 2013 14:53:40 +0200 Subject: [PATCH] fixed opening files --- .../src/com/jpexs/decompiler/flash/gui/Main.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java index 86c398473..6d5b2843e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -208,16 +208,12 @@ public class Main { } public static SWF parseSWF(String file) throws Exception { - try (FileInputStream fis = new FileInputStream(file)) { - return parseSWF(fis); - } + return parseSWF(new FileInputStream(file)); } public static SWF parseSWF(InputStream fis) throws Exception { SWF locswf; - //try (FileInputStream fis = new FileInputStream(file)) { - InputStream bis = new BufferedInputStream(fis); - locswf = new SWF(bis, new ProgressListener() { + locswf = new SWF(fis, new ProgressListener() { @Override public void progress(int p) { startWork(translate("work.reading.swf"), p); @@ -269,6 +265,9 @@ public class Main { try { Main.startWork(translate("work.reading.swf") + "..."); swf = parseSWF(Main.inputStream); + if(Main.inputStream instanceof FileInputStream) { + Main.inputStream.close(); + } } catch (Exception ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); View.showMessageDialog(null, "Cannot load SWF file."); @@ -327,9 +326,8 @@ public class Main { } public static boolean openFile(String swfFile) { - - try (FileInputStream fis = new FileInputStream(swfFile)) { - boolean ok = openFile(swfFile, fis); + try { + boolean ok = openFile(swfFile, new FileInputStream(swfFile)); if (ok) { readOnly = false; }