mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 07:56:16 +00:00
Bypass ingest if server not started
This commit is contained in:
parent
3f11338014
commit
be021e3f14
@ -35,6 +35,7 @@ import org.sleuthkit.autopsy.casemodule.Case;
|
|||||||
public class Installer extends ModuleInstall {
|
public class Installer extends ModuleInstall {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(Installer.class.getName());
|
private static final Logger logger = Logger.getLogger(Installer.class.getName());
|
||||||
|
private final static int SERVER_START_RETRIES = 5;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void restored() {
|
public void restored() {
|
||||||
@ -68,7 +69,7 @@ public class Installer extends ModuleInstall {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//retry if needed
|
//retry if needed
|
||||||
int retries = 5;
|
int retries = SERVER_START_RETRIES;
|
||||||
while (retries-- > 0) {
|
while (retries-- > 0) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
|
@ -38,6 +38,7 @@ import org.apache.solr.client.solrj.SolrServerException;
|
|||||||
import org.netbeans.api.progress.ProgressHandle;
|
import org.netbeans.api.progress.ProgressHandle;
|
||||||
import org.netbeans.api.progress.ProgressHandleFactory;
|
import org.netbeans.api.progress.ProgressHandleFactory;
|
||||||
import org.openide.util.Cancellable;
|
import org.openide.util.Cancellable;
|
||||||
|
import org.openide.util.Exceptions;
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
|
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
|
||||||
import org.sleuthkit.autopsy.coreutils.StopWatch;
|
import org.sleuthkit.autopsy.coreutils.StopWatch;
|
||||||
@ -338,11 +339,20 @@ public final class KeywordSearchIngestModule implements IngestModuleAbstractFile
|
|||||||
caseHandle = Case.getCurrentCase().getSleuthkitCase();
|
caseHandle = Case.getCurrentCase().getSleuthkitCase();
|
||||||
|
|
||||||
ingester = Server.getIngester();
|
ingester = Server.getIngester();
|
||||||
|
|
||||||
//use the settings files to set values
|
|
||||||
|
|
||||||
|
final Server server = KeywordSearch.getServer();
|
||||||
|
try {
|
||||||
|
if (! server.isRunning()) {
|
||||||
|
String msg = "Keyword search server was not properly initialized, cannot run keyword search ingest. ";
|
||||||
|
logger.log(Level.SEVERE, msg);
|
||||||
|
String details = msg + "Please try restarting the OS and the application";
|
||||||
|
services.postMessage(IngestMessage.createErrorMessage(++messageID, instance, msg, details));
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (KeywordSearchModuleException ex) {
|
||||||
|
logger.log(Level.WARNING, "Error checking if Solr server is running while initializing ingest", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//initialize extractors
|
//initialize extractors
|
||||||
|
@ -327,7 +327,7 @@ class Server {
|
|||||||
// that doesn't work when there are no cores
|
// that doesn't work when there are no cores
|
||||||
|
|
||||||
CoreAdminRequest.getStatus(null, solrServer);
|
CoreAdminRequest.getStatus(null, solrServer);
|
||||||
logger.log(Level.INFO, "Solr is running");
|
logger.log(Level.INFO, "Solr server is running");
|
||||||
} catch (SolrServerException ex) {
|
} catch (SolrServerException ex) {
|
||||||
|
|
||||||
Throwable cause = ex.getRootCause();
|
Throwable cause = ex.getRootCause();
|
||||||
@ -336,7 +336,7 @@ class Server {
|
|||||||
// probably caused by starting a connection as the server finishes
|
// probably caused by starting a connection as the server finishes
|
||||||
// shutting down)
|
// shutting down)
|
||||||
if (cause instanceof ConnectException || cause instanceof SocketException || cause instanceof NoHttpResponseException) {
|
if (cause instanceof ConnectException || cause instanceof SocketException || cause instanceof NoHttpResponseException) {
|
||||||
logger.log(Level.INFO, "Solr is not running, cause: " + cause.getMessage());
|
logger.log(Level.INFO, "Solr server is not running, cause: " + cause.getMessage());
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
throw new KeywordSearchModuleException("Error checking if Solr server is running", ex);
|
throw new KeywordSearchModuleException("Error checking if Solr server is running", ex);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user