diff options
author | Alexandre Montplaisir | 2014-05-13 20:46:43 +0000 |
---|---|---|
committer | Alexandre Montplaisir | 2014-06-19 21:00:02 +0000 |
commit | 7b3eb8c0b559cae1b1295ae5ba29547363f9abb4 (patch) | |
tree | 366d5351a59939d149df67d3a1c31d6d8f68469b /org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageOperation.java | |
parent | 166eb6c4163f0f898d7f052234f3683eefd594f6 (diff) | |
download | org.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.java | 13 |
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 } |