Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Montplaisir2014-05-13 20:46:43 +0000
committerAlexandre Montplaisir2014-06-19 21:00:02 +0000
commit7b3eb8c0b559cae1b1295ae5ba29547363f9abb4 (patch)
tree366d5351a59939d149df67d3a1c31d6d8f68469b /org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageOperation.java
parent166eb6c4163f0f898d7f052234f3683eefd594f6 (diff)
downloadorg.eclipse.tracecompass-7b3eb8c0b559cae1b1295ae5ba29547363f9abb4.tar.gz
org.eclipse.tracecompass-7b3eb8c0b559cae1b1295ae5ba29547363f9abb4.tar.xz
org.eclipse.tracecompass-7b3eb8c0b559cae1b1295ae5ba29547363f9abb4.zip
tmf: Fix simple resource leak warnings
Many warnings left in ControlFlow and Resource Views, where they get a reference to a (closeable) analysis module, and then the compiler expects them to close it. Since the view don't really use the module for anything other than getting the state system, we could provide a utility class to get the state system from an analysis module directly, without leaking references. Shouldn't be hard to do, but outside of the scope of this patch. At some point we should revisit the ITmfTrace#getAnalysisModule(s) methods. Maybe it is not such a good idea to expose closeable objects publicly. Change-Id: I0633d40260d0e2d37ad9da30fc6bb34d68cd5f38 Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Reviewed-on: https://git.eclipse.org/r/26486 Tested-by: Hudson CI
Diffstat (limited to 'org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageOperation.java')
-rw-r--r--org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageOperation.java13
1 files changed, 3 insertions, 10 deletions
diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageOperation.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageOperation.java
index 6e5a415b56..e440aa7dc3 100644
--- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageOperation.java
+++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageOperation.java
@@ -17,7 +17,6 @@ import java.io.InputStream;
import java.util.Enumeration;
import java.util.Vector;
import java.util.zip.ZipEntry;
-import java.util.zip.ZipException;
import java.util.zip.ZipFile;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -122,20 +121,14 @@ abstract public class AbstractTracePackageOperation {
}
try {
- ZipFile zipFile = new ZipFile(fFileName);
- return new ZipArchiveFile(zipFile);
- } catch (ZipException e) {
- // ignore
+ return new ZipArchiveFile(new ZipFile(fFileName));
} catch (IOException e) {
// ignore
}
try {
- TarFile tarFile = new TarFile(fFileName);
- return new TarArchiveFile(tarFile);
- } catch (TarException e) {
- // ignore
- } catch (IOException e) {
+ return new TarArchiveFile(new TarFile(fFileName));
+ } catch (TarException | IOException e) {
// ignore
}

Back to the top