diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java b/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java index ce1fceda243778017a9662e51f44ca001c052850..9121ad4d23faf52e42d1f920f0106ae19236948d 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java @@ -83,14 +83,14 @@ public void restored() { try { Case.open(caseFile); } catch (Exception ex) { - logger.log(Level.SEVERE, "Error opening case", ex); //NON-NLS + logger.log(Level.SEVERE, String.format("Error opening case with metadata file path %s", caseFile), ex); //NON-NLS } }).start(); return; } } } - Case.invokeStartupDialog(); // bring up the startup dialog + Case.invokeStartupDialog(); }); } @@ -103,12 +103,19 @@ public void uninstalled() { @Override public void close() { new Thread(() -> { + String caseDirName = null; try { if (Case.isCaseOpen()) { - Case.getCurrentCase().closeCase(); + Case currentCase = Case.getCurrentCase(); + caseDirName = currentCase.getCaseDirectory(); + currentCase.closeCase(); } - } catch (CaseActionException | IllegalStateException ex) { - logger.log(Level.SEVERE, "Error closing case", ex); //NON-NLS + } catch (CaseActionException ex) { + logger.log(Level.SEVERE, String.format("Error closing case with case directory %s", (null != caseDirName ? caseDirName : "?")), ex); //NON-NLS + } catch (IllegalStateException ignored) { + /* + * No current case. Case.isCaseOpen is not reliable. + */ } }).start(); } @@ -128,7 +135,7 @@ private void setOSXLookAndFeel() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { - logger.log(Level.WARNING, "Unable to set theme. ", ex); //NON-NLS + logger.log(Level.WARNING, "Error setting OS-X look-and-feel", ex); //NON-NLS } // Store the keys that deal with menu items @@ -138,20 +145,19 @@ private void setOSXLookAndFeel() { uiEntries.put(key, UIManager.get(key)); } - // Use Metal if available + // Use Metal if available. for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { //NON-NLS try { UIManager.setLookAndFeel(info.getClassName()); - } catch (ClassNotFoundException | InstantiationException | - IllegalAccessException | UnsupportedLookAndFeelException ex) { - logger.log(Level.WARNING, "Unable to set theme. ", ex); //NON-NLS + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { + logger.log(Level.WARNING, "Error setting OS-X look-and-feel", ex); //NON-NLS } break; } } - // Overwrite the Metal menu item keys to use the Aqua versions + // Overwrite the Metal menu item keys to use the Aqua versions. uiEntries.entrySet().stream().forEach((entry) -> { UIManager.put(entry.getKey(), entry.getValue()); });