Provide feedback if keyword search index create/open fails

This commit is contained in:
Richard Cordovano 2015-10-26 14:40:16 -04:00
parent 3bff5a7b8e
commit ee3600e59a
6 changed files with 31 additions and 25 deletions

View File

@ -59,4 +59,11 @@ public class RuntimeProperties {
public static boolean coreComponentsAreActive() { public static boolean coreComponentsAreActive() {
return coreComponentsActive; return coreComponentsActive;
} }
/**
* Private constructor to prevent creatino of instances of this class.
*/
private RuntimeProperties() {
}
} }

View File

@ -195,5 +195,5 @@ MultiUserSettingsPanel.tbMsgHostname.text=
MultiUserSettingsPanel.lbTestMessageWarning.text= MultiUserSettingsPanel.lbTestMessageWarning.text=
MultiUserSettingsPanel.lbTestSolrWarning.text= MultiUserSettingsPanel.lbTestSolrWarning.text=
MultiUserSettingsPanel.lbTestDbWarning.text= MultiUserSettingsPanel.lbTestDbWarning.text=
MultiUserSettingsPanel.KeywordSearchNull=Cannot find Keyword Search service MultiUserSettingsPanel.KeywordSearchNull=Cannot find keyword search service
MultiUserSettingsPanel.InvalidPortNumber=Invalid port number. MultiUserSettingsPanel.InvalidPortNumber=Invalid port number

View File

@ -83,8 +83,8 @@ KeywordSearchConfigurationPanel1.customizeComponents.title=Delete a keyword list
KeywordSearchConfigurationPanel1.customizeComponents.body=This will delete the keyword list globally (for all Cases). Do you want to proceed with the deletion? KeywordSearchConfigurationPanel1.customizeComponents.body=This will delete the keyword list globally (for all Cases). Do you want to proceed with the deletion?
KeywordSearchConfigurationPanel1.customizeComponents.keywordListEmptyErr=Keyword List is empty and cannot be saved KeywordSearchConfigurationPanel1.customizeComponents.keywordListEmptyErr=Keyword List is empty and cannot be saved
KeywordSearch.newKwListTitle=New keyword list name\: KeywordSearch.newKwListTitle=New keyword list name\:
KeywordSearch.openCore.exception.msg=Could not create keyword search index for case {0} KeywordSearch.openCore.exception.msg=Could not open keyword search index
KeywordSearch.closeCore.exception.msg=Error closing keyword search index for case {0} KeywordSearch.closeCore.exception.msg=Error closing keyword search index
KeywordSearchConfigurationPanel1.customizeComponents.noOwDefaultMsg=Cannot overwrite default list KeywordSearchConfigurationPanel1.customizeComponents.noOwDefaultMsg=Cannot overwrite default list
KeywordSearchConfigurationPanel1.customizeComponents.kwListExistMsg=Keyword List <{0}> already exists, do you want to replace it? KeywordSearchConfigurationPanel1.customizeComponents.kwListExistMsg=Keyword List <{0}> already exists, do you want to replace it?
KeywordSearchConfigurationPanel1.customizeComponents.kwListSavedMsg=Keyword List <{0}> saved KeywordSearchConfigurationPanel1.customizeComponents.kwListSavedMsg=Keyword List <{0}> saved
@ -224,7 +224,7 @@ Server.queryTerms.exception.msg=Error running terms query\: {0}
Server.connect.exception.msg=Failed to connect to Solr server\: Server.connect.exception.msg=Failed to connect to Solr server\:
Server.openCore.exception.msg=Core open requested, but server not yet running Server.openCore.exception.msg=Core open requested, but server not yet running
Server.openCore.exception.cantOpen.msg=Could not open Core Server.openCore.exception.cantOpen.msg=Could not open Core
Server.openCore.exception.cantOpen.msg2=Could not open Core Server.openCore.exception.noIndexDir.msg=Index could not be created or missing
Server.request.exception.exception.msg=Could not issue Solr request Server.request.exception.exception.msg=Could not issue Solr request
Server.commit.exception.msg=Could not commit index Server.commit.exception.msg=Could not commit index
Server.addDoc.exception.msg=Could not add document to index via update handler\: {0} Server.addDoc.exception.msg=Could not add document to index via update handler\: {0}
@ -288,8 +288,8 @@ KeywordSearchModuleFactory.createFileIngestModule.exception.msg=Expected setting
SearchRunner.Searcher.done.err.msg=Error performing keyword search SearchRunner.Searcher.done.err.msg=Error performing keyword search
KeywordSearchGlobalSearchSettingsPanel.timeRadioButton5.toolTipText=Fastest overall, but no results until the end KeywordSearchGlobalSearchSettingsPanel.timeRadioButton5.toolTipText=Fastest overall, but no results until the end
KeywordSearchGlobalSearchSettingsPanel.timeRadioButton5.text=No periodic searches KeywordSearchGlobalSearchSettingsPanel.timeRadioButton5.text=No periodic searches
KeywordSearchIngestModule.startUp.noOpenCore.msg=The keyword search index for could not be opened or does not exist. Try closing and reopening the case. KeywordSearchIngestModule.startUp.noOpenCore.msg=The index could not be opened or does not exist
KeywordSearchIngestModule.startUp.fileTypeDetectorInitializationException.msg=Error initializing the file type detector. KeywordSearchIngestModule.startUp.fileTypeDetectorInitializationException.msg=Error initializing the file type detector
SolrConnectionCheck.HostnameOrPort=Invalid hostname and/or port number. SolrConnectionCheck.HostnameOrPort=Invalid hostname and/or port number.
SolrConnectionCheck.Hostname=Invalid hostname. SolrConnectionCheck.Hostname=Invalid hostname.
SolrConnectionCheck.Port=Invalid port number. SolrConnectionCheck.Port=Invalid port number.

View File

@ -223,7 +223,7 @@ class DropdownToolbar extends javax.swing.JPanel {
String changed = evt.getPropertyName(); String changed = evt.getPropertyName();
if (changed.equals(Case.Events.CURRENT_CASE.toString())) { if (changed.equals(Case.Events.CURRENT_CASE.toString())) {
dropPanel.resetSearchBox(); dropPanel.resetSearchBox();
setFields(null != evt.getNewValue() && RuntimeProperties.coreComponentsAreActive()); setFields(null != evt.getNewValue() && RuntimeProperties.coreComponentsAreActive() && KeywordSearch.getServer().coreIsOpen());
} else if (changed.equals(Server.CORE_EVT)) { } else if (changed.equals(Server.CORE_EVT)) {
final Server.CORE_EVT_STATES state = (Server.CORE_EVT_STATES) evt.getNewValue(); final Server.CORE_EVT_STATES state = (Server.CORE_EVT_STATES) evt.getNewValue();
switch (state) { switch (state) {

View File

@ -127,7 +127,7 @@ public class KeywordSearch {
} catch (Exception ex) { } catch (Exception ex) {
String caseName = closedCase.getName(); String caseName = closedCase.getName();
logger.log(Level.SEVERE, String.format("Failed to close core for %s", caseName), ex); logger.log(Level.SEVERE, String.format("Failed to close core for %s", caseName), ex);
MessageNotifyUtil.Notify.error(NbBundle.getMessage(KeywordSearch.class, "KeywordSearch.closeCore.exception.msg", caseName), ex.getCause().getMessage()); MessageNotifyUtil.Notify.error(NbBundle.getMessage(KeywordSearch.class, "KeywordSearch.closeCore.exception.msg"), ex.getCause().getMessage());
} }
} }
if (null != evt.getNewValue()) { if (null != evt.getNewValue()) {
@ -137,7 +137,7 @@ public class KeywordSearch {
} catch (Exception ex) { } catch (Exception ex) {
String caseName = openedCase.getName(); String caseName = openedCase.getName();
logger.log(Level.SEVERE, String.format("Failed to open or create core for %s", caseName), ex); logger.log(Level.SEVERE, String.format("Failed to open or create core for %s", caseName), ex);
MessageNotifyUtil.Notify.error(NbBundle.getMessage(KeywordSearch.class, "KeywordSearch.openCore.exception.msg", caseName), ex.getCause().getMessage()); MessageNotifyUtil.Notify.error(NbBundle.getMessage(KeywordSearch.class, "KeywordSearch.openCore.exception.msg"), ex.getCause().getMessage());
} }
} }
} }

View File

@ -40,7 +40,6 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.logging.Level; import java.util.logging.Level;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
@ -170,6 +169,7 @@ public class Server {
private int currentSolrStopPort = 0; private int currentSolrStopPort = 0;
private static final boolean DEBUG = false;//(Version.getBuildType() == Version.Type.DEVELOPMENT); private static final boolean DEBUG = false;//(Version.getBuildType() == Version.Type.DEVELOPMENT);
private final UNCPathUtilities uncPathUtilities = new UNCPathUtilities(); private final UNCPathUtilities uncPathUtilities = new UNCPathUtilities();
private static final String INDEX_DIR_NAME = "index";
public enum CORE_EVT_STATES { public enum CORE_EVT_STATES {
@ -1069,26 +1069,25 @@ public class Server {
} }
if (!isCoreLoaded(coreName)) { if (!isCoreLoaded(coreName)) {
CoreAdminRequest.Create createCore = new CoreAdminRequest.Create(); CoreAdminRequest.Create createCoreRequest = new CoreAdminRequest.Create();
createCore.setDataDir(dataDir.getAbsolutePath()); createCoreRequest.setDataDir(dataDir.getAbsolutePath());
createCore.setCoreName(coreName); createCoreRequest.setCoreName(coreName);
createCore.setConfigSet("AutopsyConfig"); //NON-NLS createCoreRequest.setConfigSet("AutopsyConfig"); //NON-NLS
createCore.setIsLoadOnStartup(false); createCoreRequest.setIsLoadOnStartup(false);
createCore.setIsTransient(true); createCoreRequest.setIsTransient(true);
currentSolrServer.request(createCoreRequest);
currentSolrServer.request(createCore);
} }
final Core newCore = new Core(coreName, caseType); File indexDir = Paths.get(dataDir.getAbsolutePath(), INDEX_DIR_NAME).toFile();
if (!indexDir.exists()) {
throw new IOException(NbBundle.getMessage(this.getClass(), "Server.openCore.exception.noIndexDir.msg"));
}
return newCore; return new Core(coreName, caseType);
} catch (SolrServerException | SolrException ex) { } catch (SolrServerException | SolrException | IOException ex) {
throw new KeywordSearchModuleException( throw new KeywordSearchModuleException(
NbBundle.getMessage(this.getClass(), "Server.openCore.exception.cantOpen.msg"), ex); NbBundle.getMessage(this.getClass(), "Server.openCore.exception.cantOpen.msg"), ex);
} catch (IOException ex) {
throw new KeywordSearchModuleException(
NbBundle.getMessage(this.getClass(), "Server.openCore.exception.cantOpen.msg2"), ex);
} }
} }