Merge pull request #673 from mrtizmo/keywordsearch

KeywordSearch - Added NON-NLS tags to hardcoded strings not needing Nati...
This commit is contained in:
Richard Cordovano 2014-04-23 09:43:41 -04:00
commit 463d34c160
34 changed files with 429 additions and 428 deletions

View File

@ -44,37 +44,37 @@ interface AbstractFileExtract {
static final List<String> ARCHIVE_MIME_TYPES = static final List<String> ARCHIVE_MIME_TYPES =
Arrays.asList( Arrays.asList(
//ignore unstructured binary and compressed data, for which string extraction or unzipper works better //ignore unstructured binary and compressed data, for which string extraction or unzipper works better
"application/x-7z-compressed", "application/x-7z-compressed", //NON-NLS
"application/x-ace-compressed", "application/x-ace-compressed", //NON-NLS
"application/x-alz-compressed", "application/x-alz-compressed", //NON-NLS
"application/x-arj", "application/x-arj", //NON-NLS
"application/vnd.ms-cab-compressed", "application/vnd.ms-cab-compressed", //NON-NLS
"application/x-cfs-compressed", "application/x-cfs-compressed", //NON-NLS
"application/x-dgc-compressed", "application/x-dgc-compressed", //NON-NLS
"application/x-apple-diskimage", "application/x-apple-diskimage", //NON-NLS
"application/x-gca-compressed", "application/x-gca-compressed", //NON-NLS
"application/x-dar", "application/x-dar", //NON-NLS
"application/x-lzx", "application/x-lzx", //NON-NLS
"application/x-lzh", "application/x-lzh", //NON-NLS
"application/x-rar-compressed", "application/x-rar-compressed", //NON-NLS
"application/x-stuffit", "application/x-stuffit", //NON-NLS
"application/x-stuffitx", "application/x-stuffitx", //NON-NLS
"application/x-gtar", "application/x-gtar", //NON-NLS
"application/x-archive", "application/x-archive", //NON-NLS
"application/x-executable", "application/x-executable", //NON-NLS
"application/x-gzip", "application/x-gzip", //NON-NLS
"application/zip", "application/zip", //NON-NLS
"application/x-zoo", "application/x-zoo", //NON-NLS
"application/x-cpio", "application/x-cpio", //NON-NLS
"application/x-shar", "application/x-shar", //NON-NLS
"application/x-tar", "application/x-tar", //NON-NLS
"application/x-bzip", "application/x-bzip", //NON-NLS
"application/x-bzip2", "application/x-bzip2", //NON-NLS
"application/x-lzip", "application/x-lzip", //NON-NLS
"application/x-lzma", "application/x-lzma", //NON-NLS
"application/x-lzop", "application/x-lzop", //NON-NLS
"application/x-z", "application/x-z", //NON-NLS
"application/x-compress"); "application/x-compress"); //NON-NLS
/** /**
* Get number of chunks resulted from extracting this AbstractFile * Get number of chunks resulted from extracting this AbstractFile

View File

@ -53,12 +53,13 @@ import org.sleuthkit.datamodel.ReadContentInputStream;
private int numChunks = 0; private int numChunks = 0;
static final List<String> WEB_MIME_TYPES = Arrays.asList( static final List<String> WEB_MIME_TYPES = Arrays.asList(
"application/javascript", "application/javascript", //NON-NLS
"application/xhtml+xml", "application/xhtml+xml", //NON-NLS
"application/json", "application/json", //NON-NLS
"text/css", "text/css", //NON-NLS
"text/html", "text/html", //NON-NLS NON-NLS
"text/javascript" //"application/xml", "text/javascript" //NON-NLS
//"application/xml",
//"application/xml-dtd", //"application/xml-dtd",
); );
@ -114,7 +115,7 @@ import org.sleuthkit.datamodel.ReadContentInputStream;
// In case there is an exception or parse() isn't called // In case there is an exception or parse() isn't called
if (reader == null) { if (reader == null) {
logger.log(Level.WARNING, "No reader available from HTML parser"); logger.log(Level.WARNING, "No reader available from HTML parser"); //NON-NLS
return false; return false;
} }
@ -174,29 +175,29 @@ import org.sleuthkit.datamodel.ReadContentInputStream;
++this.numChunks; ++this.numChunks;
} catch (Ingester.IngesterException ingEx) { } catch (Ingester.IngesterException ingEx) {
success = false; success = false;
logger.log(Level.WARNING, "Ingester had a problem with extracted HTML from file '" logger.log(Level.WARNING, "Ingester had a problem with extracted HTML from file '" //NON-NLS
+ sourceFile.getName() + "' (id: " + sourceFile.getId() + ").", ingEx); + sourceFile.getName() + "' (id: " + sourceFile.getId() + ").", ingEx); //NON-NLS
throw ingEx; //need to rethrow/return to signal error and move on throw ingEx; //need to rethrow/return to signal error and move on
} }
} }
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Unable to read content stream from " + sourceFile.getId() + ": " + sourceFile.getName(), ex); logger.log(Level.WARNING, "Unable to read content stream from " + sourceFile.getId() + ": " + sourceFile.getName(), ex); //NON-NLS
success = false; success = false;
} catch (Exception ex) { } catch (Exception ex) {
logger.log(Level.WARNING, "Unexpected error, can't read content stream from " + sourceFile.getId() + ": " + sourceFile.getName(), ex); logger.log(Level.WARNING, "Unexpected error, can't read content stream from " + sourceFile.getId() + ": " + sourceFile.getName(), ex); //NON-NLS
success = false; success = false;
} finally { } finally {
try { try {
stream.close(); stream.close();
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Unable to close content stream from " + sourceFile.getId(), ex); logger.log(Level.WARNING, "Unable to close content stream from " + sourceFile.getId(), ex); //NON-NLS
} }
try { try {
if (reader != null) { if (reader != null) {
reader.close(); reader.close();
} }
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Unable to close content reader from " + sourceFile.getId(), ex); logger.log(Level.WARNING, "Unable to close content reader from " + sourceFile.getId(), ex); //NON-NLS
} }
} }

View File

@ -54,7 +54,7 @@ import org.sleuthkit.datamodel.AbstractFile;
@Override @Override
public String getContentType() { public String getContentType() {
return "text/plain;charset=" + charset.name(); return "text/plain;charset=" + charset.name(); //NON-NLS
} }
@Override @Override

View File

@ -141,7 +141,7 @@ class AbstractFileStringExtract implements AbstractFileExtract {
++this.numChunks; ++this.numChunks;
} catch (IngesterException ingEx) { } catch (IngesterException ingEx) {
success = false; success = false;
logger.log(Level.WARNING, "Ingester had a problem with extracted strings from file '" + sourceFile.getName() + "' (id: " + sourceFile.getId() + ").", ingEx); logger.log(Level.WARNING, "Ingester had a problem with extracted strings from file '" + sourceFile.getName() + "' (id: " + sourceFile.getId() + ").", ingEx); //NON-NLS
throw ingEx; //need to rethrow/return to signal error and move on throw ingEx; //need to rethrow/return to signal error and move on
} }
@ -153,13 +153,13 @@ class AbstractFileStringExtract implements AbstractFileExtract {
ingester.ingest(this); ingester.ingest(this);
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Unable to read input stream to divide and send to Solr, file: " + sourceFile.getName(), ex); logger.log(Level.WARNING, "Unable to read input stream to divide and send to Solr, file: " + sourceFile.getName(), ex); //NON-NLS
success = false; success = false;
} finally { } finally {
try { try {
stringStream.close(); stringStream.close();
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Error closing input stream stream, file: " + sourceFile.getName(), ex); logger.log(Level.WARNING, "Error closing input stream stream, file: " + sourceFile.getName(), ex); //NON-NLS
} }
} }

View File

@ -80,7 +80,7 @@ class AbstractFileTikaTextExtract implements AbstractFileExtract {
for (MediaType mt : mediaTypes) { for (MediaType mt : mediaTypes) {
TIKA_SUPPORTED_TYPES.add(mt.getType() + "/" + mt.getSubtype()); TIKA_SUPPORTED_TYPES.add(mt.getType() + "/" + mt.getSubtype());
} }
logger.log(Level.INFO, "Tika supported media types: {0}", TIKA_SUPPORTED_TYPES); logger.log(Level.INFO, "Tika supported media types: {0}", TIKA_SUPPORTED_TYPES); //NON-NLS
} }
@Override @Override
@ -149,7 +149,7 @@ class AbstractFileTikaTextExtract implements AbstractFileExtract {
reader = parseTask.getReader(); reader = parseTask.getReader();
if (reader == null) { if (reader == null) {
//likely due to exception in parse() //likely due to exception in parse()
logger.log(Level.WARNING, "No reader available from Tika parse"); logger.log(Level.WARNING, "No reader available from Tika parse"); //NON-NLS
return false; return false;
} }
@ -206,7 +206,7 @@ class AbstractFileTikaTextExtract implements AbstractFileExtract {
//sort meta data keys //sort meta data keys
List<String> sortedKeyList = Arrays.asList(meta.names()); List<String> sortedKeyList = Arrays.asList(meta.names());
Collections.sort(sortedKeyList); Collections.sort(sortedKeyList);
sb.append("\n\n------------------------------METADATA------------------------------\n\n"); sb.append("\n\n------------------------------METADATA------------------------------\n\n"); //NON-NLS
for (String key : sortedKeyList) { for (String key : sortedKeyList) {
String value = meta.get(key); String value = meta.get(key);
sb.append(key).append(": ").append(value).append("\n"); sb.append(key).append(": ").append(value).append("\n");
@ -224,18 +224,18 @@ class AbstractFileTikaTextExtract implements AbstractFileExtract {
++this.numChunks; ++this.numChunks;
} catch (Ingester.IngesterException ingEx) { } catch (Ingester.IngesterException ingEx) {
success = false; success = false;
logger.log(Level.WARNING, "Ingester had a problem with extracted strings from file '" logger.log(Level.WARNING, "Ingester had a problem with extracted strings from file '" //NON-NLS
+ sourceFile.getName() + "' (id: " + sourceFile.getId() + ").", ingEx); + sourceFile.getName() + "' (id: " + sourceFile.getId() + ").", ingEx); //NON-NLS
throw ingEx; //need to rethrow/return to signal error and move on throw ingEx; //need to rethrow/return to signal error and move on
} }
} }
} catch (IOException ex) { } catch (IOException ex) {
final String msg = "Exception: Unable to read Tika content stream from " + sourceFile.getId() + ": " + sourceFile.getName(); final String msg = "Exception: Unable to read Tika content stream from " + sourceFile.getId() + ": " + sourceFile.getName(); //NON-NLS
KeywordSearch.getTikaLogger().log(Level.WARNING, msg, ex); KeywordSearch.getTikaLogger().log(Level.WARNING, msg, ex);
logger.log(Level.WARNING, msg); logger.log(Level.WARNING, msg);
success = false; success = false;
} catch (Exception ex) { } catch (Exception ex) {
final String msg = "Exception: Unexpected error, can't read Tika content stream from " + sourceFile.getId() + ": " + sourceFile.getName(); final String msg = "Exception: Unexpected error, can't read Tika content stream from " + sourceFile.getId() + ": " + sourceFile.getName(); //NON-NLS
KeywordSearch.getTikaLogger().log(Level.WARNING, msg, ex); KeywordSearch.getTikaLogger().log(Level.WARNING, msg, ex);
logger.log(Level.WARNING, msg); logger.log(Level.WARNING, msg);
success = false; success = false;
@ -243,14 +243,14 @@ class AbstractFileTikaTextExtract implements AbstractFileExtract {
try { try {
stream.close(); stream.close();
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Unable to close Tika content stream from " + sourceFile.getId(), ex); logger.log(Level.WARNING, "Unable to close Tika content stream from " + sourceFile.getId(), ex); //NON-NLS
} }
try { try {
if (reader != null) { if (reader != null) {
reader.close(); reader.close();
} }
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Unable to close content reader from " + sourceFile.getId(), ex); logger.log(Level.WARNING, "Unable to close content reader from " + sourceFile.getId(), ex); //NON-NLS
} }
} }
@ -269,17 +269,17 @@ class AbstractFileTikaTextExtract implements AbstractFileExtract {
public boolean isSupported(AbstractFile file, String detectedFormat) { public boolean isSupported(AbstractFile file, String detectedFormat) {
if (detectedFormat == null) { if (detectedFormat == null) {
return false; return false;
} else if (detectedFormat.equals("application/octet-stream") } else if (detectedFormat.equals("application/octet-stream") //NON-NLS
|| detectedFormat.equals("application/x-msdownload")) { || detectedFormat.equals("application/x-msdownload")) { //NON-NLS
//any binary unstructured blobs (string extraction will be used) //any binary unstructured blobs (string extraction will be used)
return false; return false;
} else if (AbstractFileExtract.ARCHIVE_MIME_TYPES.contains(detectedFormat)) { } else if (AbstractFileExtract.ARCHIVE_MIME_TYPES.contains(detectedFormat)) {
return false; return false;
} //skip video other than flv (tika supports flv only) } //skip video other than flv (tika supports flv only)
else if (detectedFormat.contains("video/") else if (detectedFormat.contains("video/") //NON-NLS
&& !detectedFormat.equals("video/x-flv")) { && !detectedFormat.equals("video/x-flv")) { //NON-NLS
return false; return false;
} else if (detectedFormat.contains("application/x-font-ttf")) { } else if (detectedFormat.contains("application/x-font-ttf")) { //NON-NLS
// Tika currently has a bug in the ttf parser in fontbox. // Tika currently has a bug in the ttf parser in fontbox.
// It will throw an out of memory exception // It will throw an out of memory exception
return false; return false;
@ -319,11 +319,11 @@ class AbstractFileTikaTextExtract implements AbstractFileExtract {
try { try {
reader = tika.parse(stream, meta); reader = tika.parse(stream, meta);
} catch (IOException ex) { } catch (IOException ex) {
KeywordSearch.getTikaLogger().log(Level.WARNING, "Exception: Unable to Tika parse the content" + sourceFile.getId() + ": " + sourceFile.getName(), ex); KeywordSearch.getTikaLogger().log(Level.WARNING, "Exception: Unable to Tika parse the content" + sourceFile.getId() + ": " + sourceFile.getName(), ex); //NON-NLS
tika = null; tika = null;
reader = null; reader = null;
} catch (Exception ex) { } catch (Exception ex) {
KeywordSearch.getTikaLogger().log(Level.WARNING, "Exception: Unable to Tika parse the content" + sourceFile.getId() + ": " + sourceFile.getName(), ex); KeywordSearch.getTikaLogger().log(Level.WARNING, "Exception: Unable to Tika parse the content" + sourceFile.getId() + ": " + sourceFile.getName(), ex); //NON-NLS
tika = null; tika = null;
reader = null; reader = null;
} }

View File

@ -65,7 +65,7 @@ class ByteContentStream implements ContentStream {
@Override @Override
public String getContentType() { public String getContentType() {
return "text/plain;charset=" + charset.name(); return "text/plain;charset=" + charset.name(); //NON-NLS
} }
@Override @Override

View File

@ -161,7 +161,7 @@ public class DropdownSearchPanel extends AbstractKeywordSearchPerformer {
org.openide.awt.Mnemonics.setLocalizedText(selectAllMenuItem, org.openide.util.NbBundle.getMessage(DropdownSearchPanel.class, "DropdownSearchPanel.selectAllMenuItem.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(selectAllMenuItem, org.openide.util.NbBundle.getMessage(DropdownSearchPanel.class, "DropdownSearchPanel.selectAllMenuItem.text")); // NOI18N
rightClickMenu.add(selectAllMenuItem); rightClickMenu.add(selectAllMenuItem);
keywordTextField.setFont(new java.awt.Font("Monospaced", 0, 14)); // NOI18N keywordTextField.setFont(new java.awt.Font("Monospaced", 0, 14)); // NOI18N NON-NLS
keywordTextField.setText(org.openide.util.NbBundle.getMessage(DropdownSearchPanel.class, "DropdownSearchPanel.keywordTextField.text")); // NOI18N keywordTextField.setText(org.openide.util.NbBundle.getMessage(DropdownSearchPanel.class, "DropdownSearchPanel.keywordTextField.text")); // NOI18N
keywordTextField.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(192, 192, 192), 1, true)); keywordTextField.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(192, 192, 192), 1, true));
keywordTextField.setMinimumSize(new java.awt.Dimension(2, 25)); keywordTextField.setMinimumSize(new java.awt.Dimension(2, 25));
@ -177,7 +177,7 @@ public class DropdownSearchPanel extends AbstractKeywordSearchPerformer {
} }
}); });
searchButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/search-icon.png"))); // NOI18N searchButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/search-icon.png"))); // NOI18N NON-NLS
org.openide.awt.Mnemonics.setLocalizedText(searchButton, org.openide.util.NbBundle.getMessage(DropdownSearchPanel.class, "DropdownSearchPanel.searchButton.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(searchButton, org.openide.util.NbBundle.getMessage(DropdownSearchPanel.class, "DropdownSearchPanel.searchButton.text")); // NOI18N
searchButton.addActionListener(new java.awt.event.ActionListener() { searchButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -239,7 +239,7 @@ public class DropdownSearchPanel extends AbstractKeywordSearchPerformer {
try { try {
search(); search();
} catch(Exception e) { } catch(Exception e) {
logger.log(Level.SEVERE, "search() threw exception", e); logger.log(Level.SEVERE, "search() threw exception", e); //NON-NLS
} }
}//GEN-LAST:event_keywordTextFieldActionPerformed }//GEN-LAST:event_keywordTextFieldActionPerformed

View File

@ -122,7 +122,7 @@ class ExtractedContentPanel extends javax.swing.JPanel {
// set font size manually in an effort to get fonts in this panel to look // set font size manually in an effort to get fonts in this panel to look
// similar to what is in the 'String View' content viewer. // similar to what is in the 'String View' content viewer.
StyleSheet ss = editorKit.getStyleSheet(); StyleSheet ss = editorKit.getStyleSheet();
ss.addRule("body {font-size: 8.5px;}"); ss.addRule("body {font-size: 8.5px;}"); //NON-NLS
extractedTextPane.setEditorKit(editorKit); extractedTextPane.setEditorKit(editorKit);
@ -226,43 +226,43 @@ class ExtractedContentPanel extends javax.swing.JPanel {
hitButtonsLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.hitButtonsLabel.text")); // NOI18N hitButtonsLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.hitButtonsLabel.text")); // NOI18N
hitPreviousButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back.png"))); // NOI18N hitPreviousButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back.png"))); // NOI18N NON-NLS
hitPreviousButton.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.hitPreviousButton.text")); // NOI18N hitPreviousButton.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.hitPreviousButton.text")); // NOI18N
hitPreviousButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); hitPreviousButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
hitPreviousButton.setBorderPainted(false); hitPreviousButton.setBorderPainted(false);
hitPreviousButton.setContentAreaFilled(false); hitPreviousButton.setContentAreaFilled(false);
hitPreviousButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back_disabled.png"))); // NOI18N hitPreviousButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back_disabled.png"))); // NOI18N NON-NLS
hitPreviousButton.setMargin(new java.awt.Insets(2, 0, 2, 0)); hitPreviousButton.setMargin(new java.awt.Insets(2, 0, 2, 0));
hitPreviousButton.setPreferredSize(new java.awt.Dimension(23, 23)); hitPreviousButton.setPreferredSize(new java.awt.Dimension(23, 23));
hitPreviousButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back_hover.png"))); // NOI18N hitPreviousButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back_hover.png"))); // NOI18N NON-NLS
hitNextButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward.png"))); // NOI18N hitNextButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward.png"))); // NOI18N NON-NLS
hitNextButton.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.hitNextButton.text")); // NOI18N hitNextButton.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.hitNextButton.text")); // NOI18N
hitNextButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); hitNextButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
hitNextButton.setBorderPainted(false); hitNextButton.setBorderPainted(false);
hitNextButton.setContentAreaFilled(false); hitNextButton.setContentAreaFilled(false);
hitNextButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward_disabled.png"))); // NOI18N hitNextButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward_disabled.png"))); // NOI18N NON-NLS
hitNextButton.setMargin(new java.awt.Insets(2, 0, 2, 0)); hitNextButton.setMargin(new java.awt.Insets(2, 0, 2, 0));
hitNextButton.setPreferredSize(new java.awt.Dimension(23, 23)); hitNextButton.setPreferredSize(new java.awt.Dimension(23, 23));
hitNextButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward_hover.png"))); // NOI18N hitNextButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward_hover.png"))); // NOI18N NON-NLS
pageButtonsLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.pageButtonsLabel.text")); // NOI18N pageButtonsLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.pageButtonsLabel.text")); // NOI18N
pagePreviousButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back.png"))); // NOI18N pagePreviousButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back.png"))); // NOI18N NON-NLS
pagePreviousButton.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.pagePreviousButton.text")); // NOI18N pagePreviousButton.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.pagePreviousButton.text")); // NOI18N
pagePreviousButton.setActionCommand(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.pagePreviousButton.actionCommand")); // NOI18N pagePreviousButton.setActionCommand(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.pagePreviousButton.actionCommand")); // NOI18N
pagePreviousButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); pagePreviousButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
pagePreviousButton.setBorderPainted(false); pagePreviousButton.setBorderPainted(false);
pagePreviousButton.setContentAreaFilled(false); pagePreviousButton.setContentAreaFilled(false);
pagePreviousButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back_disabled.png"))); // NOI18N pagePreviousButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back_disabled.png"))); // NOI18N NON-NLS
pagePreviousButton.setMargin(new java.awt.Insets(2, 0, 2, 0)); pagePreviousButton.setMargin(new java.awt.Insets(2, 0, 2, 0));
pageNextButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward.png"))); // NOI18N pageNextButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward.png"))); // NOI18N NON-NLS
pageNextButton.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.pageNextButton.text")); // NOI18N pageNextButton.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.pageNextButton.text")); // NOI18N
pageNextButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); pageNextButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
pageNextButton.setBorderPainted(false); pageNextButton.setBorderPainted(false);
pageNextButton.setContentAreaFilled(false); pageNextButton.setContentAreaFilled(false);
pageNextButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward_disabled.png"))); // NOI18N pageNextButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward_disabled.png"))); // NOI18N NON-NLS
pageNextButton.setMargin(new java.awt.Insets(2, 0, 2, 0)); pageNextButton.setMargin(new java.awt.Insets(2, 0, 2, 0));
pageNextButton.setPreferredSize(new java.awt.Dimension(23, 23)); pageNextButton.setPreferredSize(new java.awt.Dimension(23, 23));
@ -416,7 +416,7 @@ class ExtractedContentPanel extends javax.swing.JPanel {
//detect text direction using first 1024 chars and set it //detect text direction using first 1024 chars and set it
//get first up to 1024 chars, strip <pre> tag and unescape html to get the string on which to detect //get first up to 1024 chars, strip <pre> tag and unescape html to get the string on which to detect
final int len = text.length(); final int len = text.length();
final int prefixLen = "<pre>".length(); final int prefixLen = "<pre>".length(); //NON-NLS
if (len > prefixLen) { if (len > prefixLen) {
final int maxOrientChars = Math.min(len, 1024); final int maxOrientChars = Math.min(len, 1024);
final String orientDetectText = EscapeUtil.unEscapeHtml(text.substring(prefixLen, maxOrientChars)); final String orientDetectText = EscapeUtil.unEscapeHtml(text.substring(prefixLen, maxOrientChars));
@ -708,7 +708,7 @@ class ExtractedContentPanel extends javax.swing.JPanel {
try { try {
get(); get();
} catch (InterruptedException | ExecutionException ex) { } catch (InterruptedException | ExecutionException ex) {
logger.log(Level.SEVERE, "Error getting marked up text" ); logger.log(Level.SEVERE, "Error getting marked up text" ); //NON-NLS
} }
// catch and ignore if we were cancelled // catch and ignore if we were cancelled
catch (java.util.concurrent.CancellationException ex ) { } catch (java.util.concurrent.CancellationException ex ) { }

View File

@ -62,7 +62,7 @@ public class ExtractedContentViewer implements DataContentViewer {
private int curContentChunk; private int curContentChunk;
public ExtractedContentViewer() { public ExtractedContentViewer() {
logger.log(Level.INFO, "Created TextView instance: " + this); logger.log(Level.INFO, "Created TextView instance: " + this); //NON-NLS
} }
@Override @Override
@ -186,7 +186,7 @@ public class ExtractedContentViewer implements DataContentViewer {
try { try {
return getSolrContent(selectedNode, currentPage, hasChunks); return getSolrContent(selectedNode, currentPage, hasChunks);
} catch (SolrServerException ex) { } catch (SolrServerException ex) {
logger.log(Level.WARNING, "Couldn't get extracted content.", ex); logger.log(Level.WARNING, "Couldn't get extracted content.", ex); //NON-NLS
return ""; return "";
} }
} }
@ -234,10 +234,10 @@ public class ExtractedContentViewer implements DataContentViewer {
} }
inited = true; inited = true;
} catch (KeywordSearchModuleException ex) { } catch (KeywordSearchModuleException ex) {
logger.log(Level.WARNING, "Could not get number of chunks: ", ex); logger.log(Level.WARNING, "Could not get number of chunks: ", ex); //NON-NLS
} catch (NoOpenCoreException ex) { } catch (NoOpenCoreException ex) {
logger.log(Level.WARNING, "Could not get number of chunks: ", ex); logger.log(Level.WARNING, "Could not get number of chunks: ", ex); //NON-NLS
} }
return numPages; return numPages;
} }
@ -395,10 +395,10 @@ public class ExtractedContentViewer implements DataContentViewer {
try { try {
return solrServer.queryIsIndexed(contentID); return solrServer.queryIsIndexed(contentID);
} catch (NoOpenCoreException ex) { } catch (NoOpenCoreException ex) {
logger.log(Level.WARNING, "Couldn't determine whether content is supported.", ex); logger.log(Level.WARNING, "Couldn't determine whether content is supported.", ex); //NON-NLS
return false; return false;
} catch (KeywordSearchModuleException ex) { } catch (KeywordSearchModuleException ex) {
logger.log(Level.WARNING, "Couldn't determine whether content is supported.", ex); logger.log(Level.WARNING, "Couldn't determine whether content is supported.", ex); //NON-NLS
return false; return false;
} }
} }
@ -456,12 +456,12 @@ public class ExtractedContentViewer implements DataContentViewer {
try { try {
curContent = EscapeUtil.escapeHtml(solrServer.getSolrContent(contentObj, chunkId)).trim(); curContent = EscapeUtil.escapeHtml(solrServer.getSolrContent(contentObj, chunkId)).trim();
StringBuilder sb = new StringBuilder(curContent.length() + 20); StringBuilder sb = new StringBuilder(curContent.length() + 20);
sb.append("<pre>").append(curContent).append("</pre>"); sb.append("<pre>").append(curContent).append("</pre>"); //NON-NLS
curContent = sb.toString(); curContent = sb.toString();
curContentId = contentId; curContentId = contentId;
curContentChunk = chunkId; curContentChunk = chunkId;
} catch (NoOpenCoreException ex) { } catch (NoOpenCoreException ex) {
logger.log(Level.WARNING, "Couldn't get text content.", ex); logger.log(Level.WARNING, "Couldn't get text content.", ex); //NON-NLS
return ""; return "";
} }
return curContent; return curContent;

View File

@ -44,8 +44,8 @@ import org.sleuthkit.datamodel.Content;
class HighlightedMatchesSource implements MarkupSource, HighlightLookup { class HighlightedMatchesSource implements MarkupSource, HighlightLookup {
private static final Logger logger = Logger.getLogger(HighlightedMatchesSource.class.getName()); private static final Logger logger = Logger.getLogger(HighlightedMatchesSource.class.getName());
private static final String HIGHLIGHT_PRE = "<span style='background:yellow'>"; private static final String HIGHLIGHT_PRE = "<span style='background:yellow'>"; //NON-NLS
private static final String HIGHLIGHT_POST = "</span>"; private static final String HIGHLIGHT_POST = "</span>"; //NON-NLS
private static final String ANCHOR_PREFIX = HighlightedMatchesSource.class.getName() + "_"; private static final String ANCHOR_PREFIX = HighlightedMatchesSource.class.getName() + "_";
private Content content; private Content content;
@ -105,10 +105,10 @@ class HighlightedMatchesSource implements MarkupSource, HighlightLookup {
try { try {
this.numberPages = solrServer.queryNumFileChunks(content.getId()); this.numberPages = solrServer.queryNumFileChunks(content.getId());
} catch (KeywordSearchModuleException ex) { } catch (KeywordSearchModuleException ex) {
logger.log(Level.WARNING, "Could not get number pages for content: " + content.getId()); logger.log(Level.WARNING, "Could not get number pages for content: " + content.getId()); //NON-NLS
return; return;
} catch (NoOpenCoreException ex) { } catch (NoOpenCoreException ex) {
logger.log(Level.WARNING, "Could not get number pages for content: " + content.getId()); logger.log(Level.WARNING, "Could not get number pages for content: " + content.getId()); //NON-NLS
return; return;
} }
@ -146,7 +146,7 @@ class HighlightedMatchesSource implements MarkupSource, HighlightLookup {
try { try {
hits = chunksQuery.performQuery(); hits = chunksQuery.performQuery();
} catch (NoOpenCoreException ex) { } catch (NoOpenCoreException ex) {
logger.log(Level.INFO, "Could not get chunk info and get highlights", ex); logger.log(Level.INFO, "Could not get chunk info and get highlights", ex); //NON-NLS
return; return;
} }
} }
@ -355,13 +355,13 @@ class HighlightedMatchesSource implements MarkupSource, HighlightLookup {
q.setHighlightFragsize(0); // don't fragment the highlight, works with original highlighter, or needs "single" list builder with FVH q.setHighlightFragsize(0); // don't fragment the highlight, works with original highlighter, or needs "single" list builder with FVH
//tune the highlighter //tune the highlighter
q.setParam("hl.useFastVectorHighlighter", "on"); //fast highlighter scales better than standard one q.setParam("hl.useFastVectorHighlighter", "on"); //fast highlighter scales better than standard one NON-NLS
q.setParam("hl.tag.pre", HIGHLIGHT_PRE); //makes sense for FastVectorHighlighter only q.setParam("hl.tag.pre", HIGHLIGHT_PRE); //makes sense for FastVectorHighlighter only NON-NLS
q.setParam("hl.tag.post", HIGHLIGHT_POST); //makes sense for FastVectorHighlighter only q.setParam("hl.tag.post", HIGHLIGHT_POST); //makes sense for FastVectorHighlighter only NON-NLS
q.setParam("hl.fragListBuilder", "single"); //makes sense for FastVectorHighlighter only q.setParam("hl.fragListBuilder", "single"); //makes sense for FastVectorHighlighter only NON-NLS
//docs says makes sense for the original Highlighter only, but not really //docs says makes sense for the original Highlighter only, but not really
q.setParam("hl.maxAnalyzedChars", Server.HL_ANALYZE_CHARS_UNLIMITED); q.setParam("hl.maxAnalyzedChars", Server.HL_ANALYZE_CHARS_UNLIMITED); //NON-NLS
try { try {
QueryResponse response = solrServer.query(q, METHOD.POST); QueryResponse response = solrServer.query(q, METHOD.POST);
@ -381,13 +381,13 @@ class HighlightedMatchesSource implements MarkupSource, HighlightLookup {
highlightedContent = insertAnchors(highlightedContent); highlightedContent = insertAnchors(highlightedContent);
return "<html><pre>" + highlightedContent + "</pre></html>"; return "<html><pre>" + highlightedContent + "</pre></html>"; //NON-NLS
} }
} catch (NoOpenCoreException ex) { } catch (NoOpenCoreException ex) {
logger.log(Level.WARNING, "Couldn't query markup for page: " + currentPage, ex); logger.log(Level.WARNING, "Couldn't query markup for page: " + currentPage, ex); //NON-NLS
return ""; return "";
} catch (KeywordSearchModuleException ex) { } catch (KeywordSearchModuleException ex) {
logger.log(Level.WARNING, "Could not query markup for page: " + currentPage, ex); logger.log(Level.WARNING, "Could not query markup for page: " + currentPage, ex); //NON-NLS
return ""; return "";
} }
} }
@ -423,8 +423,8 @@ class HighlightedMatchesSource implements MarkupSource, HighlightLookup {
final String searchToken = HIGHLIGHT_PRE; final String searchToken = HIGHLIGHT_PRE;
final int indexSearchTokLen = searchToken.length(); final int indexSearchTokLen = searchToken.length();
final String insertPre = "<a name='" + ANCHOR_PREFIX; final String insertPre = "<a name='" + ANCHOR_PREFIX; //NON-NLS
final String insertPost = "'></a>"; final String insertPost = "'></a>"; //NON-NLS
int count = 0; int count = 0;
while ((index = buf.indexOf(searchToken, searchOffset)) >= 0) { while ((index = buf.indexOf(searchToken, searchOffset)) >= 0) {
String insertString = insertPre + Integer.toString(count + 1) + insertPost; String insertString = insertPre + Integer.toString(count + 1) + insertPost;

View File

@ -74,7 +74,7 @@ class Ingester {
//for ingesting chunk as SolrInputDocument (non-content-streaming, by-pass tika) //for ingesting chunk as SolrInputDocument (non-content-streaming, by-pass tika)
//TODO use a streaming way to add content to /update handler //TODO use a streaming way to add content to /update handler
private static final int MAX_DOC_CHUNK_SIZE = 1024*1024; private static final int MAX_DOC_CHUNK_SIZE = 1024*1024;
private static final String docContentEncoding = "UTF-8"; private static final String docContentEncoding = "UTF-8"; //NON-NLS
private Ingester() { private Ingester() {
@ -94,7 +94,7 @@ class Ingester {
// Warn if files might have been left uncommited. // Warn if files might have been left uncommited.
if (uncommitedIngests) { if (uncommitedIngests) {
logger.warning("Ingester was used to add files that it never committed."); logger.warning("Ingester was used to add files that it never committed."); //NON-NLS
} }
} }
@ -249,7 +249,7 @@ class Ingester {
dataSourceId = curCase.getFileDataSource(af); dataSourceId = curCase.getFileDataSource(af);
params.put(Server.Schema.IMAGE_ID.toString(), Long.toString(dataSourceId)); params.put(Server.Schema.IMAGE_ID.toString(), Long.toString(dataSourceId));
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Could not get data source id to properly index the file " + af.getId()); logger.log(Level.SEVERE, "Could not get data source id to properly index the file " + af.getId()); //NON-NLS
params.put(Server.Schema.IMAGE_ID.toString(), Long.toString(-1)); params.put(Server.Schema.IMAGE_ID.toString(), Long.toString(-1));
} }
@ -309,7 +309,7 @@ class Ingester {
try { try {
is.close(); is.close();
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Could not close input stream after reading content, " + cs.getName(), ex); logger.log(Level.WARNING, "Could not close input stream after reading content, " + cs.getName(), ex); //NON-NLS
} }
} }
@ -356,34 +356,34 @@ class Ingester {
* content, but the Solr server is probably fine. * content, but the Solr server is probably fine.
*/ */
private void ingestExtract(ContentStream cs, Map<String, String> fields, final long size) throws IngesterException { private void ingestExtract(ContentStream cs, Map<String, String> fields, final long size) throws IngesterException {
final ContentStreamUpdateRequest up = new ContentStreamUpdateRequest("/update/extract"); final ContentStreamUpdateRequest up = new ContentStreamUpdateRequest("/update/extract"); //NON-NLS
up.addContentStream(cs); up.addContentStream(cs);
setFields(up, fields); setFields(up, fields);
up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true); up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
final String contentType = cs.getContentType(); final String contentType = cs.getContentType();
if (contentType != null && !contentType.trim().equals("")) { if (contentType != null && !contentType.trim().equals("")) {
up.setParam("stream.contentType", contentType); up.setParam("stream.contentType", contentType); //NON-NLS
} }
//logger.log(Level.INFO, "Ingesting " + fields.get("file_name")); //logger.log(Level.INFO, "Ingesting " + fields.get("file_name"));
up.setParam("commit", "false"); up.setParam("commit", "false"); //NON-NLS
final Future<?> f = upRequestExecutor.submit(new UpRequestTask(up)); final Future<?> f = upRequestExecutor.submit(new UpRequestTask(up));
try { try {
f.get(getTimeout(size), TimeUnit.SECONDS); f.get(getTimeout(size), TimeUnit.SECONDS);
} catch (TimeoutException te) { } catch (TimeoutException te) {
logger.log(Level.WARNING, "Solr timeout encountered, trying to restart Solr"); logger.log(Level.WARNING, "Solr timeout encountered, trying to restart Solr"); //NON-NLS
//restart may be needed to recover from some error conditions //restart may be needed to recover from some error conditions
hardSolrRestart(); hardSolrRestart();
throw new IngesterException( throw new IngesterException(
NbBundle.getMessage(this.getClass(), "Ingester.ingestExtract.exception.solrTimeout.msg", NbBundle.getMessage(this.getClass(), "Ingester.ingestExtract.exception.solrTimeout.msg",
fields.get("id"), fields.get("file_name"))); fields.get("id"), fields.get("file_name"))); //NON-NLS
} catch (Exception e) { } catch (Exception e) {
throw new IngesterException( throw new IngesterException(
NbBundle.getMessage(this.getClass(), "Ingester.ingestExtract.exception.probPostToSolr.msg", NbBundle.getMessage(this.getClass(), "Ingester.ingestExtract.exception.probPostToSolr.msg",
fields.get("id"), fields.get("file_name")), e); fields.get("id"), fields.get("file_name")), e); //NON-NLS
} }
uncommitedIngests = true; uncommitedIngests = true;
} }
@ -395,7 +395,7 @@ class Ingester {
try { try {
solrServer.closeCore(); solrServer.closeCore();
} catch (KeywordSearchModuleException ex) { } catch (KeywordSearchModuleException ex) {
logger.log(Level.WARNING, "Cannot close core", ex); logger.log(Level.WARNING, "Cannot close core", ex); //NON-NLS
} }
solrServer.stop(); solrServer.stop();
@ -403,15 +403,15 @@ class Ingester {
try { try {
solrServer.start(); solrServer.start();
} catch (KeywordSearchModuleException ex) { } catch (KeywordSearchModuleException ex) {
logger.log(Level.WARNING, "Cannot start", ex); logger.log(Level.WARNING, "Cannot start", ex); //NON-NLS
} catch (SolrServerNoPortException ex) { } catch (SolrServerNoPortException ex) {
logger.log(Level.WARNING, "Cannot start server with this port", ex); logger.log(Level.WARNING, "Cannot start server with this port", ex); //NON-NLS
} }
try { try {
solrServer.openCore(); solrServer.openCore();
} catch (KeywordSearchModuleException ex) { } catch (KeywordSearchModuleException ex) {
logger.log(Level.WARNING, "Cannot open core", ex); logger.log(Level.WARNING, "Cannot open core", ex); //NON-NLS
} }
} }
@ -491,9 +491,9 @@ class Ingester {
solrServer.commit(); solrServer.commit();
uncommitedIngests = false; uncommitedIngests = false;
} catch (NoOpenCoreException ex) { } catch (NoOpenCoreException ex) {
logger.log(Level.WARNING, "Error commiting index", ex); logger.log(Level.WARNING, "Error commiting index", ex); //NON-NLS
} catch (SolrServerException ex) { } catch (SolrServerException ex) {
logger.log(Level.WARNING, "Error commiting index", ex); logger.log(Level.WARNING, "Error commiting index", ex); //NON-NLS
} }
} }
@ -505,7 +505,7 @@ class Ingester {
*/ */
private static void setFields(ContentStreamUpdateRequest up, Map<String, String> fields) { private static void setFields(ContentStreamUpdateRequest up, Map<String, String> fields) {
for (Entry<String, String> field : fields.entrySet()) { for (Entry<String, String> field : fields.entrySet()) {
up.setParam("literal." + field.getKey(), field.getValue()); up.setParam("literal." + field.getKey(), field.getValue()); //NON-NLS
} }
} }

View File

@ -53,19 +53,19 @@ class Installer extends ModuleInstall {
//TODO revise this logic, handle other server types, move some logic to Server class //TODO revise this logic, handle other server types, move some logic to Server class
try { try {
//check if running from previous application instance and try to shut down //check if running from previous application instance and try to shut down
logger.log(Level.INFO, "Checking if server is running"); logger.log(Level.INFO, "Checking if server is running"); //NON-NLS
if (server.isRunning()) { if (server.isRunning()) {
//TODO this could hang if other type of server is running //TODO this could hang if other type of server is running
logger.log(Level.WARNING, "Already a server running on " + server.getCurrentSolrServerPort() logger.log(Level.WARNING, "Already a server running on " + server.getCurrentSolrServerPort() //NON-NLS
+ " port, maybe leftover from a previous run. Trying to shut it down."); + " port, maybe leftover from a previous run. Trying to shut it down."); //NON-NLS
//stop gracefully //stop gracefully
server.stop(); server.stop();
logger.log(Level.INFO, "Re-checking if server is running"); logger.log(Level.INFO, "Re-checking if server is running"); //NON-NLS
if (server.isRunning()) { if (server.isRunning()) {
int serverPort = server.getCurrentSolrServerPort(); int serverPort = server.getCurrentSolrServerPort();
int serverStopPort = server.getCurrentSolrStopPort(); int serverStopPort = server.getCurrentSolrStopPort();
logger.log(Level.SEVERE, "There's already a server running on " logger.log(Level.SEVERE, "There's already a server running on " //NON-NLS
+ serverPort + " port that can't be shutdown."); + serverPort + " port that can't be shutdown."); //NON-NLS
if (!Server.isPortAvailable(serverPort)) { if (!Server.isPortAvailable(serverPort)) {
reportPortError(serverPort); reportPortError(serverPort);
} else if (!Server.isPortAvailable(serverStopPort)) { } else if (!Server.isPortAvailable(serverStopPort)) {
@ -78,13 +78,13 @@ class Installer extends ModuleInstall {
//in this case give up //in this case give up
} else { } else {
logger.log(Level.INFO, "Old Solr server shutdown successfully."); logger.log(Level.INFO, "Old Solr server shutdown successfully."); //NON-NLS
//make sure there really isn't a hang Solr process, in case isRunning() reported false //make sure there really isn't a hang Solr process, in case isRunning() reported false
server.killSolr(); server.killSolr();
} }
} }
} catch (KeywordSearchModuleException e) { } catch (KeywordSearchModuleException e) {
logger.log(Level.SEVERE, "Starting server failed, will try to kill. ", e); logger.log(Level.SEVERE, "Starting server failed, will try to kill. ", e); //NON-NLS
server.killSolr(); server.killSolr();
} }
@ -94,13 +94,13 @@ class Installer extends ModuleInstall {
//Try to bind to the port 4 times at 1 second intervals. //Try to bind to the port 4 times at 1 second intervals.
//TODO move some of this logic to Server class //TODO move some of this logic to Server class
for (int i = 0; i <= 3; i++) { for (int i = 0; i <= 3; i++) {
logger.log(Level.INFO, "Checking if port available."); logger.log(Level.INFO, "Checking if port available."); //NON-NLS
if (Server.isPortAvailable(server.getCurrentSolrServerPort())) { if (Server.isPortAvailable(server.getCurrentSolrServerPort())) {
logger.log(Level.INFO, "Port available, trying to start server."); logger.log(Level.INFO, "Port available, trying to start server."); //NON-NLS
server.start(); server.start();
break; break;
} else if (i == 3) { } else if (i == 3) {
logger.log(Level.INFO, "No port available, done retrying."); logger.log(Level.INFO, "No port available, done retrying."); //NON-NLS
reportPortError(server.getCurrentSolrServerPort()); reportPortError(server.getCurrentSolrServerPort());
retries = 0; retries = 0;
break; break;
@ -108,16 +108,16 @@ class Installer extends ModuleInstall {
try { try {
Thread.sleep(1000); Thread.sleep(1000);
} catch (InterruptedException iex) { } catch (InterruptedException iex) {
logger.log(Level.WARNING, "Timer interrupted"); logger.log(Level.WARNING, "Timer interrupted"); //NON-NLS
} }
} }
} }
} catch (SolrServerNoPortException npe) { } catch (SolrServerNoPortException npe) {
logger.log(Level.SEVERE, "Starting server failed due to no port available. ", npe); logger.log(Level.SEVERE, "Starting server failed due to no port available. ", npe); //NON-NLS
//try to kill it //try to kill it
} catch (KeywordSearchModuleException e) { } catch (KeywordSearchModuleException e) {
logger.log(Level.SEVERE, "Starting server failed. ", e); logger.log(Level.SEVERE, "Starting server failed. ", e); //NON-NLS
} }
@ -127,25 +127,25 @@ class Installer extends ModuleInstall {
try { try {
Thread.sleep(1000); Thread.sleep(1000);
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
logger.log(Level.WARNING, "Timer interrupted."); logger.log(Level.WARNING, "Timer interrupted."); //NON-NLS
} }
try { try {
logger.log(Level.INFO, "Ensuring the server is running, retries remaining: " + retries); logger.log(Level.INFO, "Ensuring the server is running, retries remaining: " + retries); //NON-NLS
if (!server.isRunning()) { if (!server.isRunning()) {
logger.log(Level.WARNING, "Server still not running"); logger.log(Level.WARNING, "Server still not running"); //NON-NLS
try { try {
logger.log(Level.WARNING, "Trying to start the server. "); logger.log(Level.WARNING, "Trying to start the server. "); //NON-NLS
server.start(); server.start();
} catch (SolrServerNoPortException npe) { } catch (SolrServerNoPortException npe) {
logger.log(Level.SEVERE, "Starting server failed due to no port available. ", npe); logger.log(Level.SEVERE, "Starting server failed due to no port available. ", npe); //NON-NLS
} }
} else { } else {
logger.log(Level.INFO, "Server appears now running. "); logger.log(Level.INFO, "Server appears now running. "); //NON-NLS
break; break;
} }
} catch (KeywordSearchModuleException ex) { } catch (KeywordSearchModuleException ex) {
logger.log(Level.SEVERE, "Starting server failed. ", ex); logger.log(Level.SEVERE, "Starting server failed. ", ex); //NON-NLS
//retry if has retries //retry if has retries
} }
@ -156,12 +156,12 @@ class Installer extends ModuleInstall {
try { try {
Thread.sleep(1000); Thread.sleep(1000);
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
logger.log(Level.WARNING, "Timer interrupted."); logger.log(Level.WARNING, "Timer interrupted."); //NON-NLS
} }
try { try {
logger.log(Level.INFO, "Last check if server is running. "); logger.log(Level.INFO, "Last check if server is running. "); //NON-NLS
if (!server.isRunning()) { if (!server.isRunning()) {
logger.log(Level.SEVERE, "Server is still not running. "); logger.log(Level.SEVERE, "Server is still not running. "); //NON-NLS
//check if port is taken or some other reason //check if port is taken or some other reason
int serverPort = server.getCurrentSolrServerPort(); int serverPort = server.getCurrentSolrServerPort();
int serverStopPort = server.getCurrentSolrStopPort(); int serverStopPort = server.getCurrentSolrStopPort();
@ -175,7 +175,7 @@ class Installer extends ModuleInstall {
} }
} }
} catch (KeywordSearchModuleException ex) { } catch (KeywordSearchModuleException ex) {
logger.log(Level.SEVERE, "Starting server failed. ", ex); logger.log(Level.SEVERE, "Starting server failed. ", ex); //NON-NLS
reportInitError(); reportInitError();
} }

View File

@ -83,7 +83,7 @@ class JerichoParserWrapper {
// Get all the tags in the source // Get all the tags in the source
List<StartTag> tags = source.getAllStartTags(); List<StartTag> tags = source.getAllStartTags();
for(StartTag tag : tags) { for(StartTag tag : tags) {
if(tag.getName().equals("script")) { if(tag.getName().equals("script")) { //NON-NLS
// If the <script> tag has attributes // If the <script> tag has attributes
scripts.append(numScripts).append(") "); scripts.append(numScripts).append(") ");
if(tag.getTagContent().length()>0) { if(tag.getTagContent().length()>0) {
@ -92,11 +92,11 @@ class JerichoParserWrapper {
// Get whats between the <script> .. </script> tags // Get whats between the <script> .. </script> tags
scripts.append(tag.getElement().getContent()).append("\n"); scripts.append(tag.getElement().getContent()).append("\n");
numScripts++; numScripts++;
} else if(tag.getName().equals("a")) { } else if(tag.getName().equals("a")) { //NON-NLS
links.append(numLinks).append(") "); links.append(numLinks).append(") ");
links.append(tag.getTagContent()).append("\n"); links.append(tag.getTagContent()).append("\n");
numLinks++; numLinks++;
} else if(tag.getName().equals("img")) { } else if(tag.getName().equals("img")) { //NON-NLS
images.append(numImages).append(") "); images.append(numImages).append(") ");
images.append(tag.getTagContent()).append("\n"); images.append(tag.getTagContent()).append("\n");
numImages++; numImages++;
@ -118,27 +118,27 @@ class JerichoParserWrapper {
out.append(text).append("\n\n"); out.append(text).append("\n\n");
out.append("----------NONVISIBLE TEXT----------\n\n"); out.append("----------NONVISIBLE TEXT----------\n\n"); //NON-NLS
if(numScripts>1) { if(numScripts>1) {
out.append("---Scripts---\n"); out.append("---Scripts---\n"); //NON-NLS
out.append(scripts.toString()).append("\n"); out.append(scripts.toString()).append("\n");
} if(numLinks>1) { } if(numLinks>1) {
out.append("---Links---\n"); out.append("---Links---\n"); //NON-NLS
out.append(links.toString()).append("\n"); out.append(links.toString()).append("\n");
} if(numImages>1) { } if(numImages>1) {
out.append("---Images---\n"); out.append("---Images---\n"); //NON-NLS
out.append(images.toString()).append("\n"); out.append(images.toString()).append("\n");
} if(numComments>1) { } if(numComments>1) {
out.append("---Comments---\n"); out.append("---Comments---\n"); //NON-NLS
out.append(comments.toString()).append("\n"); out.append(comments.toString()).append("\n");
} if(numOthers>1) { } if(numOthers>1) {
out.append("---Others---\n"); out.append("---Others---\n"); //NON-NLS
out.append(others.toString()).append("\n"); out.append(others.toString()).append("\n");
} }
// All done, now make it a reader // All done, now make it a reader
reader = new StringReader(out.toString()); reader = new StringReader(out.toString());
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Unable to parse the HTML file", ex); logger.log(Level.WARNING, "Unable to parse the HTML file", ex); //NON-NLS
} }
} }

View File

@ -42,12 +42,12 @@ public class KeywordSearch {
private static Server server; private static Server server;
//we want a custom java.util.logging.Logger here for a reason //we want a custom java.util.logging.Logger here for a reason
//a separate logger from framework logs //a separate logger from framework logs
private static final Logger TIKA_LOGGER = Logger.getLogger("Tika"); private static final Logger TIKA_LOGGER = Logger.getLogger("Tika"); //NON-NLS
private static final Logger logger = Logger.getLogger(Case.class.getName()); private static final Logger logger = Logger.getLogger(Case.class.getName());
public enum QueryType { public enum QueryType {
LITERAL, REGEX LITERAL, REGEX
}; };
public static final String NUM_FILES_CHANGE_EVT = "NUM_FILES_CHANGE_EVT"; public static final String NUM_FILES_CHANGE_EVT = "NUM_FILES_CHANGE_EVT"; //NON-NLS
private static PropertyChangeSupport changeSupport = new PropertyChangeSupport(KeywordSearch.class); private static PropertyChangeSupport changeSupport = new PropertyChangeSupport(KeywordSearch.class);
/** /**
@ -66,7 +66,7 @@ public class KeywordSearch {
static { static {
try { try {
final int MAX_TIKA_LOG_FILES = 3; final int MAX_TIKA_LOG_FILES = 3;
FileHandler tikaLogHandler = new FileHandler(PlatformUtil.getUserDirectory().getAbsolutePath() + "/var/log/tika.log", FileHandler tikaLogHandler = new FileHandler(PlatformUtil.getUserDirectory().getAbsolutePath() + "/var/log/tika.log", //NON-NLS
0, MAX_TIKA_LOG_FILES); 0, MAX_TIKA_LOG_FILES);
tikaLogHandler.setFormatter(new SimpleFormatter()); tikaLogHandler.setFormatter(new SimpleFormatter());
tikaLogHandler.setEncoding(PlatformUtil.getLogFileEncoding()); tikaLogHandler.setEncoding(PlatformUtil.getLogFileEncoding());
@ -104,7 +104,7 @@ public class KeywordSearch {
changeSupport.firePropertyChange(NUM_FILES_CHANGE_EVT, oldNum, newNum); changeSupport.firePropertyChange(NUM_FILES_CHANGE_EVT, oldNum, newNum);
} }
catch (Exception e) { catch (Exception e) {
logger.log(Level.SEVERE, "KeywordSearch listener threw exception", e); logger.log(Level.SEVERE, "KeywordSearch listener threw exception", e); //NON-NLS
MessageNotifyUtil.Notify.show(NbBundle.getMessage(KeywordSearch.class, "KeywordSearch.moduleErr"), MessageNotifyUtil.Notify.show(NbBundle.getMessage(KeywordSearch.class, "KeywordSearch.moduleErr"),
NbBundle.getMessage(KeywordSearch.class, NbBundle.getMessage(KeywordSearch.class,
"KeywordSearch.fireNumIdxFileChg.moduleErr.msg"), "KeywordSearch.fireNumIdxFileChg.moduleErr.msg"),
@ -133,7 +133,7 @@ public class KeywordSearch {
try { try {
server.openCore(); server.openCore();
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.WARNING, "Could not open core."); logger.log(Level.WARNING, "Could not open core."); //NON-NLS
} }
} else if (oldValue != null) { } else if (oldValue != null) {
// a case was closed // a case was closed
@ -142,7 +142,7 @@ public class KeywordSearch {
Thread.sleep(2000); Thread.sleep(2000);
server.closeCore(); server.closeCore();
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.WARNING, "Could not close core."); logger.log(Level.WARNING, "Could not close core."); //NON-NLS
} }
} }
} }

View File

@ -291,13 +291,13 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
listOptionsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.listOptionsLabel.text")); // NOI18N listOptionsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.listOptionsLabel.text")); // NOI18N
deleteListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/delete16.png"))); // NOI18N deleteListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/delete16.png"))); // NOI18N NON-NLS
deleteListButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.deleteListButton.text")); // NOI18N deleteListButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.deleteListButton.text")); // NOI18N
saveListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/save16.png"))); // NOI18N saveListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/save16.png"))); // NOI18N NON-NLS
saveListButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.saveListButton.text")); // NOI18N saveListButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.saveListButton.text")); // NOI18N
exportButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/export16.png"))); // NOI18N exportButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/export16.png"))); // NOI18N NON-NLS
exportButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.exportButton.text")); // NOI18N exportButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.exportButton.text")); // NOI18N
exportButton.addActionListener(new java.awt.event.ActionListener() { exportButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -442,7 +442,7 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
"KeywordSearchEditListPanel.exportButtonAction.featureName.text"); "KeywordSearchEditListPanel.exportButtonAction.featureName.text");
JFileChooser chooser = new JFileChooser(); JFileChooser chooser = new JFileChooser();
final String EXTENSION = "xml"; final String EXTENSION = "xml"; //NON-NLS
FileNameExtensionFilter filter = new FileNameExtensionFilter( FileNameExtensionFilter filter = new FileNameExtensionFilter(
NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.exportButtonActionPerformed.fileFilterLabel"), EXTENSION); NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.exportButtonActionPerformed.fileFilterLabel"), EXTENSION);
chooser.setFileFilter(filter); chooser.setFileFilter(filter);
@ -608,7 +608,7 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
ret = (Object) !word.isLiteral(); ret = (Object) !word.isLiteral();
break; break;
default: default:
logger.log(Level.SEVERE, "Invalid table column index: {0}", columnIndex); logger.log(Level.SEVERE, "Invalid table column index: {0}", columnIndex); //NON-NLS
break; break;
} }
return ret; return ret;

View File

@ -267,7 +267,7 @@ class KeywordSearchGlobalSearchSettingsPanel extends javax.swing.JPanel implemen
filesIndexedValue.setText(Integer.toString(KeywordSearch.getServer().queryNumIndexedFiles())); filesIndexedValue.setText(Integer.toString(KeywordSearch.getServer().queryNumIndexedFiles()));
chunksValLabel.setText(Integer.toString(KeywordSearch.getServer().queryNumIndexedChunks())); chunksValLabel.setText(Integer.toString(KeywordSearch.getServer().queryNumIndexedChunks()));
} catch (KeywordSearchModuleException | NoOpenCoreException ex) { } catch (KeywordSearchModuleException | NoOpenCoreException ex) {
logger.log(Level.WARNING, "Could not get number of indexed files/chunks"); logger.log(Level.WARNING, "Could not get number of indexed files/chunks"); //NON-NLS
} }
KeywordSearch.addNumIndexedFilesChangeListener( KeywordSearch.addNumIndexedFilesChangeListener(
@ -283,7 +283,7 @@ class KeywordSearchGlobalSearchSettingsPanel extends javax.swing.JPanel implemen
try { try {
chunksValLabel.setText(Integer.toString(KeywordSearch.getServer().queryNumIndexedChunks())); chunksValLabel.setText(Integer.toString(KeywordSearch.getServer().queryNumIndexedChunks()));
} catch (KeywordSearchModuleException | NoOpenCoreException ex) { } catch (KeywordSearchModuleException | NoOpenCoreException ex) {
logger.log(Level.WARNING, "Could not get number of indexed chunks"); logger.log(Level.WARNING, "Could not get number of indexed chunks"); //NON-NLS
} }
} }

View File

@ -123,7 +123,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
*/ */
@Override @Override
public void startUp(IngestJobContext context) throws IngestModuleException { public void startUp(IngestJobContext context) throws IngestModuleException {
logger.log(Level.INFO, "Initializing instance {0}", instanceNum); logger.log(Level.INFO, "Initializing instance {0}", instanceNum); //NON-NLS
initialized = false; initialized = false;
jobId = context.getJobId(); jobId = context.getJobId();
caseHandle = Case.getCurrentCase().getSleuthkitCase(); caseHandle = Case.getCurrentCase().getSleuthkitCase();
@ -143,7 +143,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
throw new IngestModuleException(msg); throw new IngestModuleException(msg);
} }
} 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); //NON-NLS
//this means Solr is not properly initialized //this means Solr is not properly initialized
String msg = NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.init.badInitMsg"); String msg = NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.init.badInitMsg");
String details = NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.init.tryStopSolrMsg", msg); String details = NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.init.tryStopSolrMsg", msg);
@ -185,7 +185,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
for (SCRIPT s : KeywordSearchSettings.getStringExtractScripts()) { for (SCRIPT s : KeywordSearchSettings.getStringExtractScripts()) {
sbScripts.append(s.name()).append(" "); sbScripts.append(s.name()).append(" ");
} }
logger.log(Level.INFO, "Using string extract scripts: {0}", sbScripts.toString()); logger.log(Level.INFO, "Using string extract scripts: {0}", sbScripts.toString()); //NON-NLS
textExtractors = new ArrayList<>(); textExtractors = new ArrayList<>();
//order matters, more specific extractors first //order matters, more specific extractors first
@ -200,7 +200,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
public ProcessResult process(AbstractFile abstractFile) { public ProcessResult process(AbstractFile abstractFile) {
if (initialized == false) //error initializing indexing/Solr if (initialized == false) //error initializing indexing/Solr
{ {
logger.log(Level.WARNING, "Skipping processing, module not initialized, file: {0}", abstractFile.getName()); logger.log(Level.WARNING, "Skipping processing, module not initialized, file: {0}", abstractFile.getName()); //NON-NLS
putIngestStatus(abstractFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING); putIngestStatus(abstractFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING);
return ProcessResult.OK; return ProcessResult.OK;
} }
@ -209,7 +209,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
dataSourceId = caseHandle.getFileDataSource(abstractFile); dataSourceId = caseHandle.getFileDataSource(abstractFile);
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Error getting image id of file processed by keyword search: " + abstractFile.getName(), ex); logger.log(Level.SEVERE, "Error getting image id of file processed by keyword search: " + abstractFile.getName(), ex); //NON-NLS
} }
if (abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.VIRTUAL_DIR)) { if (abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.VIRTUAL_DIR)) {
@ -242,14 +242,14 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
*/ */
@Override @Override
public void shutDown(boolean ingestJobCancelled) { public void shutDown(boolean ingestJobCancelled) {
logger.log(Level.INFO, "Instance {0}", instanceNum); logger.log(Level.INFO, "Instance {0}", instanceNum); //NON-NLS
if (initialized == false) { if (initialized == false) {
return; return;
} }
if (ingestJobCancelled) { if (ingestJobCancelled) {
logger.log(Level.INFO, "Ingest job cancelled"); logger.log(Level.INFO, "Ingest job cancelled"); //NON-NLS
stop(); stop();
return; return;
} }
@ -267,10 +267,10 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
try { try {
final int numIndexedFiles = KeywordSearch.getServer().queryNumIndexedFiles(); final int numIndexedFiles = KeywordSearch.getServer().queryNumIndexedFiles();
final int numIndexedChunks = KeywordSearch.getServer().queryNumIndexedChunks(); final int numIndexedChunks = KeywordSearch.getServer().queryNumIndexedChunks();
logger.log(Level.INFO, "Indexed files count: {0}", numIndexedFiles); logger.log(Level.INFO, "Indexed files count: {0}", numIndexedFiles); //NON-NLS
logger.log(Level.INFO, "Indexed file chunks count: {0}", numIndexedChunks); logger.log(Level.INFO, "Indexed file chunks count: {0}", numIndexedChunks); //NON-NLS
} catch (NoOpenCoreException | KeywordSearchModuleException ex) { } catch (NoOpenCoreException | KeywordSearchModuleException ex) {
logger.log(Level.WARNING, "Error executing Solr query to check number of indexed files/chunks: ", ex); logger.log(Level.WARNING, "Error executing Solr query to check number of indexed files/chunks: ", ex); //NON-NLS
} }
} }
@ -278,7 +278,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
* Handle stop event (ingest interrupted) Cleanup resources, threads, timers * Handle stop event (ingest interrupted) Cleanup resources, threads, timers
*/ */
private void stop() { private void stop() {
logger.log(Level.INFO, "stop()"); logger.log(Level.INFO, "stop()"); //NON-NLS
SearchRunner.getInstance().stopJob(jobId); SearchRunner.getInstance().stopJob(jobId);
@ -341,15 +341,15 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
} }
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
msg.append("<table border=0><tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.knowFileHeaderLbl")).append("</td><td>").append(text_ingested).append("</td></tr>"); msg.append("<table border=0><tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.knowFileHeaderLbl")).append("</td><td>").append(text_ingested).append("</td></tr>"); //NON-NLS
msg.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.fileGenStringsHead")).append("</td><td>").append(strings_ingested).append("</td></tr>"); msg.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.fileGenStringsHead")).append("</td><td>").append(strings_ingested).append("</td></tr>"); //NON-NLS
msg.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.mdOnlyLbl")).append("</td><td>").append(metadata_ingested).append("</td></tr>"); msg.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.mdOnlyLbl")).append("</td><td>").append(metadata_ingested).append("</td></tr>"); //NON-NLS
msg.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.idxErrLbl")).append("</td><td>").append(error_index).append("</td></tr>"); msg.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.idxErrLbl")).append("</td><td>").append(error_index).append("</td></tr>"); //NON-NLS
msg.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.errTxtLbl")).append("</td><td>").append(error_text).append("</td></tr>"); msg.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.errTxtLbl")).append("</td><td>").append(error_text).append("</td></tr>"); //NON-NLS
msg.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.errIoLbl")).append("</td><td>").append(error_io).append("</td></tr>"); msg.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.errIoLbl")).append("</td><td>").append(error_io).append("</td></tr>"); //NON-NLS
msg.append("</table>"); msg.append("</table>"); //NON-NLS
String indexStats = msg.toString(); String indexStats = msg.toString();
logger.log(Level.INFO, "Keyword Indexing Completed: {0}", indexStats); logger.log(Level.INFO, "Keyword Indexing Completed: {0}", indexStats); //NON-NLS
services.postMessage(IngestMessage.createMessage(MessageType.INFO, KeywordSearchModuleFactory.getModuleName(), NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.kwIdxResultsLbl"), indexStats)); services.postMessage(IngestMessage.createMessage(MessageType.INFO, KeywordSearchModuleFactory.getModuleName(), NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.kwIdxResultsLbl"), indexStats));
if (error_index > 0) { if (error_index > 0) {
MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.kwIdxErrsTitle"), MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.kwIdxErrsTitle"),
@ -391,7 +391,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
} }
if (fileExtract == null) { if (fileExtract == null) {
logger.log(Level.INFO, "No text extractor found for file id:{0}, name: {1}, detected format: {2}", new Object[]{aFile.getId(), aFile.getName(), detectedFormat}); logger.log(Level.INFO, "No text extractor found for file id:{0}, name: {1}, detected format: {2}", new Object[]{aFile.getId(), aFile.getName(), detectedFormat}); //NON-NLS
return false; return false;
} }
@ -414,12 +414,12 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
putIngestStatus(aFile.getId(), IngestStatus.STRINGS_INGESTED); putIngestStatus(aFile.getId(), IngestStatus.STRINGS_INGESTED);
return true; return true;
} else { } else {
logger.log(Level.WARNING, "Failed to extract strings and ingest, file ''{0}'' (id: {1}).", new Object[]{aFile.getName(), aFile.getId()}); logger.log(Level.WARNING, "Failed to extract strings and ingest, file ''{0}'' (id: {1}).", new Object[]{aFile.getName(), aFile.getId()}); //NON-NLS
putIngestStatus(aFile.getId(), IngestStatus.SKIPPED_ERROR_TEXTEXTRACT); putIngestStatus(aFile.getId(), IngestStatus.SKIPPED_ERROR_TEXTEXTRACT);
return false; return false;
} }
} catch (IngesterException ex) { } catch (IngesterException ex) {
logger.log(Level.WARNING, "Failed to extract strings and ingest, file '" + aFile.getName() + "' (id: " + aFile.getId() + ").", ex); logger.log(Level.WARNING, "Failed to extract strings and ingest, file '" + aFile.getName() + "' (id: " + aFile.getId() + ").", ex); //NON-NLS
putIngestStatus(aFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING); putIngestStatus(aFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING);
return false; return false;
} }
@ -469,7 +469,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
putIngestStatus(aFile.getId(), IngestStatus.METADATA_INGESTED); putIngestStatus(aFile.getId(), IngestStatus.METADATA_INGESTED);
} catch (IngesterException ex) { } catch (IngesterException ex) {
putIngestStatus(aFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING); putIngestStatus(aFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING);
logger.log(Level.WARNING, "Unable to index meta-data for file: " + aFile.getId(), ex); logger.log(Level.WARNING, "Unable to index meta-data for file: " + aFile.getId(), ex); //NON-NLS
} }
return; return;
} }
@ -481,13 +481,13 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
is = new ReadContentInputStream(aFile); is = new ReadContentInputStream(aFile);
detectedFormat = tikaFormatDetector.detect(is, aFile.getName()); detectedFormat = tikaFormatDetector.detect(is, aFile.getName());
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.WARNING, "Could not detect format using tika for file: " + aFile, e); logger.log(Level.WARNING, "Could not detect format using tika for file: " + aFile, e); //NON-NLS
} finally { } finally {
if (is != null) { if (is != null) {
try { try {
is.close(); is.close();
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Could not close stream after detecting format using tika for file: " logger.log(Level.WARNING, "Could not close stream after detecting format using tika for file: " //NON-NLS
+ aFile, ex); + aFile, ex);
} }
} }
@ -505,7 +505,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
putIngestStatus(aFile.getId(), IngestStatus.METADATA_INGESTED); putIngestStatus(aFile.getId(), IngestStatus.METADATA_INGESTED);
} catch (IngesterException ex) { } catch (IngesterException ex) {
putIngestStatus(aFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING); putIngestStatus(aFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING);
logger.log(Level.WARNING, "Unable to index meta-data for file: " + aFile.getId(), ex); logger.log(Level.WARNING, "Unable to index meta-data for file: " + aFile.getId(), ex); //NON-NLS
} }
return; return;
} }
@ -516,7 +516,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
try { try {
//logger.log(Level.INFO, "indexing: " + aFile.getName()); //logger.log(Level.INFO, "indexing: " + aFile.getName());
if (!extractTextAndIndex(aFile, detectedFormat)) { if (!extractTextAndIndex(aFile, detectedFormat)) {
logger.log(Level.WARNING, "Failed to extract text and ingest, file ''{0}'' (id: {1}).", new Object[]{aFile.getName(), aFile.getId()}); logger.log(Level.WARNING, "Failed to extract text and ingest, file ''{0}'' (id: {1}).", new Object[]{aFile.getName(), aFile.getId()}); //NON-NLS
putIngestStatus(aFile.getId(), IngestStatus.SKIPPED_ERROR_TEXTEXTRACT); putIngestStatus(aFile.getId(), IngestStatus.SKIPPED_ERROR_TEXTEXTRACT);
} else { } else {
putIngestStatus(aFile.getId(), IngestStatus.TEXT_INGESTED); putIngestStatus(aFile.getId(), IngestStatus.TEXT_INGESTED);
@ -524,11 +524,11 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
} }
} catch (IngesterException e) { } catch (IngesterException e) {
logger.log(Level.INFO, "Could not extract text with Tika, " + aFile.getId() + ", " logger.log(Level.INFO, "Could not extract text with Tika, " + aFile.getId() + ", " //NON-NLS
+ aFile.getName(), e); + aFile.getName(), e);
putIngestStatus(aFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING); putIngestStatus(aFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING);
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.WARNING, "Error extracting text with Tika, " + aFile.getId() + ", " logger.log(Level.WARNING, "Error extracting text with Tika, " + aFile.getId() + ", " //NON-NLS
+ aFile.getName(), e); + aFile.getName(), e);
putIngestStatus(aFile.getId(), IngestStatus.SKIPPED_ERROR_TEXTEXTRACT); putIngestStatus(aFile.getId(), IngestStatus.SKIPPED_ERROR_TEXTEXTRACT);
} }

View File

@ -86,14 +86,14 @@ public final class KeywordSearchJobSettingsPanel extends IngestModuleIngestJobSe
private void displayLanguages() { private void displayLanguages() {
List<SCRIPT> scripts = KeywordSearchSettings.getStringExtractScripts(); List<SCRIPT> scripts = KeywordSearchSettings.getStringExtractScripts();
StringBuilder langs = new StringBuilder(); StringBuilder langs = new StringBuilder();
langs.append("<html>"); langs.append("<html>"); //NON-NLS
for (int i = 0; i < scripts.size(); i++) { for (int i = 0; i < scripts.size(); i++) {
langs.append(scripts.get(i).toString()); langs.append(scripts.get(i).toString());
if (i + 1 < scripts.size()) { if (i + 1 < scripts.size()) {
langs.append(", "); langs.append(", ");
} }
} }
langs.append("</html>"); langs.append("</html>"); //NON-NLS
String langsS = langs.toString(); String langsS = langs.toString();
this.languagesValLabel.setText(langsS); this.languagesValLabel.setText(langsS);
this.languagesValLabel.setToolTipText(langsS); this.languagesValLabel.setToolTipText(langsS);
@ -107,7 +107,7 @@ public final class KeywordSearchJobSettingsPanel extends IngestModuleIngestJobSe
encodingsList.add("UTF8"); encodingsList.add("UTF8");
} }
if (utf16 == null || Boolean.parseBoolean(utf16)) { if (utf16 == null || Boolean.parseBoolean(utf16)) {
encodingsList.add("UTF16"); encodingsList.add("UTF16"); //NON-NLS
} }
String encodings = encodingsList.toString(); String encodings = encodingsList.toString();
encodings = encodings.substring(1, encodings.length() - 1); encodings = encodings.substring(1, encodings.length() - 1);

View File

@ -69,7 +69,7 @@ abstract class KeywordSearchListsAbstract {
try { try {
changeSupport.firePropertyChange(event.toString(), null, null); changeSupport.firePropertyChange(event.toString(), null, null);
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.SEVERE, "KeywordSearchListsAbstract listener threw exception", e); logger.log(Level.SEVERE, "KeywordSearchListsAbstract listener threw exception", e); //NON-NLS
} }
} }
@ -87,40 +87,40 @@ abstract class KeywordSearchListsAbstract {
} }
//phone number //phone number
List<Keyword> phones = new ArrayList<>(); List<Keyword> phones = new ArrayList<>();
phones.add(new Keyword("[(]{0,1}\\d\\d\\d[)]{0,1}[\\.-]\\d\\d\\d[\\.-]\\d\\d\\d\\d", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER)); phones.add(new Keyword("[(]{0,1}\\d\\d\\d[)]{0,1}[\\.-]\\d\\d\\d[\\.-]\\d\\d\\d\\d", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER)); //NON-NLS
//phones.add(new Keyword("\\d{8,10}", false)); //phones.add(new Keyword("\\d{8,10}", false));
//IP address //IP address
List<Keyword> ips = new ArrayList<>(); List<Keyword> ips = new ArrayList<>();
ips.add(new Keyword("(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_IP_ADDRESS)); ips.add(new Keyword("(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_IP_ADDRESS));
//email //email
List<Keyword> emails = new ArrayList<>(); List<Keyword> emails = new ArrayList<>();
emails.add(new Keyword("(?=.{8})[a-z0-9%+_-]+(?:\\.[a-z0-9%+_-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,4}(?<!\\.txt|\\.exe|\\.dll|\\.jpg|\\.xml)", emails.add(new Keyword("(?=.{8})[a-z0-9%+_-]+(?:\\.[a-z0-9%+_-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,4}(?<!\\.txt|\\.exe|\\.dll|\\.jpg|\\.xml)", //NON-NLS
false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL)); false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL));
//emails.add(new Keyword("[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}", //emails.add(new Keyword("[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}",
// false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL)); // false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL));
//URL //URL
List<Keyword> urls = new ArrayList<>(); List<Keyword> urls = new ArrayList<>();
//urls.add(new Keyword("http://|https://|^www\\.", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL)); //urls.add(new Keyword("http://|https://|^www\\.", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL));
urls.add(new Keyword("((((ht|f)tp(s?))\\://)|www\\.)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,5})(\\:[0-9]+)*(/($|[a-zA-Z0-9\\.\\,\\;\\?\\'\\\\+&amp;%\\$#\\=~_\\-]+))*", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL)); urls.add(new Keyword("((((ht|f)tp(s?))\\://)|www\\.)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,5})(\\:[0-9]+)*(/($|[a-zA-Z0-9\\.\\,\\;\\?\\'\\\\+&amp;%\\$#\\=~_\\-]+))*", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL)); //NON-NLS
//urls.add(new Keyword("ssh://", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL)); //urls.add(new Keyword("ssh://", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL));
//disable messages for harcoded/locked lists //disable messages for harcoded/locked lists
String name; String name;
name = "Phone Numbers"; name = "Phone Numbers"; //NON-NLS
lockedLists.add(name); lockedLists.add(name);
addList(name, phones, false, false, true); addList(name, phones, false, false, true);
name = "IP Addresses"; name = "IP Addresses"; //NON-NLS
lockedLists.add(name); lockedLists.add(name);
addList(name, ips, false, false, true); addList(name, ips, false, false, true);
name = "Email Addresses"; name = "Email Addresses"; //NON-NLS
lockedLists.add(name); lockedLists.add(name);
addList(name, emails, true, false, true); addList(name, emails, true, false, true);
name = "URLs"; name = "URLs"; //NON-NLS
lockedLists.add(name); lockedLists.add(name);
addList(name, urls, false, false, true); addList(name, urls, false, false, true);
} }
@ -287,7 +287,7 @@ abstract class KeywordSearchListsAbstract {
try { try {
changeSupport.firePropertyChange(ListsEvt.LIST_ADDED.toString(), null, name); changeSupport.firePropertyChange(ListsEvt.LIST_ADDED.toString(), null, name);
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.SEVERE, "KeywordSearchListsAbstract listener threw exception", e); logger.log(Level.SEVERE, "KeywordSearchListsAbstract listener threw exception", e); //NON-NLS
MessageNotifyUtil.Notify.show( MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.moduleErr"), NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.moduleErr"),
NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.addList.errMsg1.msg"), NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.addList.errMsg1.msg"),
@ -300,7 +300,7 @@ abstract class KeywordSearchListsAbstract {
try { try {
changeSupport.firePropertyChange(ListsEvt.LIST_UPDATED.toString(), null, name); changeSupport.firePropertyChange(ListsEvt.LIST_UPDATED.toString(), null, name);
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.SEVERE, "KeywordSearchListsAbstract listener threw exception", e); logger.log(Level.SEVERE, "KeywordSearchListsAbstract listener threw exception", e); //NON-NLS
MessageNotifyUtil.Notify.show( MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.moduleErr"), NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.moduleErr"),
NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.addList.errMsg2.msg"), NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.addList.errMsg2.msg"),
@ -349,7 +349,7 @@ abstract class KeywordSearchListsAbstract {
try { try {
changeSupport.firePropertyChange(ListsEvt.LIST_ADDED.toString(), null, list.getName()); changeSupport.firePropertyChange(ListsEvt.LIST_ADDED.toString(), null, list.getName());
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.SEVERE, "KeywordSearchListsAbstract listener threw exception", e); logger.log(Level.SEVERE, "KeywordSearchListsAbstract listener threw exception", e); //NON-NLS
MessageNotifyUtil.Notify.show( MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.moduleErr"), NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.moduleErr"),
NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.saveList.errMsg1.msg"), NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.saveList.errMsg1.msg"),
@ -360,7 +360,7 @@ abstract class KeywordSearchListsAbstract {
try { try {
changeSupport.firePropertyChange(ListsEvt.LIST_UPDATED.toString(), null, over.getName()); changeSupport.firePropertyChange(ListsEvt.LIST_UPDATED.toString(), null, over.getName());
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.SEVERE, "KeywordSearchListsAbstract listener threw exception", e); logger.log(Level.SEVERE, "KeywordSearchListsAbstract listener threw exception", e); //NON-NLS
MessageNotifyUtil.Notify.show( MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.moduleErr"), NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.moduleErr"),
NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.saveList.errMsg2.msg"), NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.saveList.errMsg2.msg"),
@ -395,7 +395,7 @@ abstract class KeywordSearchListsAbstract {
try { try {
changeSupport.firePropertyChange(ListsEvt.LIST_ADDED.toString(), null, list.getName()); changeSupport.firePropertyChange(ListsEvt.LIST_ADDED.toString(), null, list.getName());
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.SEVERE, "KeywordSearchListsAbstract listener threw exception", e); logger.log(Level.SEVERE, "KeywordSearchListsAbstract listener threw exception", e); //NON-NLS
MessageNotifyUtil.Notify.show( MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.moduleErr"), NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.moduleErr"),
NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.writeLists.errMsg1.msg"), NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.writeLists.errMsg1.msg"),
@ -408,7 +408,7 @@ abstract class KeywordSearchListsAbstract {
try { try {
changeSupport.firePropertyChange(ListsEvt.LIST_UPDATED.toString(), null, over.getName()); changeSupport.firePropertyChange(ListsEvt.LIST_UPDATED.toString(), null, over.getName());
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.SEVERE, "KeywordSearchListsAbstract listener threw exception", e); logger.log(Level.SEVERE, "KeywordSearchListsAbstract listener threw exception", e); //NON-NLS
MessageNotifyUtil.Notify.show( MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.moduleErr"), NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.moduleErr"),
NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.writeLists.errMsg2.msg"), NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.writeLists.errMsg2.msg"),
@ -434,7 +434,7 @@ abstract class KeywordSearchListsAbstract {
try { try {
changeSupport.firePropertyChange(ListsEvt.LIST_DELETED.toString(), null, name); changeSupport.firePropertyChange(ListsEvt.LIST_DELETED.toString(), null, name);
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.SEVERE, "KeywordSearchListsAbstract listener threw exception", e); logger.log(Level.SEVERE, "KeywordSearchListsAbstract listener threw exception", e); //NON-NLS
MessageNotifyUtil.Notify.show( MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.moduleErr"), NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.moduleErr"),
NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.deleteList.errMsg1.msg"), NbBundle.getMessage(this.getClass(), "KeywordSearchListsAbstract.deleteList.errMsg1.msg"),

View File

@ -130,7 +130,7 @@ class KeywordSearchListsEncase extends KeywordSearchListsAbstract{
@Override @Override
public boolean load() { public boolean load() {
try { try {
BufferedReader readBuffer = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), "utf-16")); BufferedReader readBuffer = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), "utf-16")); //NON-NLS
String structLine; String structLine;
String metaLine; String metaLine;
entriesUnsorted = new ArrayList<>(); entriesUnsorted = new ArrayList<>();
@ -161,9 +161,9 @@ class KeywordSearchListsEncase extends KeywordSearchListsAbstract{
return true; return true;
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
logger.log(Level.INFO, "File at " + filePath + " does not exist!", ex); logger.log(Level.INFO, "File at " + filePath + " does not exist!", ex); //NON-NLS
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.INFO, "Failed to read file at " + filePath, ex); logger.log(Level.INFO, "Failed to read file at " + filePath, ex); //NON-NLS
} }
return false; return false;
} }

View File

@ -113,7 +113,7 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel implements Op
}); });
jScrollPane1.setViewportView(listsTable); jScrollPane1.setViewportView(listsTable);
newListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/new16.png"))); // NOI18N newListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/new16.png"))); // NOI18N NON-NLS
newListButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsManagementPanel.class, "KeywordSearchListsManagementPanel.newListButton.text")); // NOI18N newListButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsManagementPanel.class, "KeywordSearchListsManagementPanel.newListButton.text")); // NOI18N
newListButton.addActionListener(new java.awt.event.ActionListener() { newListButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -121,7 +121,7 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel implements Op
} }
}); });
importButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/import16.png"))); // NOI18N importButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/import16.png"))); // NOI18N NON-NLS
importButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsManagementPanel.class, "KeywordSearchListsManagementPanel.importButton.text")); // NOI18N importButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsManagementPanel.class, "KeywordSearchListsManagementPanel.importButton.text")); // NOI18N
importButton.addActionListener(new java.awt.event.ActionListener() { importButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -208,7 +208,7 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel implements Op
private void importButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importButtonActionPerformed private void importButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importButtonActionPerformed
JFileChooser chooser = new JFileChooser(); JFileChooser chooser = new JFileChooser();
final String[] EXTENSION = new String[]{"xml", "txt"}; final String[] EXTENSION = new String[]{"xml", "txt"}; //NON-NLS
FileNameExtensionFilter filter = new FileNameExtensionFilter( FileNameExtensionFilter filter = new FileNameExtensionFilter(
NbBundle.getMessage(this.getClass(), "KeywordSearchListsManagementPanel.fileExtensionFilterLbl"), EXTENSION); NbBundle.getMessage(this.getClass(), "KeywordSearchListsManagementPanel.fileExtensionFilterLbl"), EXTENSION);
chooser.setFileFilter(filter); chooser.setFileFilter(filter);

View File

@ -141,7 +141,7 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (ingestRunning) { if (ingestRunning) {
SearchRunner.getInstance().addKeywordListsToAllJobs(listsTableModel.getSelectedLists()); SearchRunner.getInstance().addKeywordListsToAllJobs(listsTableModel.getSelectedLists());
logger.log(Level.INFO, "Submitted enqueued lists to ingest"); logger.log(Level.INFO, "Submitted enqueued lists to ingest"); //NON-NLS
} else { } else {
searchAction(e); searchAction(e);
} }
@ -233,7 +233,7 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer {
searchAddButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class, "KeywordSearchListsViewerPanel.searchAddButton.text")); // NOI18N searchAddButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class, "KeywordSearchListsViewerPanel.searchAddButton.text")); // NOI18N
ingestIndexLabel.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N ingestIndexLabel.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N NON-NLS
ingestIndexLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class, "KeywordSearchListsViewerPanel.ingestIndexLabel.text")); // NOI18N ingestIndexLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class, "KeywordSearchListsViewerPanel.ingestIndexLabel.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);

View File

@ -44,21 +44,21 @@ import org.w3c.dom.NodeList;
final class KeywordSearchListsXML extends KeywordSearchListsAbstract { final class KeywordSearchListsXML extends KeywordSearchListsAbstract {
private static final Logger xmlListslogger = Logger.getLogger(KeywordSearchListsXML.class.getName()); private static final Logger xmlListslogger = Logger.getLogger(KeywordSearchListsXML.class.getName());
private static final String CUR_LISTS_FILE_NAME = "keywords.xml"; private static final String CUR_LISTS_FILE_NAME = "keywords.xml"; //NON-NLS
private static String CUR_LISTS_FILE = PlatformUtil.getUserConfigDirectory() + File.separator + CUR_LISTS_FILE_NAME; private static String CUR_LISTS_FILE = PlatformUtil.getUserConfigDirectory() + File.separator + CUR_LISTS_FILE_NAME;
private static final String XSDFILE = "KeywordsSchema.xsd"; private static final String XSDFILE = "KeywordsSchema.xsd"; //NON-NLS
private static final String ROOT_EL = "keyword_lists"; private static final String ROOT_EL = "keyword_lists"; //NON-NLS
private static final String LIST_EL = "keyword_list"; private static final String LIST_EL = "keyword_list"; //NON-NLS
private static final String LIST_NAME_ATTR = "name"; private static final String LIST_NAME_ATTR = "name"; //NON-NLS
private static final String LIST_CREATE_ATTR = "created"; private static final String LIST_CREATE_ATTR = "created"; //NON-NLS
private static final String LIST_MOD_ATTR = "modified"; private static final String LIST_MOD_ATTR = "modified"; //NON-NLS
private static final String LIST_USE_FOR_INGEST = "use_for_ingest"; private static final String LIST_USE_FOR_INGEST = "use_for_ingest"; //NON-NLS
private static final String LIST_INGEST_MSGS = "ingest_messages"; private static final String LIST_INGEST_MSGS = "ingest_messages"; //NON-NLS
private static final String KEYWORD_EL = "keyword"; private static final String KEYWORD_EL = "keyword"; //NON-NLS
private static final String KEYWORD_LITERAL_ATTR = "literal"; private static final String KEYWORD_LITERAL_ATTR = "literal"; //NON-NLS
private static final String KEYWORD_SELECTOR_ATTR = "selector"; private static final String KEYWORD_SELECTOR_ATTR = "selector"; //NON-NLS
private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; //NON-NLS
private static final String ENCODING = "UTF-8"; private static final String ENCODING = "UTF-8"; //NON-NLS
private static KeywordSearchListsXML currentInstance = null; private static KeywordSearchListsXML currentInstance = null;
private DateFormat dateFormatter; private DateFormat dateFormatter;
@ -127,7 +127,7 @@ final class KeywordSearchListsXML extends KeywordSearchListsAbstract {
for (Keyword keyword : keywords) { for (Keyword keyword : keywords) {
Element keywordEl = doc.createElement(KEYWORD_EL); Element keywordEl = doc.createElement(KEYWORD_EL);
String literal = keyword.isLiteral()?"true":"false"; String literal = keyword.isLiteral()?"true":"false"; //NON-NLS
keywordEl.setAttribute(KEYWORD_LITERAL_ATTR, literal); keywordEl.setAttribute(KEYWORD_LITERAL_ATTR, literal);
BlackboardAttribute.ATTRIBUTE_TYPE selectorType = keyword.getType(); BlackboardAttribute.ATTRIBUTE_TYPE selectorType = keyword.getType();
if (selectorType != null) { if (selectorType != null) {
@ -141,7 +141,7 @@ final class KeywordSearchListsXML extends KeywordSearchListsAbstract {
success = XMLUtil.saveDoc(KeywordSearchListsXML.class, filePath, ENCODING, doc); success = XMLUtil.saveDoc(KeywordSearchListsXML.class, filePath, ENCODING, doc);
} catch (ParserConfigurationException e) { } catch (ParserConfigurationException e) {
xmlListslogger.log(Level.SEVERE, "Error saving keyword list: can't initialize parser.", e); xmlListslogger.log(Level.SEVERE, "Error saving keyword list: can't initialize parser.", e); //NON-NLS
} }
return success; return success;
} }
@ -158,7 +158,7 @@ final class KeywordSearchListsXML extends KeywordSearchListsAbstract {
Element root = doc.getDocumentElement(); Element root = doc.getDocumentElement();
if (root == null) { if (root == null) {
xmlListslogger.log(Level.SEVERE, "Error loading keyword list: invalid file format."); xmlListslogger.log(Level.SEVERE, "Error loading keyword list: invalid file format."); //NON-NLS
return false; return false;
} }
try { try {
@ -200,7 +200,7 @@ final class KeywordSearchListsXML extends KeywordSearchListsAbstract {
for (int j = 0; j < numKeywords; ++j) { for (int j = 0; j < numKeywords; ++j) {
Element wordEl = (Element) wordsNList.item(j); Element wordEl = (Element) wordsNList.item(j);
String literal = wordEl.getAttribute(KEYWORD_LITERAL_ATTR); String literal = wordEl.getAttribute(KEYWORD_LITERAL_ATTR);
boolean isLiteral = literal.equals("true"); boolean isLiteral = literal.equals("true"); //NON-NLS
Keyword keyword = new Keyword(wordEl.getTextContent(), isLiteral); Keyword keyword = new Keyword(wordEl.getTextContent(), isLiteral);
String selector = wordEl.getAttribute(KEYWORD_SELECTOR_ATTR); String selector = wordEl.getAttribute(KEYWORD_SELECTOR_ATTR);
if (! selector.equals("")) { if (! selector.equals("")) {
@ -214,7 +214,7 @@ final class KeywordSearchListsXML extends KeywordSearchListsAbstract {
} }
} catch (ParseException e) { } catch (ParseException e) {
//error parsing dates //error parsing dates
xmlListslogger.log(Level.SEVERE, "Error loading keyword list: can't parse dates.", e); xmlListslogger.log(Level.SEVERE, "Error loading keyword list: can't parse dates.", e); //NON-NLS
return false; return false;
} }
return true; return true;

View File

@ -39,7 +39,7 @@ import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSetttingsPanel;
@ServiceProvider(service = IngestModuleFactory.class) @ServiceProvider(service = IngestModuleFactory.class)
public class KeywordSearchModuleFactory extends IngestModuleFactoryAdapter { public class KeywordSearchModuleFactory extends IngestModuleFactoryAdapter {
private static final HashSet<String> defaultDisabledKeywordListNames = new HashSet<>(Arrays.asList("Phone Numbers", "IP Addresses", "URLs")); private static final HashSet<String> defaultDisabledKeywordListNames = new HashSet<>(Arrays.asList("Phone Numbers", "IP Addresses", "URLs")); //NON-NLS
private KeywordSearchJobSettingsPanel jobSettingsPanel = null; private KeywordSearchJobSettingsPanel jobSettingsPanel = null;
@Override @Override

View File

@ -103,7 +103,7 @@ public final class KeywordSearchOptionsPanelController extends OptionsPanelContr
try { try {
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true); pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.SEVERE, "KeywordSearchOptionsPanelController listener threw exception", e); logger.log(Level.SEVERE, "KeywordSearchOptionsPanelController listener threw exception", e); //NON-NLS
MessageNotifyUtil.Notify.show( MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "KeywordSearchOptionsPanelController.moduleErr"), NbBundle.getMessage(this.getClass(), "KeywordSearchOptionsPanelController.moduleErr"),
NbBundle.getMessage(this.getClass(), "KeywordSearchOptionsPanelController.moduleErr.msg1"), NbBundle.getMessage(this.getClass(), "KeywordSearchOptionsPanelController.moduleErr.msg1"),
@ -113,7 +113,7 @@ public final class KeywordSearchOptionsPanelController extends OptionsPanelContr
try { try {
pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null); pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.SEVERE, "KeywordSearchOptionsPanelController listener threw exception", e); logger.log(Level.SEVERE, "KeywordSearchOptionsPanelController listener threw exception", e); //NON-NLS
MessageNotifyUtil.Notify.show( MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "KeywordSearchOptionsPanelController.moduleErr"), NbBundle.getMessage(this.getClass(), "KeywordSearchOptionsPanelController.moduleErr"),
NbBundle.getMessage(this.getClass(), "KeywordSearchOptionsPanelController.moduleErr.msg2"), NbBundle.getMessage(this.getClass(), "KeywordSearchOptionsPanelController.moduleErr.msg2"),

View File

@ -143,13 +143,13 @@ class KeywordSearchPanel extends javax.swing.JPanel {
setOpaque(false); setOpaque(false);
listsButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon.png"))); // NOI18N listsButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon.png"))); // NOI18N NON-NLS
listsButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "ListBundleName")); // NOI18N listsButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "ListBundleName")); // NOI18N
listsButton.setBorderPainted(false); listsButton.setBorderPainted(false);
listsButton.setContentAreaFilled(false); listsButton.setContentAreaFilled(false);
listsButton.setEnabled(false); listsButton.setEnabled(false);
listsButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon-rollover.png"))); // NOI18N listsButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon-rollover.png"))); // NOI18N NON-NLS
listsButton.setRolloverSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon-pressed.png"))); // NOI18N listsButton.setRolloverSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon-pressed.png"))); // NOI18N NON-NLS
listsButton.addMouseListener(new java.awt.event.MouseAdapter() { listsButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) { public void mousePressed(java.awt.event.MouseEvent evt) {
listsButtonMousePressed(evt); listsButtonMousePressed(evt);
@ -161,7 +161,7 @@ class KeywordSearchPanel extends javax.swing.JPanel {
} }
}); });
searchDropButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon.png"))); // NOI18N searchDropButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon.png"))); // NOI18N NON-NLS
searchDropButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.searchDropButton.text")); // NOI18N searchDropButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.searchDropButton.text")); // NOI18N
searchDropButton.setBorderPainted(false); searchDropButton.setBorderPainted(false);
searchDropButton.setContentAreaFilled(false); searchDropButton.setContentAreaFilled(false);
@ -169,8 +169,8 @@ class KeywordSearchPanel extends javax.swing.JPanel {
searchDropButton.setMaximumSize(new java.awt.Dimension(146, 27)); searchDropButton.setMaximumSize(new java.awt.Dimension(146, 27));
searchDropButton.setMinimumSize(new java.awt.Dimension(146, 27)); searchDropButton.setMinimumSize(new java.awt.Dimension(146, 27));
searchDropButton.setPreferredSize(new java.awt.Dimension(146, 27)); searchDropButton.setPreferredSize(new java.awt.Dimension(146, 27));
searchDropButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon-rollover.png"))); // NOI18N searchDropButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon-rollover.png"))); // NOI18N NON-NLS
searchDropButton.setRolloverSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon-pressed.png"))); // NOI18N searchDropButton.setRolloverSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon-pressed.png"))); // NOI18N NON-NLS
searchDropButton.addMouseListener(new java.awt.event.MouseAdapter() { searchDropButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) { public void mousePressed(java.awt.event.MouseEvent evt) {
searchDropButtonMousePressed(evt); searchDropButtonMousePressed(evt);
@ -247,10 +247,10 @@ class KeywordSearchPanel extends javax.swing.JPanel {
//setFilesIndexed(numIndexedFiles); //setFilesIndexed(numIndexedFiles);
} }
catch (NoOpenCoreException ex) { catch (NoOpenCoreException ex) {
logger.log(Level.SEVERE, "Error executing Solr query, " + ex); logger.log(Level.SEVERE, "Error executing Solr query, " + ex); //NON-NLS
} }
catch (KeywordSearchModuleException se) { catch (KeywordSearchModuleException se) {
logger.log(Level.SEVERE, "Error executing Solr query, " + se.getMessage()); logger.log(Level.SEVERE, "Error executing Solr query, " + se.getMessage()); //NON-NLS
} }
break; break;
case STOPPED: case STOPPED:

View File

@ -192,7 +192,7 @@ class KeywordSearchQueryManager {
boolean allValid = true; boolean allValid = true;
for (KeywordSearchQuery tcq : queryDelegates) { for (KeywordSearchQuery tcq : queryDelegates) {
if (!tcq.validate()) { if (!tcq.validate()) {
logger.log(Level.WARNING, "Query has invalid syntax: {0}", tcq.getQueryString()); logger.log(Level.WARNING, "Query has invalid syntax: {0}", tcq.getQueryString()); //NON-NLS
allValid = false; allValid = false;
break; break;
} }

View File

@ -247,7 +247,7 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
try { try {
tcqRes = tcq.performQuery(); tcqRes = tcq.performQuery();
} catch (NoOpenCoreException ex) { } catch (NoOpenCoreException ex) {
logger.log(Level.WARNING, "Could not perform the query. ", ex); logger.log(Level.WARNING, "Could not perform the query. ", ex); //NON-NLS
return false; return false;
} }
@ -425,7 +425,7 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
try { try {
matchesRes = filesQuery.performQuery(); matchesRes = filesQuery.performQuery();
} catch (NoOpenCoreException ex) { } catch (NoOpenCoreException ex) {
logger.log(Level.WARNING, "Could not perform the query. ", ex); logger.log(Level.WARNING, "Could not perform the query. ", ex); //NON-NLS
return false; return false;
} }
@ -580,11 +580,11 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
try { try {
snippet = LuceneQuery.querySnippet(snippetQuery, f.getId(), chunkId, !query.isLiteral(), true); snippet = LuceneQuery.querySnippet(snippetQuery, f.getId(), chunkId, !query.isLiteral(), true);
} catch (NoOpenCoreException e) { } catch (NoOpenCoreException e) {
logger.log(Level.WARNING, "Error querying snippet: " + snippetQuery, e); logger.log(Level.WARNING, "Error querying snippet: " + snippetQuery, e); //NON-NLS
//no reason to continie //no reason to continie
return null; return null;
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.WARNING, "Error querying snippet: " + snippetQuery, e); logger.log(Level.WARNING, "Error querying snippet: " + snippetQuery, e); //NON-NLS
continue; continue;
} }
if (snippet != null) { if (snippet != null) {
@ -608,7 +608,7 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
// test if any exceptions were thrown // test if any exceptions were thrown
get(); get();
} catch (InterruptedException | ExecutionException ex) { } catch (InterruptedException | ExecutionException ex) {
logger.log(Level.SEVERE, "Error querying ", ex); logger.log(Level.SEVERE, "Error querying ", ex); //NON-NLS
} }
// catch and ignore if we were cancelled // catch and ignore if we were cancelled
catch (java.util.concurrent.CancellationException ex ) { } catch (java.util.concurrent.CancellationException ex ) { }

View File

@ -38,7 +38,7 @@ class KeywordSearchSettings {
static final String PROPERTIES_OPTIONS = NbBundle.getMessage(KeywordSearchSettings.class, "KeywordSearchSettings.properties_options.text", MODULE_NAME); static final String PROPERTIES_OPTIONS = NbBundle.getMessage(KeywordSearchSettings.class, "KeywordSearchSettings.properties_options.text", MODULE_NAME);
static final String PROPERTIES_NSRL = NbBundle.getMessage(KeywordSearchSettings.class, "KeywordSearchSettings.propertiesNSRL.text", MODULE_NAME); static final String PROPERTIES_NSRL = NbBundle.getMessage(KeywordSearchSettings.class, "KeywordSearchSettings.propertiesNSRL.text", MODULE_NAME);
static final String PROPERTIES_SCRIPTS = NbBundle.getMessage(KeywordSearchSettings.class, "KeywordSearchSettings.propertiesScripts.text", MODULE_NAME); static final String PROPERTIES_SCRIPTS = NbBundle.getMessage(KeywordSearchSettings.class, "KeywordSearchSettings.propertiesScripts.text", MODULE_NAME);
static final String SHOW_SNIPPETS = "showSnippets"; static final String SHOW_SNIPPETS = "showSnippets"; //NON-NLS
static final boolean DEFAULT_SHOW_SNIPPETS = true; static final boolean DEFAULT_SHOW_SNIPPETS = true;
private static boolean skipKnown = true; private static boolean skipKnown = true;
private static final Logger logger = Logger.getLogger(KeywordSearchSettings.class.getName()); private static final Logger logger = Logger.getLogger(KeywordSearchSettings.class.getName());
@ -52,11 +52,11 @@ class KeywordSearchSettings {
* @return KeywordSearchIngestModule's update frequency * @return KeywordSearchIngestModule's update frequency
*/ */
static UpdateFrequency getUpdateFrequency() { static UpdateFrequency getUpdateFrequency() {
if (ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, "UpdateFrequency") != null) { if (ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, "UpdateFrequency") != null) { //NON-NLS
return UpdateFrequency.valueOf(ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, "UpdateFrequency")); return UpdateFrequency.valueOf(ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, "UpdateFrequency")); //NON-NLS
} }
//if it failed, return the default/last known value //if it failed, return the default/last known value
logger.log(Level.WARNING, "Could not read property for UpdateFrequency, returning backup value."); logger.log(Level.WARNING, "Could not read property for UpdateFrequency, returning backup value."); //NON-NLS
return UpdateFrequency.DEFAULT; return UpdateFrequency.DEFAULT;
} }
@ -66,7 +66,7 @@ class KeywordSearchSettings {
* @param freq Sets KeywordSearchIngestModule to this value. * @param freq Sets KeywordSearchIngestModule to this value.
*/ */
static void setUpdateFrequency(UpdateFrequency freq) { static void setUpdateFrequency(UpdateFrequency freq) {
ModuleSettings.setConfigSetting(PROPERTIES_OPTIONS, "UpdateFrequency", freq.name()); ModuleSettings.setConfigSetting(PROPERTIES_OPTIONS, "UpdateFrequency", freq.name()); //NON-NLS
UpdateFreq = freq; UpdateFreq = freq;
} }
@ -77,7 +77,7 @@ class KeywordSearchSettings {
* @param skip * @param skip
*/ */
static void setSkipKnown(boolean skip) { static void setSkipKnown(boolean skip) {
ModuleSettings.setConfigSetting(PROPERTIES_NSRL, "SkipKnown", Boolean.toString(skip)); ModuleSettings.setConfigSetting(PROPERTIES_NSRL, "SkipKnown", Boolean.toString(skip)); //NON-NLS
skipKnown = skip; skipKnown = skip;
} }
@ -88,11 +88,11 @@ class KeywordSearchSettings {
* @return skip setting * @return skip setting
*/ */
static boolean getSkipKnown() { static boolean getSkipKnown() {
if (ModuleSettings.getConfigSetting(PROPERTIES_NSRL, "SkipKnown") != null) { if (ModuleSettings.getConfigSetting(PROPERTIES_NSRL, "SkipKnown") != null) { //NON-NLS
return Boolean.parseBoolean(ModuleSettings.getConfigSetting(PROPERTIES_NSRL, "SkipKnown")); return Boolean.parseBoolean(ModuleSettings.getConfigSetting(PROPERTIES_NSRL, "SkipKnown")); //NON-NLS
} }
//if it fails, return the default/last known value //if it fails, return the default/last known value
logger.log(Level.WARNING, "Could not read property for SkipKnown, returning backup value."); logger.log(Level.WARNING, "Could not read property for SkipKnown, returning backup value."); //NON-NLS
return skipKnown; return skipKnown;
} }
@ -108,12 +108,12 @@ class KeywordSearchSettings {
//Disabling scripts that weren't selected //Disabling scripts that weren't selected
for (String s : ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS).keySet()) { for (String s : ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS).keySet()) {
if (!scripts.contains(StringExtract.StringExtractUnicodeTable.SCRIPT.valueOf(s))) { if (!scripts.contains(StringExtract.StringExtractUnicodeTable.SCRIPT.valueOf(s))) {
ModuleSettings.setConfigSetting(PROPERTIES_SCRIPTS, s, "false"); ModuleSettings.setConfigSetting(PROPERTIES_SCRIPTS, s, "false"); //NON-NLS
} }
} }
//Writing and enabling selected scripts //Writing and enabling selected scripts
for (StringExtract.StringExtractUnicodeTable.SCRIPT s : stringExtractScripts) { for (StringExtract.StringExtractUnicodeTable.SCRIPT s : stringExtractScripts) {
ModuleSettings.setConfigSetting(PROPERTIES_SCRIPTS, s.name(), "true"); ModuleSettings.setConfigSetting(PROPERTIES_SCRIPTS, s.name(), "true"); //NON-NLS
} }
} }
@ -130,12 +130,12 @@ class KeywordSearchSettings {
} }
static void setShowSnippets(boolean showSnippets) { static void setShowSnippets(boolean showSnippets) {
ModuleSettings.setConfigSetting(PROPERTIES_OPTIONS, SHOW_SNIPPETS, (showSnippets ? "true" : "false")); ModuleSettings.setConfigSetting(PROPERTIES_OPTIONS, SHOW_SNIPPETS, (showSnippets ? "true" : "false")); //NON-NLS
} }
static boolean getShowSnippets() { static boolean getShowSnippets() {
if (ModuleSettings.settingExists(PROPERTIES_OPTIONS, SHOW_SNIPPETS)) { if (ModuleSettings.settingExists(PROPERTIES_OPTIONS, SHOW_SNIPPETS)) {
return ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, SHOW_SNIPPETS).equals("true"); return ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, SHOW_SNIPPETS).equals("true"); //NON-NLS
} else { } else {
return DEFAULT_SHOW_SNIPPETS; return DEFAULT_SHOW_SNIPPETS;
} }
@ -150,14 +150,14 @@ class KeywordSearchSettings {
if (ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS) != null && !ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS).isEmpty()) { if (ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS) != null && !ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS).isEmpty()) {
List<SCRIPT> scripts = new ArrayList<>(); List<SCRIPT> scripts = new ArrayList<>();
for (Map.Entry<String, String> kvp : ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS).entrySet()) { for (Map.Entry<String, String> kvp : ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS).entrySet()) {
if (kvp.getValue().equals("true")) { if (kvp.getValue().equals("true")) { //NON-NLS
scripts.add(SCRIPT.valueOf(kvp.getKey())); scripts.add(SCRIPT.valueOf(kvp.getKey()));
} }
} }
return scripts; return scripts;
} }
//if it failed, try to return the built-in list maintained by the singleton. //if it failed, try to return the built-in list maintained by the singleton.
logger.log(Level.WARNING, "Could not read properties for extracting scripts, returning backup values."); logger.log(Level.WARNING, "Could not read properties for extracting scripts, returning backup values."); //NON-NLS
return new ArrayList<>(stringExtractScripts); return new ArrayList<>(stringExtractScripts);
} }
@ -171,7 +171,7 @@ class KeywordSearchSettings {
if (ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, key) != null) { if (ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, key) != null) {
return ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, key); return ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, key);
} else { } else {
logger.log(Level.WARNING, "Could not read property for key {0}, returning backup value.", key); logger.log(Level.WARNING, "Could not read property for key {0}, returning backup value.", key); //NON-NLS
return stringExtractOptions.get(key); return stringExtractOptions.get(key);
} }
} }
@ -185,7 +185,7 @@ class KeywordSearchSettings {
Map<String, String> settings = ModuleSettings.getConfigSettings(PROPERTIES_OPTIONS); Map<String, String> settings = ModuleSettings.getConfigSettings(PROPERTIES_OPTIONS);
if (settings == null) { if (settings == null) {
Map<String, String> settingsv2 = new HashMap<>(); Map<String, String> settingsv2 = new HashMap<>();
logger.log(Level.WARNING, "Could not read properties for {0}.properties, returning backup values", PROPERTIES_OPTIONS); logger.log(Level.WARNING, "Could not read properties for {0}.properties, returning backup values", PROPERTIES_OPTIONS); //NON-NLS
settingsv2.putAll(stringExtractOptions); settingsv2.putAll(stringExtractOptions);
return settingsv2; return settingsv2;
} else { } else {
@ -198,30 +198,30 @@ class KeywordSearchSettings {
* already exist. * already exist.
*/ */
static void setDefaults() { static void setDefaults() {
logger.log(Level.INFO, "Detecting default settings."); logger.log(Level.INFO, "Detecting default settings."); //NON-NLS
//setting default NSRL //setting default NSRL
if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_NSRL, "SkipKnown")) { if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_NSRL, "SkipKnown")) { //NON-NLS
logger.log(Level.INFO, "No configuration for NSRL found, generating default..."); logger.log(Level.INFO, "No configuration for NSRL found, generating default..."); //NON-NLS
KeywordSearchSettings.setSkipKnown(true); KeywordSearchSettings.setSkipKnown(true);
} }
//setting default Update Frequency //setting default Update Frequency
if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, "UpdateFrequency")) { if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, "UpdateFrequency")) { //NON-NLS
logger.log(Level.INFO, "No configuration for Update Frequency found, generating default..."); logger.log(Level.INFO, "No configuration for Update Frequency found, generating default..."); //NON-NLS
KeywordSearchSettings.setUpdateFrequency(UpdateFrequency.DEFAULT); KeywordSearchSettings.setUpdateFrequency(UpdateFrequency.DEFAULT);
} }
//setting default Extract UTF8 //setting default Extract UTF8
if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString())) { if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString())) {
logger.log(Level.INFO, "No configuration for UTF8 found, generating default..."); logger.log(Level.INFO, "No configuration for UTF8 found, generating default..."); //NON-NLS
KeywordSearchSettings.setStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString(), Boolean.TRUE.toString()); KeywordSearchSettings.setStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString(), Boolean.TRUE.toString());
} }
//setting default Extract UTF16 //setting default Extract UTF16
if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString())) { if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString())) {
logger.log(Level.INFO, "No configuration for UTF16 found, generating defaults..."); logger.log(Level.INFO, "No configuration for UTF16 found, generating defaults..."); //NON-NLS
KeywordSearchSettings.setStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString(), Boolean.TRUE.toString()); KeywordSearchSettings.setStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString(), Boolean.TRUE.toString());
} }
//setting default Latin-1 Script //setting default Latin-1 Script
if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_SCRIPTS, SCRIPT.LATIN_1.name())) { if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_SCRIPTS, SCRIPT.LATIN_1.name())) {
logger.log(Level.INFO, "No configuration for Scripts found, generating defaults..."); logger.log(Level.INFO, "No configuration for Scripts found, generating defaults..."); //NON-NLS
ModuleSettings.setConfigSetting(KeywordSearchSettings.PROPERTIES_SCRIPTS, SCRIPT.LATIN_1.name(), Boolean.toString(true)); ModuleSettings.setConfigSetting(KeywordSearchSettings.PROPERTIES_SCRIPTS, SCRIPT.LATIN_1.name(), Boolean.toString(true));
} }
} }

View File

@ -141,6 +141,6 @@ class KeywordSearchUtil {
*/ */
static boolean isXMLList(String absPath) { static boolean isXMLList(String absPath) {
//TODO: make this more robust, if necessary //TODO: make this more robust, if necessary
return new File(absPath).getName().endsWith(".xml"); return new File(absPath).getName().endsWith(".xml"); //NON-NLS
} }
} }

View File

@ -163,7 +163,7 @@ class LuceneQuery implements KeywordSearchQuery {
bba = newFsHit.newArtifact(ARTIFACT_TYPE.TSK_KEYWORD_HIT); bba = newFsHit.newArtifact(ARTIFACT_TYPE.TSK_KEYWORD_HIT);
writeResult = new KeywordWriteResult(bba); writeResult = new KeywordWriteResult(bba);
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.WARNING, "Error adding bb artifact for keyword hit", e); logger.log(Level.WARNING, "Error adding bb artifact for keyword hit", e); //NON-NLS
return null; return null;
} }
@ -193,7 +193,7 @@ class LuceneQuery implements KeywordSearchQuery {
writeResult.add(attributes); writeResult.add(attributes);
return writeResult; return writeResult;
} catch (TskException e) { } catch (TskException e) {
logger.log(Level.WARNING, "Error adding bb attributes to artifact", e); logger.log(Level.WARNING, "Error adding bb attributes to artifact", e); //NON-NLS
} }
return null; return null;
} }
@ -241,10 +241,10 @@ class LuceneQuery implements KeywordSearchQuery {
} }
} catch (NoOpenCoreException ex) { } catch (NoOpenCoreException ex) {
logger.log(Level.WARNING, "Error executing Lucene Solr Query: " + keywordString, ex); logger.log(Level.WARNING, "Error executing Lucene Solr Query: " + keywordString, ex); //NON-NLS
throw ex; throw ex;
} catch (KeywordSearchModuleException ex) { } catch (KeywordSearchModuleException ex) {
logger.log(Level.WARNING, "Error executing Lucene Solr Query: " + keywordString, ex); logger.log(Level.WARNING, "Error executing Lucene Solr Query: " + keywordString, ex); //NON-NLS
} }
} }
@ -284,17 +284,17 @@ class LuceneQuery implements KeywordSearchQuery {
q.setHighlightFragsize(SNIPPET_LENGTH); q.setHighlightFragsize(SNIPPET_LENGTH);
//tune the highlighter //tune the highlighter
q.setParam("hl.useFastVectorHighlighter", "on"); //fast highlighter scales better than standard one q.setParam("hl.useFastVectorHighlighter", "on"); //fast highlighter scales better than standard one NON-NLS
q.setParam("hl.tag.pre", "&laquo;"); //makes sense for FastVectorHighlighter only q.setParam("hl.tag.pre", "&laquo;"); //makes sense for FastVectorHighlighter only NON-NLS
q.setParam("hl.tag.post", "&laquo;"); //makes sense for FastVectorHighlighter only q.setParam("hl.tag.post", "&laquo;"); //makes sense for FastVectorHighlighter only NON-NLS
q.setParam("hl.fragListBuilder", "simple"); //makes sense for FastVectorHighlighter only q.setParam("hl.fragListBuilder", "simple"); //makes sense for FastVectorHighlighter only NON-NLS
//Solr bug if fragCharSize is smaller than Query string, StringIndexOutOfBoundsException is thrown. //Solr bug if fragCharSize is smaller than Query string, StringIndexOutOfBoundsException is thrown.
q.setParam("hl.fragCharSize", Integer.toString(theQueryStr.length())); //makes sense for FastVectorHighlighter only q.setParam("hl.fragCharSize", Integer.toString(theQueryStr.length())); //makes sense for FastVectorHighlighter only NON-NLS
//docs says makes sense for the original Highlighter only, but not really //docs says makes sense for the original Highlighter only, but not really
//analyze all content SLOW! consider lowering //analyze all content SLOW! consider lowering
q.setParam("hl.maxAnalyzedChars", Server.HL_ANALYZE_CHARS_UNLIMITED); q.setParam("hl.maxAnalyzedChars", Server.HL_ANALYZE_CHARS_UNLIMITED); //NON-NLS
} }
return q; return q;
@ -331,7 +331,7 @@ class LuceneQuery implements KeywordSearchQuery {
chit.setSnippet(snippet); chit.setSnippet(snippet);
} }
} catch (TskException ex) { } catch (TskException ex) {
logger.log(Level.WARNING, "Could not get the AbstractFile for keyword hit, ", ex); logger.log(Level.WARNING, "Could not get the AbstractFile for keyword hit, ", ex); //NON-NLS
//something wrong with case/db //something wrong with case/db
throw ex; throw ex;
} }
@ -346,7 +346,7 @@ class LuceneQuery implements KeywordSearchQuery {
chit.setSnippet(snippet); chit.setSnippet(snippet);
} }
} catch (TskException ex) { } catch (TskException ex) {
logger.log(Level.WARNING, "Could not get the AbstractFile for keyword hit, ", ex); logger.log(Level.WARNING, "Could not get the AbstractFile for keyword hit, ", ex); //NON-NLS
//something wrong with case/db //something wrong with case/db
throw ex; throw ex;
} }
@ -429,17 +429,17 @@ class LuceneQuery implements KeywordSearchQuery {
//tune the highlighter //tune the highlighter
q.setParam("hl.useFastVectorHighlighter", "on"); //fast highlighter scales better than standard one q.setParam("hl.useFastVectorHighlighter", "on"); //fast highlighter scales better than standard one NON-NLS
q.setParam("hl.tag.pre", "&laquo;"); //makes sense for FastVectorHighlighter only q.setParam("hl.tag.pre", "&laquo;"); //makes sense for FastVectorHighlighter only NON-NLS
q.setParam("hl.tag.post", "&laquo;"); //makes sense for FastVectorHighlighter only q.setParam("hl.tag.post", "&laquo;"); //makes sense for FastVectorHighlighter only NON-NLS
q.setParam("hl.fragListBuilder", "simple"); //makes sense for FastVectorHighlighter only q.setParam("hl.fragListBuilder", "simple"); //makes sense for FastVectorHighlighter only NON-NLS
//Solr bug if fragCharSize is smaller than Query string, StringIndexOutOfBoundsException is thrown. //Solr bug if fragCharSize is smaller than Query string, StringIndexOutOfBoundsException is thrown.
q.setParam("hl.fragCharSize", Integer.toString(queryStr.length())); //makes sense for FastVectorHighlighter only q.setParam("hl.fragCharSize", Integer.toString(queryStr.length())); //makes sense for FastVectorHighlighter only NON-NLS
//docs says makes sense for the original Highlighter only, but not really //docs says makes sense for the original Highlighter only, but not really
//analyze all content SLOW! consider lowering //analyze all content SLOW! consider lowering
q.setParam("hl.maxAnalyzedChars", Server.HL_ANALYZE_CHARS_UNLIMITED); q.setParam("hl.maxAnalyzedChars", Server.HL_ANALYZE_CHARS_UNLIMITED); //NON-NLS
try { try {
QueryResponse response = solrServer.query(q, METHOD.POST); QueryResponse response = solrServer.query(q, METHOD.POST);
@ -456,10 +456,10 @@ class LuceneQuery implements KeywordSearchQuery {
return EscapeUtil.unEscapeHtml(contentHighlights.get(0)).trim(); return EscapeUtil.unEscapeHtml(contentHighlights.get(0)).trim();
} }
} catch (NoOpenCoreException ex) { } catch (NoOpenCoreException ex) {
logger.log(Level.WARNING, "Error executing Lucene Solr Query: " + query, ex); logger.log(Level.WARNING, "Error executing Lucene Solr Query: " + query, ex); //NON-NLS
throw ex; throw ex;
} catch (KeywordSearchModuleException ex) { } catch (KeywordSearchModuleException ex) {
logger.log(Level.WARNING, "Error executing Lucene Solr Query: " + query, ex); logger.log(Level.WARNING, "Error executing Lucene Solr Query: " + query, ex); //NON-NLS
return ""; return "";
} }
} }

View File

@ -86,7 +86,7 @@ public final class SearchRunner {
*/ */
public synchronized void startJob(long jobId, long dataSourceId, List<String> keywordListNames) { public synchronized void startJob(long jobId, long dataSourceId, List<String> keywordListNames) {
if (!jobs.containsKey(jobId)) { if (!jobs.containsKey(jobId)) {
logger.log(Level.INFO, "Adding job {0}", jobId); logger.log(Level.INFO, "Adding job {0}", jobId); //NON-NLS
SearchJobInfo jobData = new SearchJobInfo(jobId, dataSourceId, keywordListNames); SearchJobInfo jobData = new SearchJobInfo(jobId, dataSourceId, keywordListNames);
jobs.put(jobId, jobData); jobs.put(jobId, jobData);
} }
@ -136,7 +136,7 @@ public final class SearchRunner {
* @param jobId * @param jobId
*/ */
public void stopJob(long jobId) { public void stopJob(long jobId) {
logger.log(Level.INFO, "Stopping job {0}", jobId); logger.log(Level.INFO, "Stopping job {0}", jobId); //NON-NLS
commit(); commit();
SearchJobInfo job; SearchJobInfo job;
@ -162,7 +162,7 @@ public final class SearchRunner {
*/ */
public synchronized void addKeywordListsToAllJobs(List<String> keywordListNames) { public synchronized void addKeywordListsToAllJobs(List<String> keywordListNames) {
for(String listName : keywordListNames) { for(String listName : keywordListNames) {
logger.log(Level.INFO, "Adding keyword list {0} to all jobs", listName); logger.log(Level.INFO, "Adding keyword list {0} to all jobs", listName); //NON-NLS
for(SearchJobInfo j : jobs.values()) { for(SearchJobInfo j : jobs.values()) {
j.addKeywordListName(listName); j.addKeywordListName(listName);
} }
@ -180,7 +180,7 @@ public final class SearchRunner {
final int numIndexedFiles = KeywordSearch.getServer().queryNumIndexedFiles(); final int numIndexedFiles = KeywordSearch.getServer().queryNumIndexedFiles();
KeywordSearch.fireNumIndexedFilesChange(null, new Integer(numIndexedFiles)); KeywordSearch.fireNumIndexedFilesChange(null, new Integer(numIndexedFiles));
} catch (NoOpenCoreException | KeywordSearchModuleException ex) { } catch (NoOpenCoreException | KeywordSearchModuleException ex) {
logger.log(Level.WARNING, "Error executing Solr query to check number of indexed files: ", ex); logger.log(Level.WARNING, "Error executing Solr query to check number of indexed files: ", ex); //NON-NLS
} }
} }
@ -191,7 +191,7 @@ public final class SearchRunner {
*/ */
private void doFinalSearch(SearchJobInfo job) { private void doFinalSearch(SearchJobInfo job) {
// Run one last search as there are probably some new files committed // Run one last search as there are probably some new files committed
logger.log(Level.INFO, "Running final search for jobid {0}", job.getJobId()); logger.log(Level.INFO, "Running final search for jobid {0}", job.getJobId()); //NON-NLS
if (!job.getKeywordListNames().isEmpty()) { if (!job.getKeywordListNames().isEmpty()) {
try { try {
// In case this job still has a worker running, wait for it to finish // In case this job still has a worker running, wait for it to finish
@ -205,7 +205,7 @@ public final class SearchRunner {
finalSearcher.get(); finalSearcher.get();
} catch (InterruptedException | ExecutionException ex) { } catch (InterruptedException | ExecutionException ex) {
logger.log(Level.WARNING, "Job {1} final search thread failed: {2}", new Object[]{job.getJobId(), ex}); logger.log(Level.WARNING, "Job {1} final search thread failed: {2}", new Object[]{job.getJobId(), ex}); //NON-NLS
} }
} }
} }
@ -381,7 +381,7 @@ public final class SearchRunner {
progressGroup = AggregateProgressFactory.createSystemHandle(pgDisplayName, null, new Cancellable() { progressGroup = AggregateProgressFactory.createSystemHandle(pgDisplayName, null, new Cancellable() {
@Override @Override
public boolean cancel() { public boolean cancel() {
logger.log(Level.INFO, "Cancelling the searcher by user."); logger.log(Level.INFO, "Cancelling the searcher by user."); //NON-NLS
if (progressGroup != null) { if (progressGroup != null) {
progressGroup.setDisplayName(displayName + " (" + NbBundle.getMessage(this.getClass(), "SearchRunner.doInBackGround.cancelMsg") + "...)"); progressGroup.setDisplayName(displayName + " (" + NbBundle.getMessage(this.getClass(), "SearchRunner.doInBackGround.cancelMsg") + "...)");
} }
@ -410,7 +410,7 @@ public final class SearchRunner {
for (Keyword keywordQuery : keywords) { for (Keyword keywordQuery : keywords) {
if (this.isCancelled()) { if (this.isCancelled()) {
logger.log(Level.INFO, "Cancel detected, bailing before new keyword processed: {0}", keywordQuery.getQuery()); logger.log(Level.INFO, "Cancel detected, bailing before new keyword processed: {0}", keywordQuery.getQuery()); //NON-NLS
return null; return null;
} }
@ -444,16 +444,16 @@ public final class SearchRunner {
try { try {
queryResult = del.performQuery(); queryResult = del.performQuery();
} catch (NoOpenCoreException ex) { } catch (NoOpenCoreException ex) {
logger.log(Level.WARNING, "Error performing query: " + keywordQuery.getQuery(), ex); logger.log(Level.WARNING, "Error performing query: " + keywordQuery.getQuery(), ex); //NON-NLS
//no reason to continue with next query if recovery failed //no reason to continue with next query if recovery failed
//or wait for recovery to kick in and run again later //or wait for recovery to kick in and run again later
//likely case has closed and threads are being interrupted //likely case has closed and threads are being interrupted
return null; return null;
} catch (CancellationException e) { } catch (CancellationException e) {
logger.log(Level.INFO, "Cancel detected, bailing during keyword query: {0}", keywordQuery.getQuery()); logger.log(Level.INFO, "Cancel detected, bailing during keyword query: {0}", keywordQuery.getQuery()); //NON-NLS
return null; return null;
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.WARNING, "Error performing query: " + keywordQuery.getQuery(), e); logger.log(Level.WARNING, "Error performing query: " + keywordQuery.getQuery(), e); //NON-NLS
continue; continue;
} }
@ -482,7 +482,7 @@ public final class SearchRunner {
for (final Keyword hitTerm : newResults.keySet()) { for (final Keyword hitTerm : newResults.keySet()) {
//checking for cancellation between results //checking for cancellation between results
if (this.isCancelled()) { if (this.isCancelled()) {
logger.log(Level.INFO, "Cancel detected, bailing before new hit processed for query: {0}", keywordQuery.getQuery()); logger.log(Level.INFO, "Cancel detected, bailing before new hit processed for query: {0}", keywordQuery.getQuery()); //NON-NLS
return null; return null;
} }
@ -504,18 +504,18 @@ public final class SearchRunner {
try { try {
snippet = LuceneQuery.querySnippet(snippetQuery, hitFile.getId(), chunkId, isRegex, true); snippet = LuceneQuery.querySnippet(snippetQuery, hitFile.getId(), chunkId, isRegex, true);
} catch (NoOpenCoreException e) { } catch (NoOpenCoreException e) {
logger.log(Level.WARNING, "Error querying snippet: " + snippetQuery, e); logger.log(Level.WARNING, "Error querying snippet: " + snippetQuery, e); //NON-NLS
//no reason to continue //no reason to continue
return null; return null;
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.WARNING, "Error querying snippet: " + snippetQuery, e); logger.log(Level.WARNING, "Error querying snippet: " + snippetQuery, e); //NON-NLS
continue; continue;
} }
// write the blackboard artifact for this keyword in this file // write the blackboard artifact for this keyword in this file
KeywordWriteResult written = del.writeToBlackBoard(hitTerm.getQuery(), hitFile, snippet, listName); KeywordWriteResult written = del.writeToBlackBoard(hitTerm.getQuery(), hitFile, snippet, listName);
if (written == null) { if (written == null) {
logger.log(Level.WARNING, "BB artifact for keyword hit not written, file: {0}, hit: {1}", new Object[]{hitFile, hitTerm.toString()}); logger.log(Level.WARNING, "BB artifact for keyword hit not written, file: {0}, hit: {1}", new Object[]{hitFile, hitTerm.toString()}); //NON-NLS
continue; continue;
} }
@ -540,46 +540,46 @@ public final class SearchRunner {
} }
//details //details
detailsSb.append("<table border='0' cellpadding='4' width='280'>"); detailsSb.append("<table border='0' cellpadding='4' width='280'>"); //NON-NLS
//hit //hit
detailsSb.append("<tr>"); detailsSb.append("<tr>"); //NON-NLS
detailsSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.kwHitThLbl")); detailsSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.kwHitThLbl"));
detailsSb.append("<td>").append(EscapeUtil.escapeHtml(attr.getValueString())).append("</td>"); detailsSb.append("<td>").append(EscapeUtil.escapeHtml(attr.getValueString())).append("</td>"); //NON-NLS
detailsSb.append("</tr>"); detailsSb.append("</tr>"); //NON-NLS
//preview //preview
attr = written.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID()); attr = written.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID());
if (attr != null) { if (attr != null) {
detailsSb.append("<tr>"); detailsSb.append("<tr>"); //NON-NLS
detailsSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.previewThLbl")); detailsSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.previewThLbl"));
detailsSb.append("<td>").append(EscapeUtil.escapeHtml(attr.getValueString())).append("</td>"); detailsSb.append("<td>").append(EscapeUtil.escapeHtml(attr.getValueString())).append("</td>"); //NON-NLS
detailsSb.append("</tr>"); detailsSb.append("</tr>"); //NON-NLS
} }
//file //file
detailsSb.append("<tr>"); detailsSb.append("<tr>"); //NON-NLS
detailsSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.fileThLbl")); detailsSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.fileThLbl"));
detailsSb.append("<td>").append(hitFile.getParentPath()).append(hitFile.getName()).append("</td>"); detailsSb.append("<td>").append(hitFile.getParentPath()).append(hitFile.getName()).append("</td>"); //NON-NLS
detailsSb.append("</tr>"); detailsSb.append("</tr>"); //NON-NLS
//list //list
attr = written.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()); attr = written.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID());
detailsSb.append("<tr>"); detailsSb.append("<tr>"); //NON-NLS
detailsSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.listThLbl")); detailsSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.listThLbl"));
detailsSb.append("<td>").append(attr.getValueString()).append("</td>"); detailsSb.append("<td>").append(attr.getValueString()).append("</td>"); //NON-NLS
detailsSb.append("</tr>"); detailsSb.append("</tr>"); //NON-NLS
//regex //regex
if (!keywordQuery.isLiteral()) { if (!keywordQuery.isLiteral()) {
attr = written.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID()); attr = written.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID());
if (attr != null) { if (attr != null) {
detailsSb.append("<tr>"); detailsSb.append("<tr>"); //NON-NLS
detailsSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.regExThLbl")); detailsSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.regExThLbl"));
detailsSb.append("<td>").append(attr.getValueString()).append("</td>"); detailsSb.append("<td>").append(attr.getValueString()).append("</td>"); //NON-NLS
detailsSb.append("</tr>"); detailsSb.append("</tr>"); //NON-NLS
} }
} }
detailsSb.append("</table>"); detailsSb.append("</table>"); //NON-NLS
services.postMessage(IngestMessage.createDataMessage(KeywordSearchModuleFactory.getModuleName(), subjectSb.toString(), detailsSb.toString(), uniqueKey, written.getArtifact())); services.postMessage(IngestMessage.createDataMessage(KeywordSearchModuleFactory.getModuleName(), subjectSb.toString(), detailsSb.toString(), uniqueKey, written.getArtifact()));
} }
@ -604,13 +604,13 @@ public final class SearchRunner {
} //end try block } //end try block
catch (Exception ex) { catch (Exception ex) {
logger.log(Level.WARNING, "searcher exception occurred", ex); logger.log(Level.WARNING, "searcher exception occurred", ex); //NON-NLS
} finally { } finally {
try { try {
finalizeSearcher(); finalizeSearcher();
stopWatch.stop(); stopWatch.stop();
logger.log(Level.INFO, "Searcher took to run: {0} secs.", stopWatch.getElapsedTimeSecs()); logger.log(Level.INFO, "Searcher took to run: {0} secs.", stopWatch.getElapsedTimeSecs()); //NON-NLS
} finally { } finally {
// In case a thread is waiting on this worker to be done // In case a thread is waiting on this worker to be done
job.searchNotify(); job.searchNotify();
@ -626,7 +626,7 @@ public final class SearchRunner {
try { try {
get(); get();
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException | ExecutionException e) {
logger.log(Level.SEVERE, "Error performing keyword search: " + e.getMessage()); logger.log(Level.SEVERE, "Error performing keyword search: " + e.getMessage()); //NON-NLS
services.postMessage(IngestMessage.createErrorMessage(KeywordSearchModuleFactory.getModuleName(), "Error performing keyword search", e.getMessage())); services.postMessage(IngestMessage.createErrorMessage(KeywordSearchModuleFactory.getModuleName(), "Error performing keyword search", e.getMessage()));
} // catch and ignore if we were cancelled } // catch and ignore if we were cancelled
catch (java.util.concurrent.CancellationException ex) { catch (java.util.concurrent.CancellationException ex) {

View File

@ -72,65 +72,65 @@ public class Server {
ID { ID {
@Override @Override
public String toString() { public String toString() {
return "id"; return "id"; //NON-NLS
} }
}, },
IMAGE_ID { IMAGE_ID {
@Override @Override
public String toString() { public String toString() {
return "image_id"; return "image_id"; //NON-NLS
} }
}, },
CONTENT { CONTENT {
@Override @Override
public String toString() { public String toString() {
return "content"; return "content"; //NON-NLS
} }
}, },
CONTENT_WS { CONTENT_WS {
@Override @Override
public String toString() { public String toString() {
return "content_ws"; return "content_ws"; //NON-NLS
} }
}, },
FILE_NAME { FILE_NAME {
@Override @Override
public String toString() { public String toString() {
return "file_name"; return "file_name"; //NON-NLS
} }
}, },
// note that we no longer index this field // note that we no longer index this field
CTIME { CTIME {
@Override @Override
public String toString() { public String toString() {
return "ctime"; return "ctime"; //NON-NLS
} }
}, },
// note that we no longer index this field // note that we no longer index this field
ATIME { ATIME {
@Override @Override
public String toString() { public String toString() {
return "atime"; return "atime"; //NON-NLS
} }
}, },
// note that we no longer index this field // note that we no longer index this field
MTIME { MTIME {
@Override @Override
public String toString() { public String toString() {
return "mtime"; return "mtime"; //NON-NLS
} }
}, },
// note that we no longer index this field // note that we no longer index this field
CRTIME { CRTIME {
@Override @Override
public String toString() { public String toString() {
return "crtime"; return "crtime"; //NON-NLS
} }
}, },
NUM_CHUNKS { NUM_CHUNKS {
@Override @Override
public String toString() { public String toString() {
return "num_chunks"; return "num_chunks"; //NON-NLS
} }
}, },
}; };
@ -138,19 +138,19 @@ public class Server {
//max content size we can send to Solr //max content size we can send to Solr
public static final long MAX_CONTENT_SIZE = 1L * 1024 * 1024 * 1024; public static final long MAX_CONTENT_SIZE = 1L * 1024 * 1024 * 1024;
private static final Logger logger = Logger.getLogger(Server.class.getName()); private static final Logger logger = Logger.getLogger(Server.class.getName());
private static final String DEFAULT_CORE_NAME = "coreCase"; private static final String DEFAULT_CORE_NAME = "coreCase"; //NON-NLS
// TODO: DEFAULT_CORE_NAME needs to be replaced with unique names to support multiple open cases // TODO: DEFAULT_CORE_NAME needs to be replaced with unique names to support multiple open cases
public static final String CORE_EVT = "CORE_EVT"; public static final String CORE_EVT = "CORE_EVT"; //NON-NLS
public static final char ID_CHUNK_SEP = '_'; public static final char ID_CHUNK_SEP = '_';
private String javaPath = "java"; private String javaPath = "java"; //NON-NLS
public static final Charset DEFAULT_INDEXED_TEXT_CHARSET = Charset.forName("UTF-8"); ///< default Charset to index text as public static final Charset DEFAULT_INDEXED_TEXT_CHARSET = Charset.forName("UTF-8"); ///< default Charset to index text as
private static final int MAX_SOLR_MEM_MB = 512; //TODO set dynamically based on avail. system resources private static final int MAX_SOLR_MEM_MB = 512; //TODO set dynamically based on avail. system resources
private Process curSolrProcess = null; private Process curSolrProcess = null;
private static Ingester ingester = null; private static Ingester ingester = null;
static final String PROPERTIES_FILE = KeywordSearchSettings.MODULE_NAME; static final String PROPERTIES_FILE = KeywordSearchSettings.MODULE_NAME;
static final String PROPERTIES_CURRENT_SERVER_PORT = "IndexingServerPort"; static final String PROPERTIES_CURRENT_SERVER_PORT = "IndexingServerPort"; //NON-NLS
static final String PROPERTIES_CURRENT_STOP_PORT = "IndexingServerStopPort"; static final String PROPERTIES_CURRENT_STOP_PORT = "IndexingServerStopPort"; //NON-NLS
private static final String KEY = "jjk#09s"; private static final String KEY = "jjk#09s"; //NON-NLS
static final int DEFAULT_SOLR_SERVER_PORT = 23232; static final int DEFAULT_SOLR_SERVER_PORT = 23232;
static final int DEFAULT_SOLR_STOP_PORT = 34343; static final int DEFAULT_SOLR_STOP_PORT = 34343;
private int currentSolrServerPort = 0; private int currentSolrServerPort = 0;
@ -176,14 +176,14 @@ public class Server {
Server() { Server() {
initSettings(); initSettings();
this.solrUrl = "http://localhost:" + currentSolrServerPort + "/solr"; this.solrUrl = "http://localhost:" + currentSolrServerPort + "/solr"; //NON-NLS
this.solrServer = new HttpSolrServer(solrUrl); this.solrServer = new HttpSolrServer(solrUrl);
serverAction = new ServerAction(); serverAction = new ServerAction();
solrFolder = InstalledFileLocator.getDefault().locate("solr", Server.class.getPackage().getName(), false); solrFolder = InstalledFileLocator.getDefault().locate("solr", Server.class.getPackage().getName(), false); //NON-NLS
instanceDir = solrFolder.getAbsolutePath() + File.separator + "solr"; instanceDir = solrFolder.getAbsolutePath() + File.separator + "solr"; //NON-NLS
javaPath = PlatformUtil.getJavaPath(); javaPath = PlatformUtil.getJavaPath();
logger.log(Level.INFO, "Created Server instance"); logger.log(Level.INFO, "Created Server instance"); //NON-NLS
} }
private void initSettings() { private void initSettings() {
@ -191,7 +191,7 @@ public class Server {
try { try {
currentSolrServerPort = Integer.decode(ModuleSettings.getConfigSetting(PROPERTIES_FILE, PROPERTIES_CURRENT_SERVER_PORT)); currentSolrServerPort = Integer.decode(ModuleSettings.getConfigSetting(PROPERTIES_FILE, PROPERTIES_CURRENT_SERVER_PORT));
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
logger.log(Level.WARNING, "Could not decode indexing server port, value was not a valid port number, using the default. ", nfe); logger.log(Level.WARNING, "Could not decode indexing server port, value was not a valid port number, using the default. ", nfe); //NON-NLS
currentSolrServerPort = DEFAULT_SOLR_SERVER_PORT; currentSolrServerPort = DEFAULT_SOLR_SERVER_PORT;
} }
} else { } else {
@ -203,7 +203,7 @@ public class Server {
try { try {
currentSolrStopPort = Integer.decode(ModuleSettings.getConfigSetting(PROPERTIES_FILE, PROPERTIES_CURRENT_STOP_PORT)); currentSolrStopPort = Integer.decode(ModuleSettings.getConfigSetting(PROPERTIES_FILE, PROPERTIES_CURRENT_STOP_PORT));
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
logger.log(Level.WARNING, "Could not decode indexing server stop port, value was not a valid port number, using default", nfe); logger.log(Level.WARNING, "Could not decode indexing server stop port, value was not a valid port number, using default", nfe); //NON-NLS
currentSolrStopPort = DEFAULT_SOLR_STOP_PORT; currentSolrStopPort = DEFAULT_SOLR_STOP_PORT;
} }
} else { } else {
@ -243,8 +243,8 @@ public class Server {
this.stream = stream; this.stream = stream;
try { try {
final String log = Places.getUserDirectory().getAbsolutePath() final String log = Places.getUserDirectory().getAbsolutePath()
+ File.separator + "var" + File.separator + "log" + File.separator + "var" + File.separator + "log" //NON-NLS
+ File.separator + "solr.log." + type; + File.separator + "solr.log." + type; //NON-NLS
File outputFile = new File(log.concat(".0")); File outputFile = new File(log.concat(".0"));
File first = new File(log.concat(".1")); File first = new File(log.concat(".1"));
File second = new File(log.concat(".2")); File second = new File(log.concat(".2"));
@ -262,7 +262,7 @@ public class Server {
out = new FileOutputStream(outputFile); out = new FileOutputStream(outputFile);
} catch (Exception ex) { } catch (Exception ex) {
logger.log(Level.WARNING, "Failed to create solr log file", ex); logger.log(Level.WARNING, "Failed to create solr log file", ex); //NON-NLS
} }
} }
@ -290,20 +290,20 @@ public class Server {
} }
bw.flush(); bw.flush();
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Error redirecting Solr output stream"); logger.log(Level.WARNING, "Error redirecting Solr output stream"); //NON-NLS
} finally { } finally {
if (bw != null) { if (bw != null) {
try { try {
bw.close(); bw.close();
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Error closing Solr output stream writer"); logger.log(Level.WARNING, "Error closing Solr output stream writer"); //NON-NLS
} }
} }
if (br != null) { if (br != null) {
try { try {
br.close(); br.close();
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Error closing Solr output stream reader"); logger.log(Level.WARNING, "Error closing Solr output stream reader"); //NON-NLS
} }
} }
} }
@ -319,7 +319,7 @@ public class Server {
List<Long> pids = new ArrayList<Long>(); List<Long> pids = new ArrayList<Long>();
//NOTE: these needs to be in sync with process start string in start() //NOTE: these needs to be in sync with process start string in start()
final String pidsQuery = "Args.4.eq=-DSTOP.KEY=" + KEY + ",Args.7.eq=start.jar"; final String pidsQuery = "Args.4.eq=-DSTOP.KEY=" + KEY + ",Args.7.eq=start.jar"; //NON-NLS
long[] pidsArr = PlatformUtil.getJavaPIDs(pidsQuery); long[] pidsArr = PlatformUtil.getJavaPIDs(pidsQuery);
if (pidsArr != null) { if (pidsArr != null) {
@ -338,7 +338,7 @@ public class Server {
void killSolr() { void killSolr() {
List<Long> solrPids = getSolrPIDs(); List<Long> solrPids = getSolrPIDs();
for (long pid : solrPids) { for (long pid : solrPids) {
logger.log(Level.INFO, "Trying to kill old Solr process, PID: " + pid); logger.log(Level.INFO, "Trying to kill old Solr process, PID: " + pid); //NON-NLS
PlatformUtil.killProcess(pid); PlatformUtil.killProcess(pid);
} }
} }
@ -349,19 +349,19 @@ public class Server {
* successful. * successful.
*/ */
void start() throws KeywordSearchModuleException, SolrServerNoPortException { void start() throws KeywordSearchModuleException, SolrServerNoPortException {
logger.log(Level.INFO, "Starting Solr server from: " + solrFolder.getAbsolutePath()); logger.log(Level.INFO, "Starting Solr server from: " + solrFolder.getAbsolutePath()); //NON-NLS
if (isPortAvailable(currentSolrServerPort)) { if (isPortAvailable(currentSolrServerPort)) {
logger.log(Level.INFO, "Port [" + currentSolrServerPort + "] available, starting Solr"); logger.log(Level.INFO, "Port [" + currentSolrServerPort + "] available, starting Solr"); //NON-NLS
try { try {
final String MAX_SOLR_MEM_MB_PAR = "-Xmx" + Integer.toString(MAX_SOLR_MEM_MB) + "m"; final String MAX_SOLR_MEM_MB_PAR = "-Xmx" + Integer.toString(MAX_SOLR_MEM_MB) + "m"; //NON-NLS
String loggingPropertiesOpt = "-Djava.util.logging.config.file="; String loggingPropertiesOpt = "-Djava.util.logging.config.file="; //NON-NLS
String loggingPropertiesFilePath = instanceDir + File.separator + "conf" + File.separator; String loggingPropertiesFilePath = instanceDir + File.separator + "conf" + File.separator; //NON-NLS
if (DEBUG) { if (DEBUG) {
loggingPropertiesFilePath += "logging-development.properties"; loggingPropertiesFilePath += "logging-development.properties"; //NON-NLS
} else { } else {
loggingPropertiesFilePath += "logging-release.properties"; loggingPropertiesFilePath += "logging-release.properties"; //NON-NLS
} }
final String loggingProperties = loggingPropertiesOpt + loggingPropertiesFilePath; final String loggingProperties = loggingPropertiesOpt + loggingPropertiesFilePath;
@ -369,47 +369,47 @@ public class Server {
final String [] SOLR_START_CMD = { final String [] SOLR_START_CMD = {
javaPath, javaPath,
MAX_SOLR_MEM_MB_PAR, MAX_SOLR_MEM_MB_PAR,
"-DSTOP.PORT=" + currentSolrStopPort, "-DSTOP.PORT=" + currentSolrStopPort, //NON-NLS
"-Djetty.port=" + currentSolrServerPort, "-Djetty.port=" + currentSolrServerPort, //NON-NLS
"-DSTOP.KEY=" + KEY, "-DSTOP.KEY=" + KEY, //NON-NLS
loggingProperties, loggingProperties,
"-jar", "-jar", //NON-NLS
"start.jar"}; "start.jar"}; //NON-NLS
StringBuilder cmdSb = new StringBuilder(); StringBuilder cmdSb = new StringBuilder();
for (int i = 0; i<SOLR_START_CMD.length; ++i ) { for (int i = 0; i<SOLR_START_CMD.length; ++i ) {
cmdSb.append(SOLR_START_CMD[i]).append(" "); cmdSb.append(SOLR_START_CMD[i]).append(" ");
} }
logger.log(Level.INFO, "Starting Solr using: " + cmdSb.toString()); logger.log(Level.INFO, "Starting Solr using: " + cmdSb.toString()); //NON-NLS
curSolrProcess = Runtime.getRuntime().exec(SOLR_START_CMD, null, solrFolder); curSolrProcess = Runtime.getRuntime().exec(SOLR_START_CMD, null, solrFolder);
logger.log(Level.INFO, "Finished starting Solr"); logger.log(Level.INFO, "Finished starting Solr"); //NON-NLS
try { try {
//block for 10 seconds, give time to fully start the process //block for 10 seconds, give time to fully start the process
//so if it's restarted solr operations can be resumed seamlessly //so if it's restarted solr operations can be resumed seamlessly
Thread.sleep(10 * 1000); Thread.sleep(10 * 1000);
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
logger.log(Level.WARNING, "Timer interrupted"); logger.log(Level.WARNING, "Timer interrupted"); //NON-NLS
} }
// Handle output to prevent process from blocking // Handle output to prevent process from blocking
errorRedirectThread = new InputStreamPrinterThread(curSolrProcess.getErrorStream(), "stderr"); errorRedirectThread = new InputStreamPrinterThread(curSolrProcess.getErrorStream(), "stderr"); //NON-NLS
errorRedirectThread.start(); errorRedirectThread.start();
final List<Long> pids = this.getSolrPIDs(); final List<Long> pids = this.getSolrPIDs();
logger.log(Level.INFO, "New Solr process PID: " + pids); logger.log(Level.INFO, "New Solr process PID: " + pids); //NON-NLS
} catch (SecurityException ex) { } catch (SecurityException ex) {
logger.log(Level.SEVERE, "Could not start Solr process!", ex); logger.log(Level.SEVERE, "Could not start Solr process!", ex); //NON-NLS
throw new KeywordSearchModuleException( throw new KeywordSearchModuleException(
NbBundle.getMessage(this.getClass(), "Server.start.exception.cantStartSolr.msg"), ex); NbBundle.getMessage(this.getClass(), "Server.start.exception.cantStartSolr.msg"), ex);
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.SEVERE, "Could not start Solr server process!", ex); logger.log(Level.SEVERE, "Could not start Solr server process!", ex); //NON-NLS
throw new KeywordSearchModuleException( throw new KeywordSearchModuleException(
NbBundle.getMessage(this.getClass(), "Server.start.exception.cantStartSolr.msg2"), ex); NbBundle.getMessage(this.getClass(), "Server.start.exception.cantStartSolr.msg2"), ex);
} }
} else { } else {
logger.log(Level.SEVERE, "Could not start Solr server process, port [" + currentSolrServerPort + "] not available!"); logger.log(Level.SEVERE, "Could not start Solr server process, port [" + currentSolrServerPort + "] not available!"); //NON-NLS
throw new SolrServerNoPortException(currentSolrServerPort); throw new SolrServerNoPortException(currentSolrServerPort);
} }
} }
@ -423,7 +423,7 @@ public class Server {
ServerSocket ss = null; ServerSocket ss = null;
try { try {
ss = new ServerSocket(port, 0, java.net.Inet4Address.getByName("localhost")); ss = new ServerSocket(port, 0, java.net.Inet4Address.getByName("localhost")); //NON-NLS
if (ss.isBound()) { if (ss.isBound()) {
ss.setReuseAddress(true); ss.setReuseAddress(true);
ss.close(); ss.close();
@ -470,18 +470,18 @@ public class Server {
*/ */
synchronized void stop() { synchronized void stop() {
try { try {
logger.log(Level.INFO, "Stopping Solr server from: " + solrFolder.getAbsolutePath()); logger.log(Level.INFO, "Stopping Solr server from: " + solrFolder.getAbsolutePath()); //NON-NLS
//try graceful shutdown //try graceful shutdown
final String [] SOLR_STOP_CMD = { final String [] SOLR_STOP_CMD = {
javaPath, javaPath,
"-DSTOP.PORT=" + currentSolrStopPort, "-DSTOP.PORT=" + currentSolrStopPort, //NON-NLS
"-DSTOP.KEY=" + KEY, "-DSTOP.KEY=" + KEY, //NON-NLS
"-jar", "-jar", //NON-NLS
"start.jar", "start.jar", //NON-NLS
"--stop", "--stop", //NON-NLS
}; };
Process stop = Runtime.getRuntime().exec(SOLR_STOP_CMD, null, solrFolder); Process stop = Runtime.getRuntime().exec(SOLR_STOP_CMD, null, solrFolder);
logger.log(Level.INFO, "Waiting for stopping Solr server"); logger.log(Level.INFO, "Waiting for stopping Solr server"); //NON-NLS
stop.waitFor(); stop.waitFor();
//if still running, forcefully stop it //if still running, forcefully stop it
@ -504,7 +504,7 @@ public class Server {
killSolr(); killSolr();
} }
logger.log(Level.INFO, "Finished stopping Solr server"); logger.log(Level.INFO, "Finished stopping Solr server"); //NON-NLS
} }
} }
@ -525,7 +525,7 @@ public class Server {
//TODO handle timeout in cases when some other type of server on that port //TODO handle timeout in cases when some other type of server on that port
CoreAdminRequest.getStatus(null, solrServer); CoreAdminRequest.getStatus(null, solrServer);
logger.log(Level.INFO, "Solr server is running"); logger.log(Level.INFO, "Solr server is running"); //NON-NLS
} catch (SolrServerException ex) { } catch (SolrServerException ex) {
Throwable cause = ex.getRootCause(); Throwable cause = ex.getRootCause();
@ -534,7 +534,7 @@ public 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 server is not running, cause: {0}", cause.getMessage()); logger.log(Level.INFO, "Solr server is not running, cause: {0}", cause.getMessage()); //NON-NLS
return false; return false;
} else { } else {
throw new KeywordSearchModuleException( throw new KeywordSearchModuleException(
@ -542,7 +542,7 @@ public class Server {
} }
} catch (SolrException ex) { } catch (SolrException ex) {
// Just log 404 errors for now... // Just log 404 errors for now...
logger.log(Level.INFO, "Solr server is not running", ex); logger.log(Level.INFO, "Solr server is not running", ex); //NON-NLS
return false; return false;
} catch (IOException ex) { } catch (IOException ex) {
throw new KeywordSearchModuleException( throw new KeywordSearchModuleException(
@ -575,25 +575,25 @@ public class Server {
* backwards compatibility with older cases) * backwards compatibility with older cases)
*/ */
private void validateIndexLocation(Case theCase) { private void validateIndexLocation(Case theCase) {
logger.log(Level.INFO, "Validating keyword search index location"); logger.log(Level.INFO, "Validating keyword search index location"); //NON-NLS
String properIndexPath = getIndexDirPath(theCase); String properIndexPath = getIndexDirPath(theCase);
String legacyIndexPath = theCase.getCaseDirectory() String legacyIndexPath = theCase.getCaseDirectory()
+ File.separator + "keywordsearch" + File.separator + "data"; + File.separator + "keywordsearch" + File.separator + "data"; //NON-NLS
File properIndexDir = new File(properIndexPath); File properIndexDir = new File(properIndexPath);
File legacyIndexDir = new File(legacyIndexPath); File legacyIndexDir = new File(legacyIndexPath);
if (!properIndexDir.exists() if (!properIndexDir.exists()
&& legacyIndexDir.exists() && legacyIndexDir.isDirectory()) { && legacyIndexDir.exists() && legacyIndexDir.isDirectory()) {
logger.log(Level.INFO, "Moving keyword search index location from: " logger.log(Level.INFO, "Moving keyword search index location from: " //NON-NLS
+ legacyIndexPath + " to: " + properIndexPath); + legacyIndexPath + " to: " + properIndexPath); //NON-NLS
try { try {
Files.move(Paths.get(legacyIndexDir.getParent()), Paths.get(properIndexDir.getParent())); Files.move(Paths.get(legacyIndexDir.getParent()), Paths.get(properIndexDir.getParent()));
} catch (IOException | SecurityException ex) { } catch (IOException | SecurityException ex) {
logger.log(Level.WARNING, "Error moving keyword search index folder from: " logger.log(Level.WARNING, "Error moving keyword search index folder from: " //NON-NLS
+ legacyIndexPath + " to: " + properIndexPath + legacyIndexPath + " to: " + properIndexPath //NON-NLS
+ " will recreate a new index.", ex); + " will recreate a new index.", ex); //NON-NLS
} }
} }
} }
@ -619,7 +619,7 @@ public class Server {
*/ */
String getIndexDirPath(Case theCase) { String getIndexDirPath(Case theCase) {
String indexDir = theCase.getModulesOutputDirAbsPath() String indexDir = theCase.getModulesOutputDirAbsPath()
+ File.separator + "keywordsearch" + File.separator + "data"; + File.separator + "keywordsearch" + File.separator + "data"; //NON-NLS
return indexDir; return indexDir;
} }
@ -887,7 +887,7 @@ public class Server {
//handle a possible scenario when server process might not be fully started //handle a possible scenario when server process might not be fully started
if (!this.isRunning()) { if (!this.isRunning()) {
logger.log(Level.WARNING, "Core open requested, but server not yet running"); logger.log(Level.WARNING, "Core open requested, but server not yet running"); //NON-NLS
throw new KeywordSearchModuleException( throw new KeywordSearchModuleException(
NbBundle.getMessage(this.getClass(), "Server.openCore.exception.msg")); NbBundle.getMessage(this.getClass(), "Server.openCore.exception.msg"));
} }
@ -948,7 +948,7 @@ public class Server {
try { try {
return solrCore.request(request); return solrCore.request(request);
} catch (IOException e) { } catch (IOException e) {
logger.log(Level.WARNING, "Could not issue Solr request. ", e); logger.log(Level.WARNING, "Could not issue Solr request. ", e); //NON-NLS
throw new SolrServerException( throw new SolrServerException(
NbBundle.getMessage(this.getClass(), "Server.request.exception.exception.msg"), e); NbBundle.getMessage(this.getClass(), "Server.request.exception.exception.msg"), e);
} }
@ -969,7 +969,7 @@ public class Server {
//commit and block //commit and block
solrCore.commit(true, true); solrCore.commit(true, true);
} catch (IOException e) { } catch (IOException e) {
logger.log(Level.WARNING, "Could not commit index. ", e); logger.log(Level.WARNING, "Could not commit index. ", e); //NON-NLS
throw new SolrServerException(NbBundle.getMessage(this.getClass(), "Server.commit.exception.msg"), e); throw new SolrServerException(NbBundle.getMessage(this.getClass(), "Server.commit.exception.msg"), e);
} }
} }
@ -978,13 +978,13 @@ public class Server {
try { try {
solrCore.add(doc); solrCore.add(doc);
} catch (SolrServerException ex) { } catch (SolrServerException ex) {
logger.log(Level.SEVERE, "Could not add document to index via update handler: " + doc.getField("id"), ex); logger.log(Level.SEVERE, "Could not add document to index via update handler: " + doc.getField("id"), ex); //NON-NLS
throw new KeywordSearchModuleException( throw new KeywordSearchModuleException(
NbBundle.getMessage(this.getClass(), "Server.addDoc.exception.msg", doc.getField("id")), ex); NbBundle.getMessage(this.getClass(), "Server.addDoc.exception.msg", doc.getField("id")), ex); //NON-NLS
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.SEVERE, "Could not add document to index via update handler: " + doc.getField("id"), ex); logger.log(Level.SEVERE, "Could not add document to index via update handler: " + doc.getField("id"), ex); //NON-NLS
throw new KeywordSearchModuleException( throw new KeywordSearchModuleException(
NbBundle.getMessage(this.getClass(), "Server.addDoc.exception.msg2", doc.getField("id")), ex); NbBundle.getMessage(this.getClass(), "Server.addDoc.exception.msg2", doc.getField("id")), ex); //NON-NLS
} }
} }
@ -1006,7 +1006,7 @@ public class Server {
try { try {
return (String) solrCore.query(q).getResults().get(0).getFieldValue(Schema.CONTENT.toString()); return (String) solrCore.query(q).getResults().get(0).getFieldValue(Schema.CONTENT.toString());
} catch (SolrServerException ex) { } catch (SolrServerException ex) {
logger.log(Level.WARNING, "Error getting content from Solr", ex); logger.log(Level.WARNING, "Error getting content from Solr", ex); //NON-NLS
return null; return null;
} }
} }

View File

@ -49,7 +49,7 @@ class TermComponentQuery implements KeywordSearchQuery {
private static final int TERMS_UNLIMITED = -1; private static final int TERMS_UNLIMITED = -1;
//corresponds to field in Solr schema, analyzed with white-space tokenizer only //corresponds to field in Solr schema, analyzed with white-space tokenizer only
private static final String TERMS_SEARCH_FIELD = Server.Schema.CONTENT_WS.toString(); private static final String TERMS_SEARCH_FIELD = Server.Schema.CONTENT_WS.toString();
private static final String TERMS_HANDLER = "/terms"; private static final String TERMS_HANDLER = "/terms"; //NON-NLS
private static final int TERMS_TIMEOUT = 90 * 1000; //in ms private static final int TERMS_TIMEOUT = 90 * 1000; //in ms
private static Logger logger = Logger.getLogger(TermComponentQuery.class.getName()); private static Logger logger = Logger.getLogger(TermComponentQuery.class.getName());
private String termsQuery; private String termsQuery;
@ -126,7 +126,7 @@ class TermComponentQuery implements KeywordSearchQuery {
q.setRequestHandler(TERMS_HANDLER); q.setRequestHandler(TERMS_HANDLER);
q.setTerms(true); q.setTerms(true);
q.setTermsLimit(TERMS_UNLIMITED); q.setTermsLimit(TERMS_UNLIMITED);
q.setTermsRegexFlag("case_insensitive"); q.setTermsRegexFlag("case_insensitive"); //NON-NLS
//q.setTermsLimit(200); //q.setTermsLimit(200);
//q.setTermsRegexFlag(regexFlag); //q.setTermsRegexFlag(regexFlag);
//q.setTermsRaw(true); //q.setTermsRaw(true);
@ -148,7 +148,7 @@ class TermComponentQuery implements KeywordSearchQuery {
List<Term> termsCol = tr.getTerms(TERMS_SEARCH_FIELD); List<Term> termsCol = tr.getTerms(TERMS_SEARCH_FIELD);
return termsCol; return termsCol;
} catch (KeywordSearchModuleException ex) { } catch (KeywordSearchModuleException ex) {
logger.log(Level.WARNING, "Error executing the regex terms query: " + termsQuery, ex); logger.log(Level.WARNING, "Error executing the regex terms query: " + termsQuery, ex); //NON-NLS
return null; //no need to create result view, just display error dialog return null; //no need to create result view, just display error dialog
} }
} }
@ -180,7 +180,7 @@ class TermComponentQuery implements KeywordSearchQuery {
bba = newFsHit.newArtifact(ARTIFACT_TYPE.TSK_KEYWORD_HIT); bba = newFsHit.newArtifact(ARTIFACT_TYPE.TSK_KEYWORD_HIT);
writeResult = new KeywordWriteResult(bba); writeResult = new KeywordWriteResult(bba);
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.WARNING, "Error adding bb artifact for keyword hit", e); logger.log(Level.WARNING, "Error adding bb artifact for keyword hit", e); //NON-NLS
return null; return null;
} }
@ -204,7 +204,7 @@ class TermComponentQuery implements KeywordSearchQuery {
writeResult.add(attributes); writeResult.add(attributes);
return writeResult; return writeResult;
} catch (TskException e) { } catch (TskException e) {
logger.log(Level.WARNING, "Error adding bb attributes for terms search artifact", e); logger.log(Level.WARNING, "Error adding bb attributes for terms search artifact", e); //NON-NLS
} }
return null; return null;
@ -217,7 +217,7 @@ class TermComponentQuery implements KeywordSearchQuery {
final SolrQuery q = createQuery(); final SolrQuery q = createQuery();
q.setShowDebugInfo(DEBUG); q.setShowDebugInfo(DEBUG);
q.setTermsLimit(MAX_TERMS_RESULTS); q.setTermsLimit(MAX_TERMS_RESULTS);
logger.log(Level.INFO, "Query: {0}", q.toString()); logger.log(Level.INFO, "Query: {0}", q.toString()); //NON-NLS
terms = executeQuery(q); terms = executeQuery(q);
int resultSize = 0; int resultSize = 0;
@ -243,16 +243,16 @@ class TermComponentQuery implements KeywordSearchQuery {
} }
results.put(term.getTerm(), new ArrayList<>(filesResults)); results.put(term.getTerm(), new ArrayList<>(filesResults));
} catch (NoOpenCoreException e) { } catch (NoOpenCoreException e) {
logger.log(Level.WARNING, "Error executing Solr query,", e); logger.log(Level.WARNING, "Error executing Solr query,", e); //NON-NLS
throw e; throw e;
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.log(Level.WARNING, "Error executing Solr query,", e); logger.log(Level.WARNING, "Error executing Solr query,", e); //NON-NLS
} }
} }
//TODO limit how many results we store, not to hit memory limits //TODO limit how many results we store, not to hit memory limits
logger.log(Level.INFO, "Regex # results: {0}", resultSize); logger.log(Level.INFO, "Regex # results: {0}", resultSize); //NON-NLS
return results; return results;
} }