Skip to content
Snippets Groups Projects
Commit d0683fa0 authored by Richard Cordovano's avatar Richard Cordovano
Browse files

Improve Core Installer error handling

parent 1a908d10
No related branches found
No related tags found
No related merge requests found
...@@ -83,14 +83,14 @@ public void restored() { ...@@ -83,14 +83,14 @@ public void restored() {
try { try {
Case.open(caseFile); Case.open(caseFile);
} catch (Exception ex) { } 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(); }).start();
return; return;
} }
} }
} }
Case.invokeStartupDialog(); // bring up the startup dialog Case.invokeStartupDialog();
}); });
} }
...@@ -103,12 +103,19 @@ public void uninstalled() { ...@@ -103,12 +103,19 @@ public void uninstalled() {
@Override @Override
public void close() { public void close() {
new Thread(() -> { new Thread(() -> {
String caseDirName = null;
try { try {
if (Case.isCaseOpen()) { if (Case.isCaseOpen()) {
Case.getCurrentCase().closeCase(); Case currentCase = Case.getCurrentCase();
caseDirName = currentCase.getCaseDirectory();
currentCase.closeCase();
} }
} catch (CaseActionException | IllegalStateException ex) { } catch (CaseActionException ex) {
logger.log(Level.SEVERE, "Error closing case", ex); //NON-NLS 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(); }).start();
} }
...@@ -128,7 +135,7 @@ private void setOSXLookAndFeel() { ...@@ -128,7 +135,7 @@ private void setOSXLookAndFeel() {
try { try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } 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 // Store the keys that deal with menu items
...@@ -138,20 +145,19 @@ private void setOSXLookAndFeel() { ...@@ -138,20 +145,19 @@ private void setOSXLookAndFeel() {
uiEntries.put(key, UIManager.get(key)); uiEntries.put(key, UIManager.get(key));
} }
// Use Metal if available // Use Metal if available.
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) { //NON-NLS if ("Nimbus".equals(info.getName())) { //NON-NLS
try { try {
UIManager.setLookAndFeel(info.getClassName()); UIManager.setLookAndFeel(info.getClassName());
} catch (ClassNotFoundException | InstantiationException | } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
IllegalAccessException | UnsupportedLookAndFeelException ex) { logger.log(Level.WARNING, "Error setting OS-X look-and-feel", ex); //NON-NLS
logger.log(Level.WARNING, "Unable to set theme. ", ex); //NON-NLS
} }
break; 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) -> { uiEntries.entrySet().stream().forEach((entry) -> {
UIManager.put(entry.getKey(), entry.getValue()); UIManager.put(entry.getKey(), entry.getValue());
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment