Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Khouzam2016-12-15 15:46:31 +0000
committerMatthew Khouzam2016-12-19 17:58:48 +0000
commitd48266e08d8769c52482c0f969327bc976b24cc9 (patch)
treeecd2c9cd29f43de6bf0d631f5343f73045e9c3d7
parent60867d6adac129ab95ea38786e517abdc4bb3723 (diff)
downloadorg.eclipse.tracecompass-stable-2.1.tar.gz
org.eclipse.tracecompass-stable-2.1.tar.xz
org.eclipse.tracecompass-stable-2.1.zip
tmf.ui: Gracefully handle invalid tar import operationsstable-2.1
A tar.gz file may have an invalid tar file in the gzip. The getNextEntry would return null in such a case. This performs that null check in order to validate the tar and avoid a user- facing NPE. Change-Id: I28ae7c787d77a0f1c9136264cfc678d7e52cda1a Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Reviewed-on: https://git.eclipse.org/r/87247 Reviewed-by: Hudson CI Reviewed-by: Marc-André Laperle <marc-andre.laperle@ericsson.com> Tested-by: Marc-André Laperle <marc-andre.laperle@ericsson.com> (cherry picked from commit 6facaeb6ec0e729c457abb780fbc05995c0061cd) Reviewed-on: https://git.eclipse.org/r/87272
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/TarFile.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/TarFile.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/TarFile.java
index 3647aa14e2..ea3830274a 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/TarFile.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/TarFile.java
@@ -63,7 +63,7 @@ public class TarFile {
entryEnumerationStream = new TarArchiveInputStream(fInputStream);
try {
curEntry = (TarArchiveEntry) entryEnumerationStream.getNextEntry();
- if (!curEntry.isCheckSumOK()) {
+ if (curEntry == null || !curEntry.isCheckSumOK()) {
throw new IOException("Error detected parsing initial entry header"); //$NON-NLS-1$
}
} catch (IOException e) {

Back to the top