Fix file leak in Gzip support
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Wed, 3 Jun 2015 02:38:32 +0000 (22:38 -0400)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Wed, 3 Jun 2015 15:24:02 +0000 (11:24 -0400)
Change-Id: Ie14143f5be809a8c7e54fc7bc5f7f639d6da4ece
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/49269
Reviewed-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/GzipFile.java

index e1fbba94b5b374eb1728b84adbb3d8ef2b1ced8c..e19159e9121fa33fe08e69a8e8fda61dd38e5636 100644 (file)
@@ -44,8 +44,13 @@ public class GzipFile implements AutoCloseable {
         fFile = source;
 
         InputStream in = new FileInputStream(source);
-        // Check if it's a GZIPInputStream.
-        fInternalEntryStream = new GZIPInputStream(in);
+        try {
+            // Check if it's a GZIPInputStream.
+            fInternalEntryStream = new GZIPInputStream(in);
+        } catch (IOException e) {
+            in.close();
+            throw e;
+        }
         String name = source.getName();
         fEntry = new GzipEntry(name.substring(0, name.lastIndexOf(GZIP_EXTENSION)));
         fCurEntry = fEntry;
This page took 0.025698 seconds and 5 git commands to generate.