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() {
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.lbTestSolrWarning.text=
MultiUserSettingsPanel.lbTestDbWarning.text=
MultiUserSettingsPanel.KeywordSearchNull=Cannot find Keyword Search service
MultiUserSettingsPanel.InvalidPortNumber=Invalid port number.
MultiUserSettingsPanel.KeywordSearchNull=Cannot find keyword search service
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.keywordListEmptyErr=Keyword List is empty and cannot be saved
KeywordSearch.newKwListTitle=New keyword list name\:
KeywordSearch.openCore.exception.msg=Could not create keyword search index for case {0}
KeywordSearch.closeCore.exception.msg=Error closing 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
KeywordSearchConfigurationPanel1.customizeComponents.noOwDefaultMsg=Cannot overwrite default list
KeywordSearchConfigurationPanel1.customizeComponents.kwListExistMsg=Keyword List <{0}> already exists, do you want to replace it?
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.openCore.exception.msg=Core open requested, but server not yet running
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.commit.exception.msg=Could not commit index
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
KeywordSearchGlobalSearchSettingsPanel.timeRadioButton5.toolTipText=Fastest overall, but no results until the end
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.fileTypeDetectorInitializationException.msg=Error initializing the file type detector.
KeywordSearchIngestModule.startUp.noOpenCore.msg=The index could not be opened or does not exist
KeywordSearchIngestModule.startUp.fileTypeDetectorInitializationException.msg=Error initializing the file type detector
SolrConnectionCheck.HostnameOrPort=Invalid hostname and/or port number.
SolrConnectionCheck.Hostname=Invalid hostname.
SolrConnectionCheck.Port=Invalid port number.

View File

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

View File

@ -127,7 +127,7 @@ public class KeywordSearch {
} catch (Exception ex) {
String caseName = closedCase.getName();
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()) {
@ -137,7 +137,7 @@ public class KeywordSearch {
} catch (Exception ex) {
String caseName = openedCase.getName();
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.concurrent.locks.ReentrantReadWriteLock;
import java.util.logging.Level;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.AbstractAction;
@ -170,6 +169,7 @@ public class Server {
private int currentSolrStopPort = 0;
private static final boolean DEBUG = false;//(Version.getBuildType() == Version.Type.DEVELOPMENT);
private final UNCPathUtilities uncPathUtilities = new UNCPathUtilities();
private static final String INDEX_DIR_NAME = "index";
public enum CORE_EVT_STATES {
@ -1069,26 +1069,25 @@ public class Server {
}
if (!isCoreLoaded(coreName)) {
CoreAdminRequest.Create createCore = new CoreAdminRequest.Create();
createCore.setDataDir(dataDir.getAbsolutePath());
createCore.setCoreName(coreName);
createCore.setConfigSet("AutopsyConfig"); //NON-NLS
createCore.setIsLoadOnStartup(false);
createCore.setIsTransient(true);
currentSolrServer.request(createCore);
CoreAdminRequest.Create createCoreRequest = new CoreAdminRequest.Create();
createCoreRequest.setDataDir(dataDir.getAbsolutePath());
createCoreRequest.setCoreName(coreName);
createCoreRequest.setConfigSet("AutopsyConfig"); //NON-NLS
createCoreRequest.setIsLoadOnStartup(false);
createCoreRequest.setIsTransient(true);
currentSolrServer.request(createCoreRequest);
}
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(
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);
}
}