better user message if keyword search ingest can't run due to solr start error

This commit is contained in:
adam-m 2013-03-27 13:04:30 -04:00
parent 64f4a8edc4
commit a683aafe89

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2013 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -354,7 +354,7 @@ public final class KeywordSearchIngestModule implements IngestModuleAbstractFile
if (!server.isRunning()) { if (!server.isRunning()) {
String msg = "Keyword search server was not properly initialized, cannot run keyword search ingest. "; String msg = "Keyword search server was not properly initialized, cannot run keyword search ingest. ";
logger.log(Level.SEVERE, msg); logger.log(Level.SEVERE, msg);
String details = msg + "Please try restarting the OS and the application"; String details = msg + "Please try stopping old java Solr process (if it exists) and restart the application.";
services.postMessage(IngestMessage.createErrorMessage(++messageID, instance, msg, details)); services.postMessage(IngestMessage.createErrorMessage(++messageID, instance, msg, details));
return; return;
@ -362,6 +362,9 @@ public final class KeywordSearchIngestModule implements IngestModuleAbstractFile
} catch (KeywordSearchModuleException ex) { } catch (KeywordSearchModuleException ex) {
logger.log(Level.WARNING, "Error checking if Solr server is running while initializing ingest", ex); logger.log(Level.WARNING, "Error checking if Solr server is running while initializing ingest", ex);
//this means Solr is not properly initialized //this means Solr is not properly initialized
String msg = "Keyword search server was not properly initialized, cannot run keyword search ingest. ";
String details = msg + "Please try stopping old java Solr process (if it exists) and restart the application.";
services.postMessage(IngestMessage.createErrorMessage(++messageID, instance, msg, details));
return; return;
} }
@ -660,10 +663,10 @@ public final class KeywordSearchIngestModule implements IngestModuleAbstractFile
private final Logger logger = Logger.getLogger(Indexer.class.getName()); private final Logger logger = Logger.getLogger(Indexer.class.getName());
/** /**
* Extract text with Tika or other text extraction modules (by streaming) from the file Divide * Extract text with Tika or other text extraction modules (by
* the file into chunks and index the chunks * streaming) from the file Divide the file into chunks and index the
* chunks
* *
* @param aFile file to extract strings from, divide into chunks and * @param aFile file to extract strings from, divide into chunks and
* index * index
@ -706,8 +709,7 @@ public final class KeywordSearchIngestModule implements IngestModuleAbstractFile
if (stringExtractor.index(aFile)) { if (stringExtractor.index(aFile)) {
ingestStatus.put(aFile.getId(), IngestStatus.EXTRACTED_INGESTED); ingestStatus.put(aFile.getId(), IngestStatus.EXTRACTED_INGESTED);
return true; return true;
} } else {
else {
logger.log(Level.WARNING, "Failed to extract strings and ingest, file '" + aFile.getName() + "' (id: " + aFile.getId() + ")."); logger.log(Level.WARNING, "Failed to extract strings and ingest, file '" + aFile.getName() + "' (id: " + aFile.getId() + ").");
ingestStatus.put(aFile.getId(), IngestStatus.SKIPPED); ingestStatus.put(aFile.getId(), IngestStatus.SKIPPED);
return false; return false;
@ -720,9 +722,12 @@ public final class KeywordSearchIngestModule implements IngestModuleAbstractFile
} }
/** /**
* Check with every extractor if it supports the file with the detected format * Check with every extractor if it supports the file with the detected
* format
*
* @param aFile file to check for * @param aFile file to check for
* @param detectedFormat mime-type with detected format (such as text/plain) or null if not detected * @param detectedFormat mime-type with detected format (such as
* text/plain) or null if not detected
* @return true if text extraction is supported * @return true if text extraction is supported
*/ */
private boolean isTextExtractSupported(AbstractFile aFile, String detectedFormat) { private boolean isTextExtractSupported(AbstractFile aFile, String detectedFormat) {
@ -739,7 +744,8 @@ public final class KeywordSearchIngestModule implements IngestModuleAbstractFile
* Adds the file to the index. Detects file type, calls extractors, etc. * Adds the file to the index. Detects file type, calls extractors, etc.
* *
* @param aFile File to analyze * @param aFile File to analyze
* @param indexContent False if only metadata should be indexed. True if content and metadata should be index. * @param indexContent False if only metadata should be indexed. True if
* content and metadata should be index.
*/ */
private void indexFile(AbstractFile aFile, boolean indexContent) { private void indexFile(AbstractFile aFile, boolean indexContent) {
//logger.log(Level.INFO, "Processing AbstractFile: " + abstractFile.getName()); //logger.log(Level.INFO, "Processing AbstractFile: " + abstractFile.getName());
@ -749,9 +755,7 @@ public final class KeywordSearchIngestModule implements IngestModuleAbstractFile
if (aType.equals(TskData.TSK_DB_FILES_TYPE_ENUM.VIRTUAL_DIR)) { if (aType.equals(TskData.TSK_DB_FILES_TYPE_ENUM.VIRTUAL_DIR)) {
//skip indexing of virtual dirs (no content, no real name) - will index children files //skip indexing of virtual dirs (no content, no real name) - will index children files
return; return;
} } // unallocated and unused blocks can only have strings extracted from them.
// unallocated and unused blocks can only have strings extracted from them.
else if ((aType.equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) || aType.equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS))) { else if ((aType.equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) || aType.equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS))) {
extractStringsAndIndex(aFile); extractStringsAndIndex(aFile);
} }