From 6facaeb6ec0e729c457abb780fbc05995c0061cd Mon Sep 17 00:00:00 2001 From: Matthew Khouzam Date: Thu, 15 Dec 2016 10:46:31 -0500 Subject: [PATCH] tmf.ui: Gracefully handle invalid tar import operations MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://git.eclipse.org/r/87247 Reviewed-by: Hudson CI Reviewed-by: Marc-André Laperle Tested-by: Marc-André Laperle --- .../internal/tmf/ui/project/wizards/importtrace/TarFile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { -- 2.34.1