From 7593f0eb0eb9cb9c5a3237d449c6d0e6e9aa1496 Mon Sep 17 00:00:00 2001 From: Sophie Mori Date: Thu, 13 Oct 2016 11:38:47 -0400 Subject: [PATCH] ReportHTML NPE catch and log with detailed error message --- Core/src/org/sleuthkit/autopsy/report/ReportHTML.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java b/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java index 008b9082be..5612fd49f2 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java @@ -1126,13 +1126,17 @@ class ReportHTML implements TableReportModule { if (thumbFile.exists() == false) { return null; } + File to = new File(thumbsPath); + FileObject from = FileUtil.toFileObject(thumbFile); + FileObject dest = FileUtil.toFileObject(to); try { - File to = new File(thumbsPath); - FileObject from = FileUtil.toFileObject(thumbFile); - FileObject dest = FileUtil.toFileObject(to); FileUtil.copyFile(from, dest, thumbFile.getName(), ""); } catch (IOException ex) { logger.log(Level.SEVERE, "Failed to write thumb file to report directory.", ex); //NON-NLS + } catch (NullPointerException ex) { + logger.log(Level.SEVERE, "NPE generated from FileUtil.copyFile, probably because FileUtil.toFileObject returned null. \n" + + "The File argument for toFileObject was " + thumbFile + " with toString: " + thumbFile.toString() + "\n" + + "The FileObject returned by toFileObject, passed into FileUtil.copyFile, was " + from, ex); } return THUMBS_REL_PATH + thumbFile.getName();