diff --git a/Core/src/org/sleuthkit/autopsy/timeline/TimeLineModule.java b/Core/src/org/sleuthkit/autopsy/timeline/TimeLineModule.java index 6d8e5da23cd1bee9e7fef6386ff935b8f9a270f3..1dff37d7b1d0c23b68aa3dbea068a350faafa3f6 100755 --- a/Core/src/org/sleuthkit/autopsy/timeline/TimeLineModule.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/TimeLineModule.java @@ -49,19 +49,19 @@ private TimeLineModule() { } /** - * Get instance of the controller for the current case + * Get instance of the controller for the current case. + * The controller instance is initialized from a case open event. * * @return the controller for the current case. * - * @throws NoCurrentCaseException If there is no case open. * @throws TskCoreException If there was a problem accessing the case * database. * */ - public static TimeLineController getController() throws NoCurrentCaseException, TskCoreException { + public static TimeLineController getController() throws TskCoreException { synchronized (controllerLock) { if (controller == null) { - controller = new TimeLineController(Case.getCurrentCaseThrows()); + throw new TskCoreException("Timeline controller not initialized"); } return controller; } @@ -100,13 +100,22 @@ public void propertyChange(PropertyChangeEvent evt) { } controller = null; } + } else { + // Case is opening - create the controller now + synchronized (controllerLock) { + try { + controller = new TimeLineController(Case.getCurrentCaseThrows()); + } catch (TskCoreException | NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Error creating Timeline controller", ex); + } + } } } else { try { getController().handleCaseEvent(evt); - } catch (NoCurrentCaseException ignored) { } catch (TskCoreException ex) { - logger.log(Level.SEVERE, "Error handling application event", ex); + // The call to getController() will only fail due to case closing, so do + // not record the error. } } } @@ -121,12 +130,9 @@ static private class IngestModuleEventListener implements PropertyChangeListener public void propertyChange(PropertyChangeEvent evt) { try { getController().handleIngestModuleEvent(evt); - } catch (NoCurrentCaseException ex) { - // ignore - return; } catch (TskCoreException ex) { - MessageNotifyUtil.Message.error("Error creating timeline controller."); - logger.log(Level.SEVERE, "Error creating timeline controller", ex); + // The call to getController() will only fail due to case closing, so do + // not record the error. } } }