Merge branch 'develop' of https://github.com/sleuthkit/autopsy into develop

This commit is contained in:
Nick Davis 2014-03-12 12:06:06 -04:00
commit d52a765f43
137 changed files with 1748 additions and 1631 deletions

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
OpenIDE-Module: org.sleuthkit.autopsy.core/9 OpenIDE-Module: org.sleuthkit.autopsy.core/9
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/core/Bundle.properties OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/core/Bundle.properties
OpenIDE-Module-Layer: org/sleuthkit/autopsy/core/layer.xml OpenIDE-Module-Layer: org/sleuthkit/autopsy/core/layer.xml
OpenIDE-Module-Implementation-Version: 9 OpenIDE-Module-Implementation-Version: 10
OpenIDE-Module-Requires: org.openide.windows.WindowManager, org.netbeans.api.javahelp.Help OpenIDE-Module-Requires: org.openide.windows.WindowManager, org.netbeans.api.javahelp.Help
AutoUpdate-Show-In-Client: true AutoUpdate-Show-In-Client: true
AutoUpdate-Essential-Module: true AutoUpdate-Essential-Module: true

View File

@ -6,5 +6,5 @@ license.file=../LICENSE-2.0.txt
nbm.homepage=http://www.sleuthkit.org/ nbm.homepage=http://www.sleuthkit.org/
nbm.module.author=Brian Carrier nbm.module.author=Brian Carrier
nbm.needs.restart=true nbm.needs.restart=true
spec.version.base=7.0 spec.version.base=7.1

View File

@ -194,6 +194,7 @@
<package>org.sleuthkit.autopsy.actions</package> <package>org.sleuthkit.autopsy.actions</package>
<package>org.sleuthkit.autopsy.casemodule</package> <package>org.sleuthkit.autopsy.casemodule</package>
<package>org.sleuthkit.autopsy.casemodule.services</package> <package>org.sleuthkit.autopsy.casemodule.services</package>
<package>org.sleuthkit.autopsy.contentviewers</package>
<package>org.sleuthkit.autopsy.core</package> <package>org.sleuthkit.autopsy.core</package>
<package>org.sleuthkit.autopsy.corecomponentinterfaces</package> <package>org.sleuthkit.autopsy.corecomponentinterfaces</package>
<package>org.sleuthkit.autopsy.corecomponents</package> <package>org.sleuthkit.autopsy.corecomponents</package>
@ -206,14 +207,14 @@
<package>org.sleuthkit.autopsy.report</package> <package>org.sleuthkit.autopsy.report</package>
<package>org.sleuthkit.datamodel</package> <package>org.sleuthkit.datamodel</package>
</public-packages> </public-packages>
<class-path-extension>
<runtime-relative-path>ext/sqlite-jdbc-3.8.0-SNAPSHOT.jar</runtime-relative-path>
<binary-origin>release/modules/ext/sqlite-jdbc-3.8.0-SNAPSHOT.jar</binary-origin>
</class-path-extension>
<class-path-extension> <class-path-extension>
<runtime-relative-path>ext/Tsk_DataModel.jar</runtime-relative-path> <runtime-relative-path>ext/Tsk_DataModel.jar</runtime-relative-path>
<binary-origin>release/modules/ext/Tsk_DataModel.jar</binary-origin> <binary-origin>release/modules/ext/Tsk_DataModel.jar</binary-origin>
</class-path-extension> </class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/sqlite-jdbc-3.8.0-SNAPSHOT.jar</runtime-relative-path>
<binary-origin>release/modules/ext/sqlite-jdbc-3.8.0-SNAPSHOT.jar</binary-origin>
</class-path-extension>
</data> </data>
</configuration> </configuration>
</project> </project>

View File

@ -109,6 +109,7 @@
</Properties> </Properties>
<AuxValues> <AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;String&gt;()"/> <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;String&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues> </AuxValues>
</Component> </Component>
<Component class="javax.swing.JLabel" name="tagLabel"> <Component class="javax.swing.JLabel" name="tagLabel">

View File

@ -245,7 +245,7 @@ public class GetTagNameAndCommentDialog extends JDialog {
private javax.swing.JTextField commentText; private javax.swing.JTextField commentText;
private javax.swing.JButton newTagButton; private javax.swing.JButton newTagButton;
private javax.swing.JButton okButton; private javax.swing.JButton okButton;
private javax.swing.JComboBox tagCombo; private javax.swing.JComboBox<String> tagCombo;
private javax.swing.JLabel tagLabel; private javax.swing.JLabel tagLabel;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
} }

View File

@ -18,7 +18,6 @@
*/ */
package org.sleuthkit.autopsy.casemodule; package org.sleuthkit.autopsy.casemodule;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -42,21 +41,17 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
/** /**
* visual component for the first panel of add image wizard. * visual component for the first panel of add image wizard. Allows the user to
* Allows the user to choose the data source type and then select the data source * choose the data source type and then select the data source
* *
*/ */
final class AddImageWizardChooseDataSourceVisual extends JPanel { final class AddImageWizardChooseDataSourceVisual extends JPanel {
static final Logger logger = Logger.getLogger(AddImageWizardChooseDataSourceVisual.class.getName()); static final Logger logger = Logger.getLogger(AddImageWizardChooseDataSourceVisual.class.getName());
private AddImageWizardChooseDataSourcePanel wizPanel; private AddImageWizardChooseDataSourcePanel wizPanel;
private JPanel currentPanel; private JPanel currentPanel;
private Map<String, DataSourceProcessor> datasourceProcessorsMap = new HashMap<String, DataSourceProcessor>(); private Map<String, DataSourceProcessor> datasourceProcessorsMap = new HashMap<>();
List<String> coreDSPTypes = new ArrayList<>();
List<String> coreDSPTypes = new ArrayList<String>();
/** /**
* Creates new form AddImageVisualPanel1 * Creates new form AddImageVisualPanel1
@ -87,21 +82,20 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
coreDSPTypes.add(LocalDiskDSProcessor.getType()); coreDSPTypes.add(LocalDiskDSProcessor.getType());
coreDSPTypes.add(LocalFilesDSProcessor.getType()); coreDSPTypes.add(LocalFilesDSProcessor.getType());
for(String dspType:coreDSPTypes){ for (String dspType : coreDSPTypes) {
typeComboBox.addItem(dspType); typeComboBox.addItem(dspType);
} }
// now add any addtional DSPs that haven't already been added // now add any addtional DSPs that haven't already been added
for(String dspType:dspTypes){ for (String dspType : dspTypes) {
if (!coreDSPTypes.contains(dspType)) { if (!coreDSPTypes.contains(dspType)) {
typeComboBox.addItem(dspType); typeComboBox.addItem(dspType);
} }
} }
// set a custom renderer that draws a separator at the end of the core DSPs in the combobox typeComboBox.setRenderer(new ComboboxSeparatorRenderer(typeComboBox.getRenderer()) {
typeComboBox.setRenderer(new ComboboxSeparatorRenderer(typeComboBox.getRenderer()){
@Override @Override
protected boolean addSeparatorAfter(JList list, Object value, int index){ protected boolean addSeparatorAfter(JList list, Object value, int index) {
return (index == coreDSPTypes.size() - 1); return (index == coreDSPTypes.size() - 1);
} }
}); });
@ -119,21 +113,20 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
private void discoverDataSourceProcessors() { private void discoverDataSourceProcessors() {
for (DataSourceProcessor dsProcessor: Lookup.getDefault().lookupAll(DataSourceProcessor.class)) { for (DataSourceProcessor dsProcessor : Lookup.getDefault().lookupAll(DataSourceProcessor.class)) {
if (!datasourceProcessorsMap.containsKey(dsProcessor.getDataSourceType()) ) { if (!datasourceProcessorsMap.containsKey(dsProcessor.getDataSourceType())) {
datasourceProcessorsMap.put(dsProcessor.getDataSourceType(), dsProcessor); datasourceProcessorsMap.put(dsProcessor.getDataSourceType(), dsProcessor);
} } else {
else { logger.log(Level.SEVERE, "discoverDataSourceProcessors(): A DataSourceProcessor already exists for type = {0}", dsProcessor.getDataSourceType());
logger.log(Level.SEVERE, "discoverDataSourceProcessors(): A DataSourceProcessor already exists for type = " + dsProcessor.getDataSourceType() );
} }
} }
} }
private void dspSelectionChanged() { private void dspSelectionChanged() {
// update the current panel to selection // update the current panel to selection
currentPanel = getCurrentDSProcessor().getPanel(); currentPanel = getCurrentDSProcessor().getPanel();
updateCurrentPanel(currentPanel); updateCurrentPanel(currentPanel);
} }
/** /**
@ -144,7 +137,7 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
private void updateCurrentPanel(JPanel panel) { private void updateCurrentPanel(JPanel panel) {
currentPanel = panel; currentPanel = panel;
typePanel.removeAll(); typePanel.removeAll();
typePanel.add((JPanel) currentPanel, BorderLayout.CENTER); typePanel.add(currentPanel, BorderLayout.CENTER);
typePanel.validate(); typePanel.validate();
typePanel.repaint(); typePanel.repaint();
currentPanel.addPropertyChangeListener(new PropertyChangeListener() { currentPanel.addPropertyChangeListener(new PropertyChangeListener() {
@ -162,9 +155,11 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
updateUI(null); updateUI(null);
} }
/** /**
* Returns the currently selected DS Processor * Returns the currently selected DS Processor
* @return DataSourceProcessor the DataSourceProcessor corresponding to the data source type selected in the combobox *
* @return DataSourceProcessor the DataSourceProcessor corresponding to the
* data source type selected in the combobox
*/ */
protected DataSourceProcessor getCurrentDSProcessor() { protected DataSourceProcessor getCurrentDSProcessor() {
// get the type of the currently selected panel and then look up // get the type of the currently selected panel and then look up
@ -187,7 +182,6 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
return NbBundle.getMessage(this.getClass(), "AddImageWizardChooseDataSourceVisual.getName.text"); return NbBundle.getMessage(this.getClass(), "AddImageWizardChooseDataSourceVisual.getName.text");
} }
/** /**
* This method is called from within the constructor to initialize the form. * This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always * WARNING: Do NOT modify this code. The content of this method is always
@ -310,25 +304,27 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
this.wizPanel.enableNextButton(getCurrentDSProcessor().isPanelValid()); this.wizPanel.enableNextButton(getCurrentDSProcessor().isPanelValid());
} }
public abstract class ComboboxSeparatorRenderer implements ListCellRenderer {
public abstract class ComboboxSeparatorRenderer implements ListCellRenderer{
private ListCellRenderer delegate; private ListCellRenderer delegate;
private JPanel separatorPanel = new JPanel(new BorderLayout()); private JPanel separatorPanel = new JPanel(new BorderLayout());
private JSeparator separator = new JSeparator(); private JSeparator separator = new JSeparator();
public ComboboxSeparatorRenderer(ListCellRenderer delegate){ public ComboboxSeparatorRenderer(ListCellRenderer delegate) {
this.delegate = delegate; this.delegate = delegate;
} }
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus){ @Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
Component comp = delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); Component comp = delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if(index!=-1 && addSeparatorAfter(list, value, index)){ if (index != -1 && addSeparatorAfter(list, value, index)) {
separatorPanel.removeAll(); separatorPanel.removeAll();
separatorPanel.add(comp, BorderLayout.CENTER); separatorPanel.add(comp, BorderLayout.CENTER);
separatorPanel.add(separator, BorderLayout.SOUTH); separatorPanel.add(separator, BorderLayout.SOUTH);
return separatorPanel; return separatorPanel;
}else } else {
return comp; return comp;
}
} }
protected abstract boolean addSeparatorAfter(JList list, Object value, int index); protected abstract boolean addSeparatorAfter(JList list, Object value, int index);

View File

@ -80,6 +80,10 @@
<StringArray count="0"/> <StringArray count="0"/>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;LocalDisk&gt;"/>
</AuxValues>
</Component> </Component>
<Component class="javax.swing.JLabel" name="errorLabel"> <Component class="javax.swing.JLabel" name="errorLabel">
<Properties> <Properties>

View File

@ -50,12 +50,12 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
/** /**
* ImageTypePanel for adding a local disk or partition such as PhysicalDrive0 or C:. * ImageTypePanel for adding a local disk or partition such as PhysicalDrive0 or C:.
*/ */
class LocalDiskPanel extends JPanel { final class LocalDiskPanel extends JPanel {
private static final Logger logger = Logger.getLogger(LocalDiskPanel.class.getName()); private static final Logger logger = Logger.getLogger(LocalDiskPanel.class.getName());
private static LocalDiskPanel instance; private static LocalDiskPanel instance;
private PropertyChangeSupport pcs = null; private PropertyChangeSupport pcs = null;
private List<LocalDisk> disks = new ArrayList<LocalDisk>(); private List<LocalDisk> disks;
private LocalDiskModel model; private LocalDiskModel model;
private boolean enableNext = false; private boolean enableNext = false;
@ -63,6 +63,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
* Creates new form LocalDiskPanel * Creates new form LocalDiskPanel
*/ */
public LocalDiskPanel() { public LocalDiskPanel() {
this.disks = new ArrayList<>();
initComponents(); initComponents();
customInit(); customInit();
@ -101,7 +102,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
private void initComponents() { private void initComponents() {
diskLabel = new javax.swing.JLabel(); diskLabel = new javax.swing.JLabel();
diskComboBox = new javax.swing.JComboBox(); diskComboBox = new javax.swing.JComboBox<>();
errorLabel = new javax.swing.JLabel(); errorLabel = new javax.swing.JLabel();
timeZoneLabel = new javax.swing.JLabel(); timeZoneLabel = new javax.swing.JLabel();
timeZoneComboBox = new javax.swing.JComboBox<String>(); timeZoneComboBox = new javax.swing.JComboBox<String>();
@ -165,7 +166,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel descLabel; private javax.swing.JLabel descLabel;
private javax.swing.JComboBox diskComboBox; private javax.swing.JComboBox<LocalDisk> diskComboBox;
private javax.swing.JLabel diskLabel; private javax.swing.JLabel diskLabel;
private javax.swing.JLabel errorLabel; private javax.swing.JLabel errorLabel;
private javax.swing.JCheckBox noFatOrphansCheckbox; private javax.swing.JCheckBox noFatOrphansCheckbox;
@ -296,14 +297,13 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
private Object selected; private Object selected;
private boolean ready = false; private boolean ready = false;
private volatile boolean loadingDisks = false; private volatile boolean loadingDisks = false;
List<LocalDisk> physical = new ArrayList<LocalDisk>(); List<LocalDisk> physical = new ArrayList<>();
List<LocalDisk> partitions = new ArrayList<LocalDisk>(); List<LocalDisk> partitions = new ArrayList<>();
//private String SELECT = "Select a local disk:"; //private String SELECT = "Select a local disk:";
private String LOADING = NbBundle.getMessage(this.getClass(), "LocalDiskPanel.localDiskModel.loading.msg"); private String LOADING = NbBundle.getMessage(this.getClass(), "LocalDiskPanel.localDiskModel.loading.msg");
LocalDiskThread worker = null; LocalDiskThread worker = null;
private void loadDisks() { private void loadDisks() {
// if there is a worker already building the lists, then cancel it first. // if there is a worker already building the lists, then cancel it first.
@ -313,9 +313,9 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
// Clear the lists // Clear the lists
errorLabel.setText(""); errorLabel.setText("");
disks = new ArrayList<LocalDisk>(); disks = new ArrayList<>();
physical = new ArrayList<LocalDisk>(); physical = new ArrayList<>();
partitions = new ArrayList<LocalDisk>(); partitions = new ArrayList<>();
diskComboBox.setEnabled(false); diskComboBox.setEnabled(false);
ready = false; ready = false;
enableNext = false; enableNext = false;
@ -330,7 +330,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
@Override @Override
public void setSelectedItem(Object anItem) { public void setSelectedItem(Object anItem) {
if(ready) { if(ready) {
selected = anItem; selected = (LocalDisk) anItem;
enableNext = true; enableNext = true;
try { try {
@ -384,13 +384,14 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
label.setForeground(list.getForeground()); label.setForeground(list.getForeground());
} }
if(value !=null && value.equals(LOADING)) { String localDiskString = value.toString();
if(localDiskString.equals(LOADING)) {
Font font = new Font(label.getFont().getName(), Font.ITALIC, label.getFont().getSize()); Font font = new Font(label.getFont().getName(), Font.ITALIC, label.getFont().getSize());
label.setText(LOADING); label.setText(LOADING);
label.setFont(font); label.setFont(font);
label.setBackground(Color.GRAY); label.setBackground(Color.GRAY);
} else { } else {
label.setText(value != null ? value.toString() : ""); label.setText(value.toString());
} }
label.setOpaque(true); label.setOpaque(true);
label.setBorder(new EmptyBorder(2, 2, 2, 2)); label.setBorder(new EmptyBorder(2, 2, 2, 2));

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2012 Basis Technology Corp. * Copyright 2012-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -18,7 +18,6 @@
*/ */
package org.sleuthkit.autopsy.casemodule; package org.sleuthkit.autopsy.casemodule;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
@ -31,34 +30,26 @@ import java.io.File;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.GeneralFilter;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
class MissingImageDialog extends javax.swing.JDialog {
class MissingImageDialog extends javax.swing.JDialog {
private static final Logger logger = Logger.getLogger(MissingImageDialog.class.getName()); private static final Logger logger = Logger.getLogger(MissingImageDialog.class.getName());
long obj_id; long obj_id;
SleuthkitCase db; SleuthkitCase db;
static final GeneralFilter rawFilter = new GeneralFilter(GeneralFilter.RAW_IMAGE_EXTS, GeneralFilter.RAW_IMAGE_DESC); static final GeneralFilter rawFilter = new GeneralFilter(GeneralFilter.RAW_IMAGE_EXTS, GeneralFilter.RAW_IMAGE_DESC);
static final GeneralFilter encaseFilter = new GeneralFilter(GeneralFilter.ENCASE_IMAGE_EXTS, GeneralFilter.ENCASE_IMAGE_DESC); static final GeneralFilter encaseFilter = new GeneralFilter(GeneralFilter.ENCASE_IMAGE_EXTS, GeneralFilter.ENCASE_IMAGE_DESC);
static final List<String> allExt = new ArrayList<String>(); static final List<String> allExt = new ArrayList<String>();
static { static {
allExt.addAll(GeneralFilter.RAW_IMAGE_EXTS); allExt.addAll(GeneralFilter.RAW_IMAGE_EXTS);
allExt.addAll(GeneralFilter.ENCASE_IMAGE_EXTS); allExt.addAll(GeneralFilter.ENCASE_IMAGE_EXTS);
} }
static final String allDesc = NbBundle.getMessage(MissingImageDialog.class, "MissingImageDialog.allDesc.text"); static final String allDesc = NbBundle.getMessage(MissingImageDialog.class, "MissingImageDialog.allDesc.text");
static final GeneralFilter allFilter = new GeneralFilter(allExt, allDesc); static final GeneralFilter allFilter = new GeneralFilter(allExt, allDesc);
private JFileChooser fc = new JFileChooser(); private JFileChooser fc = new JFileChooser();
private MissingImageDialog(long obj_id, SleuthkitCase db) { private MissingImageDialog(long obj_id, SleuthkitCase db) {
@ -98,7 +89,7 @@ import org.sleuthkit.datamodel.TskCoreException;
private void customInit() { private void customInit() {
selectButton.setEnabled(false); selectButton.setEnabled(false);
} }
private void display() { private void display() {
@ -277,13 +268,11 @@ import org.sleuthkit.datamodel.TskCoreException;
private void pathNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pathNameTextFieldActionPerformed private void pathNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pathNameTextFieldActionPerformed
// TODO add your handling code here: // TODO add your handling code here:
updateSelectButton(); updateSelectButton();
}//GEN-LAST:event_pathNameTextFieldActionPerformed }//GEN-LAST:event_pathNameTextFieldActionPerformed
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
String oldText = pathNameTextField.getText(); String oldText = pathNameTextField.getText();
// set the current directory of the FileChooser if the ImagePath Field is valid // set the current directory of the FileChooser if the ImagePath Field is valid
@ -299,9 +288,8 @@ import org.sleuthkit.datamodel.TskCoreException;
} }
//pcs.firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.FOCUS_NEXT.toString(), false, true); //pcs.firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.FOCUS_NEXT.toString(), false, true);
updateSelectButton(); updateSelectButton();
}//GEN-LAST:event_browseButtonActionPerformed }//GEN-LAST:event_browseButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton browseButton; private javax.swing.JButton browseButton;
private javax.swing.JPanel buttonPanel; private javax.swing.JPanel buttonPanel;
@ -318,15 +306,13 @@ import org.sleuthkit.datamodel.TskCoreException;
// //
void cancel() { void cancel() {
int ret = JOptionPane.showConfirmDialog(null, int ret = JOptionPane.showConfirmDialog(null,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"MissingImageDialog.confDlg.noFileSel.msg"), "MissingImageDialog.confDlg.noFileSel.msg"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"MissingImageDialog.confDlg.noFileSel.title"), "MissingImageDialog.confDlg.noFileSel.title"),
JOptionPane.YES_NO_OPTION); JOptionPane.YES_NO_OPTION);
if (ret == JOptionPane.YES_OPTION) { if (ret == JOptionPane.YES_OPTION) {
this.dispose(); this.dispose();
} }
} }
} }

View File

@ -120,7 +120,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
* Initialize panels representing individual wizard's steps and sets * Initialize panels representing individual wizard's steps and sets
* various properties for them influencing wizard appearance. * various properties for them influencing wizard appearance.
*/ */
@SuppressWarnings({"unchecked"}) @SuppressWarnings({"unchecked", "rawtypes"})
private WizardDescriptor.Panel<WizardDescriptor>[] getPanels() { private WizardDescriptor.Panel<WizardDescriptor>[] getPanels() {
if (panels == null) { if (panels == null) {
panels = new WizardDescriptor.Panel[]{ panels = new WizardDescriptor.Panel[]{

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -21,8 +21,6 @@ package org.sleuthkit.autopsy.contentviewers;
import javax.swing.JTextPane; import javax.swing.JTextPane;
import javax.swing.text.html.HTMLEditorKit; import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.StyleSheet; import javax.swing.text.html.StyleSheet;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.TskCoreException;
/** /**
* *

View File

@ -13,7 +13,8 @@
<attr name="Menu\File\Separator4.instance_hidden\position" intvalue="400"/>--> <attr name="Menu\File\Separator4.instance_hidden\position" intvalue="400"/>-->
<folder name="OptionsDialog"> <folder name="OptionsDialog">
<folder name="General.instance_hidden"/> <!--<folder name="General.instance_hidden"/>-->
<file name="General.instance"/>
<folder name="Keymaps.instance_hidden"/> <!-- Keymap --> <folder name="Keymaps.instance_hidden"/> <!-- Keymap -->
<folder name="Java.instance_hidden"/> <folder name="Java.instance_hidden"/>
<folder name="Advanced.instance_hidden"/> <!-- Miscellaneous --> <folder name="Advanced.instance_hidden"/> <!-- Miscellaneous -->

View File

@ -284,6 +284,10 @@
<Events> <Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="languageComboActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="languageComboActionPerformed"/>
</Events> </Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;SCRIPT&gt;"/>
</AuxValues>
</Component> </Component>
<Component class="javax.swing.JLabel" name="languageLabel"> <Component class="javax.swing.JLabel" name="languageLabel">
<Properties> <Properties>

View File

@ -116,7 +116,7 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC
prevPageButton = new javax.swing.JButton(); prevPageButton = new javax.swing.JButton();
goToPageLabel = new javax.swing.JLabel(); goToPageLabel = new javax.swing.JLabel();
goToPageTextField = new javax.swing.JTextField(); goToPageTextField = new javax.swing.JTextField();
languageCombo = new javax.swing.JComboBox(); languageCombo = new javax.swing.JComboBox<>();
languageLabel = new javax.swing.JLabel(); languageLabel = new javax.swing.JLabel();
copyMenuItem.setText(org.openide.util.NbBundle.getMessage(DataContentViewerString.class, "DataContentViewerString.copyMenuItem.text")); // NOI18N copyMenuItem.setText(org.openide.util.NbBundle.getMessage(DataContentViewerString.class, "DataContentViewerString.copyMenuItem.text")); // NOI18N
@ -316,7 +316,7 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC
private javax.swing.JTextField goToPageTextField; private javax.swing.JTextField goToPageTextField;
private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JComboBox languageCombo; private javax.swing.JComboBox<SCRIPT> languageCombo;
private javax.swing.JLabel languageLabel; private javax.swing.JLabel languageLabel;
private javax.swing.JButton nextPageButton; private javax.swing.JButton nextPageButton;
private javax.swing.JLabel ofLabel; private javax.swing.JLabel ofLabel;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -57,13 +57,12 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
// service provider when DataResultViewers can be made compatible with node // service provider when DataResultViewers can be made compatible with node
// multiple selection actions. // multiple selection actions.
//@ServiceProvider(service = DataResultViewer.class) //@ServiceProvider(service = DataResultViewer.class)
public class DataResultViewerTable extends AbstractDataResultViewer { public class DataResultViewerTable extends AbstractDataResultViewer {
private String firstColumnLabel = NbBundle.getMessage(DataResultViewerTable.class, "DataResultViewerTable.firstColLbl"); private String firstColumnLabel = NbBundle.getMessage(DataResultViewerTable.class, "DataResultViewerTable.firstColLbl");
private Set<Property> propertiesAcc = new LinkedHashSet<>(); private Set<Property> propertiesAcc = new LinkedHashSet<>();
private static final Logger logger = Logger.getLogger(DataResultViewerTable.class.getName());
private final DummyNodeListener dummyNodeListener = new DummyNodeListener(); private final DummyNodeListener dummyNodeListener = new DummyNodeListener();
private static final String DUMMY_NODE_DISPLAY_NAME = NbBundle.getMessage(DataResultViewerTable.class, "DataResultViewerTable.dummyNodeDisplayName"); private static final String DUMMY_NODE_DISPLAY_NAME = NbBundle.getMessage(DataResultViewerTable.class, "DataResultViewerTable.dummyNodeDisplayName");
/** /**
* Creates a DataResultViewerTable object that is compatible with node * Creates a DataResultViewerTable object that is compatible with node
@ -179,6 +178,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
* @param parent Node with at least one child to get properties from * @param parent Node with at least one child to get properties from
* @return Properties, * @return Properties,
*/ */
@SuppressWarnings("rawtypes")
private Node.Property[] getAllChildPropertyHeaders(Node parent) { private Node.Property[] getAllChildPropertyHeaders(Node parent) {
Node firstChild = parent.getChildren().getNodeAt(0); Node firstChild = parent.getChildren().getNodeAt(0);
@ -243,7 +243,9 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
} }
/** /**
* Thread note: Make sure to run this in the EDT as it causes GUI operations. * Thread note: Make sure to run this in the EDT as it causes GUI
* operations.
*
* @param selectedNode * @param selectedNode
*/ */
@Override @Override
@ -303,10 +305,10 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
return; return;
} }
propertiesAcc.clear(); propertiesAcc.clear();
DataResultViewerTable.this.getAllChildPropertyHeadersRec(root, 100); DataResultViewerTable.this.getAllChildPropertyHeadersRec(root, 100);
List<Node.Property> props = new ArrayList<Node.Property>(propertiesAcc); List<Node.Property> props = new ArrayList<>(propertiesAcc);
if (props.size() > 0) { if (props.size() > 0) {
Node.Property prop = props.remove(0); Node.Property prop = props.remove(0);
((DefaultOutlineModel) ov.getOutline().getOutlineModel()).setNodesColumnLabel(prop.getDisplayName()); ((DefaultOutlineModel) ov.getOutline().getOutlineModel()).setNodesColumnLabel(prop.getDisplayName());
@ -346,13 +348,13 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
int totalColumns = props.size(); int totalColumns = props.size();
//int scrollWidth = ttv.getWidth(); //int scrollWidth = ttv.getWidth();
int margin = 4; int margin = 4;
int startColumn = 1; int startColumn = 1;
// If there is only one column (which was removed from props above) // If there is only one column (which was removed from props above)
// Just let the table resize itself. // Just let the table resize itself.
ov.getOutline().setAutoResizeMode((props.size() > 0) ? JTable.AUTO_RESIZE_OFF : JTable.AUTO_RESIZE_ALL_COLUMNS); ov.getOutline().setAutoResizeMode((props.size() > 0) ? JTable.AUTO_RESIZE_OFF : JTable.AUTO_RESIZE_ALL_COLUMNS);
@ -396,15 +398,13 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
break; break;
} }
PropertySet[] propertySets = child.getPropertySets(); PropertySet[] propertySets = child.getPropertySets();
if (propertySets.length > 0) if (propertySets.length > 0) {
{
Property[] properties = propertySets[0].getProperties(); Property[] properties = propertySets[0].getProperties();
rowValues[rowCount] = new Object[properties.length]; rowValues[rowCount] = new Object[properties.length];
for (int j = 0; j < properties.length; ++j) { for (int j = 0; j < properties.length; ++j) {
try { try {
rowValues[rowCount][j] = properties[j].getValue(); rowValues[rowCount][j] = properties[j].getValue();
} } catch (IllegalAccessException | InvocationTargetException ignore) {
catch (IllegalAccessException | InvocationTargetException ignore) {
rowValues[rowCount][j] = "n/a"; rowValues[rowCount][j] = "n/a";
} }
} }
@ -435,6 +435,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
* @param table the object table * @param table the object table
* @return max the maximum width of the column * @return max the maximum width of the column
*/ */
@SuppressWarnings("rawtypes")
private int getMaxColumnWidth(int index, FontMetrics metrics, int margin, int padding, List<Node.Property> header, Object[][] table) { private int getMaxColumnWidth(int index, FontMetrics metrics, int margin, int padding, List<Node.Property> header, Object[][] table) {
// set the tree (the node / names column) width // set the tree (the node / names column) width
String headerName = header.get(index - 1).getDisplayName(); String headerName = header.get(index - 1).getDisplayName();
@ -487,6 +488,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
} }
private class DummyNodeListener implements NodeListener { private class DummyNodeListener implements NodeListener {
private volatile boolean load = true; private volatile boolean load = true;
public void reset() { public void reset() {

View File

@ -16,7 +16,7 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="thumbnailScrollPanel" max="32767" attributes="0"/> <Component id="thumbnailScrollPanel" pref="642" max="32767" attributes="0"/>
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
@ -201,18 +201,17 @@
</Component> </Component>
<Component class="javax.swing.JComboBox" name="thumbnailSizeComboBox"> <Component class="javax.swing.JComboBox" name="thumbnailSizeComboBox">
<Properties> <Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<StringArray count="3"> <Connection code="new javax.swing.DefaultComboBoxModel&lt;String&gt;(new String[] { &quot;Small Thumbnails&quot;, &quot;Medium Thumbnails&quot;, &quot;Large Thumbnails&quot; })" type="code"/>
<StringItem index="0" value="Small Thumbnails"/>
<StringItem index="1" value="Medium Thumbnails"/>
<StringItem index="2" value="Large Thumbnails"/>
</StringArray>
</Property> </Property>
<Property name="selectedIndex" type="int" value="1"/>
</Properties> </Properties>
<Events> <Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="thumbnailSizeComboBoxActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="thumbnailSizeComboBoxActionPerformed"/>
</Events> </Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component> </Component>
</SubComponents> </SubComponents>
</Form> </Form>

View File

@ -121,7 +121,7 @@ import org.sleuthkit.datamodel.TskCoreException;
filePathLabel = new javax.swing.JLabel(); filePathLabel = new javax.swing.JLabel();
goToPageLabel = new javax.swing.JLabel(); goToPageLabel = new javax.swing.JLabel();
goToPageField = new javax.swing.JTextField(); goToPageField = new javax.swing.JTextField();
thumbnailSizeComboBox = new javax.swing.JComboBox(); thumbnailSizeComboBox = new javax.swing.JComboBox<>();
thumbnailScrollPanel.setPreferredSize(new java.awt.Dimension(582, 348)); thumbnailScrollPanel.setPreferredSize(new java.awt.Dimension(582, 348));
@ -171,8 +171,7 @@ import org.sleuthkit.datamodel.TskCoreException;
} }
}); });
thumbnailSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Small Thumbnails", "Medium Thumbnails", "Large Thumbnails" })); thumbnailSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "Small Thumbnails", "Medium Thumbnails", "Large Thumbnails" }));
thumbnailSizeComboBox.setSelectedIndex(1);
thumbnailSizeComboBox.addActionListener(new java.awt.event.ActionListener() { thumbnailSizeComboBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
thumbnailSizeComboBoxActionPerformed(evt); thumbnailSizeComboBoxActionPerformed(evt);
@ -183,7 +182,7 @@ import org.sleuthkit.datamodel.TskCoreException;
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(thumbnailScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(thumbnailScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 642, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -289,7 +288,7 @@ import org.sleuthkit.datamodel.TskCoreException;
private javax.swing.JButton pagePrevButton; private javax.swing.JButton pagePrevButton;
private javax.swing.JLabel pagesLabel; private javax.swing.JLabel pagesLabel;
private javax.swing.JScrollPane thumbnailScrollPanel; private javax.swing.JScrollPane thumbnailScrollPanel;
private javax.swing.JComboBox thumbnailSizeComboBox; private javax.swing.JComboBox<String> thumbnailSizeComboBox;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
@Override @Override

View File

@ -1,3 +1,21 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.corecomponents; package org.sleuthkit.autopsy.corecomponents;
import java.io.File; import java.io.File;

View File

@ -1,6 +1,20 @@
/* /*
* To change this template, choose Tools | Templates * Autopsy Forensic Browser
* and open the template in the editor. *
* Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.sleuthkit.autopsy.corecomponents; package org.sleuthkit.autopsy.corecomponents;
@ -15,54 +29,60 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
@OptionsPanelController.TopLevelRegistration( @OptionsPanelController.TopLevelRegistration(categoryName = "#OptionsCategory_Name_General",
categoryName = "#OptionsCategory_Name_General", iconBase = "org/sleuthkit/autopsy/corecomponents/display-options.png",
iconBase = "org/sleuthkit/autopsy/corecomponents/general-options.png", position = 1,
position = 1, keywords = "#OptionsCategory_Keywords_General",
keywords = "#OptionsCategory_Keywords_General", keywordsCategory = "General")
keywordsCategory = "General")
// moved to Bundle
//@org.openide.util.NbBundle.Messages({"OptionsCategory_Name_General=General", "OptionsCategory_Keywords_General=general"})
public final class GeneralOptionsPanelController extends OptionsPanelController { public final class GeneralOptionsPanelController extends OptionsPanelController {
private GeneralPanel panel; private GeneralPanel panel;
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
private boolean changed; private boolean changed;
private static final Logger logger = Logger.getLogger(GeneralOptionsPanelController.class.getName()); private static final Logger logger = Logger.getLogger(GeneralOptionsPanelController.class.getName());
@Override
public void update() { public void update() {
getPanel().load(); getPanel().load();
changed = false; changed = false;
} }
@Override
public void applyChanges() { public void applyChanges() {
getPanel().store(); getPanel().store();
changed = false; changed = false;
} }
@Override
public void cancel() { public void cancel() {
// need not do anything special, if no changes have been persisted yet
} }
@Override
public boolean isValid() { public boolean isValid() {
return getPanel().valid(); return getPanel().valid();
} }
@Override
public boolean isChanged() { public boolean isChanged() {
return changed; return changed;
} }
@Override
public HelpCtx getHelpCtx() { public HelpCtx getHelpCtx() {
return null; // new HelpCtx("...ID") if you have a help set return null;
} }
@Override
public JComponent getComponent(Lookup masterLookup) { public JComponent getComponent(Lookup masterLookup) {
return getPanel(); return getPanel();
} }
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
pcs.addPropertyChangeListener(l); pcs.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
pcs.removePropertyChangeListener(l); pcs.removePropertyChangeListener(l);
} }
@ -80,8 +100,7 @@ public final class GeneralOptionsPanelController extends OptionsPanelController
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, "GeneralOptionsPanelController listener threw exception", e); logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e);
MessageNotifyUtil.Notify.show( MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"), NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
@ -90,15 +109,14 @@ public final class GeneralOptionsPanelController extends OptionsPanelController
} }
} }
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, "GeneralOptionsPanelController listener threw exception", e);
logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e); MessageNotifyUtil.Notify.show(
MessageNotifyUtil.Notify.show( NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"), NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"),
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"), MessageNotifyUtil.MessageType.ERROR);
MessageNotifyUtil.MessageType.ERROR); }
}
} }
} }

View File

@ -107,7 +107,7 @@ public class Installer extends ModuleInstall {
final String[] UI_MENU_ITEM_KEYS = new String[]{"MenuBarUI", final String[] UI_MENU_ITEM_KEYS = new String[]{"MenuBarUI",
}; };
Map<Object, Object> uiEntries = new TreeMap<Object, Object>(); Map<Object, Object> uiEntries = new TreeMap<>();
// Store the keys that deal with menu items // Store the keys that deal with menu items
for(String key : UI_MENU_ITEM_KEYS) { for(String key : UI_MENU_ITEM_KEYS) {
@ -129,7 +129,7 @@ public class Installer extends ModuleInstall {
} }
// Overwrite the Metal menu item keys to use the Aqua versions // Overwrite the Metal menu item keys to use the Aqua versions
for(Map.Entry entry : uiEntries.entrySet()) { for(Map.Entry<Object,Object> entry : uiEntries.entrySet()) {
UIManager.put(entry.getKey(), entry.getValue()); UIManager.put(entry.getKey(), entry.getValue());
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -193,10 +193,7 @@ public class ImageUtils {
* Check for the JPEG header. Since Java bytes are signed, we cast them * Check for the JPEG header. Since Java bytes are signed, we cast them
* to an int first. * to an int first.
*/ */
if (((int) (fileHeaderBuffer[0] & 0xff) == 0xff) && ((int) (fileHeaderBuffer[1] & 0xff) == 0xd8)) { return (((fileHeaderBuffer[0] & 0xff) == 0xff) && ((fileHeaderBuffer[1] & 0xff) == 0xd8));
return true;
}
return false;
} }

View File

@ -208,7 +208,7 @@ public class PlatformUtil {
* @throws IOException exception thrown if extract the file failed for IO * @throws IOException exception thrown if extract the file failed for IO
* reasons * reasons
*/ */
public static boolean extractResourceToUserConfigDir(final Class resourceClass, final String resourceFile) throws IOException { public static <T> boolean extractResourceToUserConfigDir(final Class<T> resourceClass, final String resourceFile) throws IOException {
final File userDir = new File(getUserConfigDirectory()); final File userDir = new File(getUserConfigDirectory());
final File resourceFileF = new File(userDir + File.separator + resourceFile); final File resourceFileF = new File(userDir + File.separator + resourceFile);

View File

@ -68,7 +68,7 @@ public class XMLUtil {
* For example usages, please see KeywordSearchListsXML, HashDbXML, or IngestModuleLoader. * For example usages, please see KeywordSearchListsXML, HashDbXML, or IngestModuleLoader.
* *
*/ */
public static boolean xmlIsValid(DOMSource xmlfile, Class clazz, String schemaFile) { public static <T> boolean xmlIsValid(DOMSource xmlfile, Class<T> clazz, String schemaFile) {
try{ try{
PlatformUtil.extractResourceToUserConfigDir(clazz, schemaFile); PlatformUtil.extractResourceToUserConfigDir(clazz, schemaFile);
File schemaLoc = new File(PlatformUtil.getUserConfigDirectory() + File.separator + schemaFile); File schemaLoc = new File(PlatformUtil.getUserConfigDirectory() + File.separator + schemaFile);
@ -103,7 +103,7 @@ public class XMLUtil {
* For example usages, please see KeywordSearchListsXML, HashDbXML, or IngestModuleLoader. * For example usages, please see KeywordSearchListsXML, HashDbXML, or IngestModuleLoader.
* *
*/ */
public static boolean xmlIsValid(Document doc, Class clazz, String type){ public static <T> boolean xmlIsValid(Document doc, Class<T> clazz, String type){
DOMSource dms = new DOMSource(doc); DOMSource dms = new DOMSource(doc);
return xmlIsValid(dms, clazz, type); return xmlIsValid(dms, clazz, type);
} }
@ -118,7 +118,7 @@ public class XMLUtil {
* @param xsdPath the full path to the file to validate against * @param xsdPath the full path to the file to validate against
* *
*/ */
public static Document loadDoc(Class clazz, String xmlPath, String xsdPath) { public static <T> Document loadDoc(Class<T> clazz, String xmlPath, String xsdPath) {
DocumentBuilderFactory builderFactory = DocumentBuilderFactory builderFactory =
DocumentBuilderFactory.newInstance(); DocumentBuilderFactory.newInstance();
Document ret = null; Document ret = null;
@ -154,7 +154,7 @@ public class XMLUtil {
* @param doc the document to save * @param doc the document to save
* *
*/ */
public static boolean saveDoc(Class clazz, String xmlPath, String encoding, final Document doc) { public static <T> boolean saveDoc(Class<T> clazz, String xmlPath, String encoding, final Document doc) {
TransformerFactory xf = TransformerFactory.newInstance(); TransformerFactory xf = TransformerFactory.newInstance();
xf.setAttribute("indent-number", new Integer(1)); xf.setAttribute("indent-number", new Integer(1));
boolean success = false; boolean success = false;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -189,7 +189,7 @@ public abstract class AbstractAbstractFileNode<T extends AbstractFile> extends A
try { try {
path = content.getUniquePath(); path = content.getUniquePath();
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Except while calling Content.getUniquePath() on " + content); logger.log(Level.SEVERE, "Except while calling Content.getUniquePath() on {0}", content);
} }
map.put(AbstractFilePropertyType.NAME.toString(), AbstractAbstractFileNode.getContentDisplayName(content)); map.put(AbstractFilePropertyType.NAME.toString(), AbstractAbstractFileNode.getContentDisplayName(content));
@ -217,10 +217,13 @@ public abstract class AbstractAbstractFileNode<T extends AbstractFile> extends A
static String getContentDisplayName(AbstractFile file) { static String getContentDisplayName(AbstractFile file) {
String name = file.getName(); String name = file.getName();
if (name.equals("..")) { switch (name) {
name = DirectoryNode.DOTDOTDIR; case "..":
} else if (name.equals(".")) { name = DirectoryNode.DOTDOTDIR;
name = DirectoryNode.DOTDIR; break;
case ".":
name = DirectoryNode.DOTDIR;
break;
} }
return name; return name;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -22,6 +22,8 @@ import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children.Keys; import org.openide.nodes.Children.Keys;
import org.openide.nodes.Node; import org.openide.nodes.Node;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.datamodel.KeywordHits.KeywordHitsRootNode;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.DerivedFile; import org.sleuthkit.datamodel.DerivedFile;
import org.sleuthkit.datamodel.Directory; import org.sleuthkit.datamodel.Directory;
import org.sleuthkit.datamodel.File; import org.sleuthkit.datamodel.File;
@ -62,52 +64,52 @@ abstract class AbstractContentChildren<T> extends Keys<T> {
/** /**
* Creates appropriate Node for each sub-class of Content * Creates appropriate Node for each sub-class of Content
*/ */
public static class CreateSleuthkitNodeVisitor extends SleuthkitItemVisitor.Default<AbstractContentNode> { public static class CreateSleuthkitNodeVisitor extends SleuthkitItemVisitor.Default<AbstractContentNode<? extends Content>> {
@Override @Override
public AbstractContentNode visit(Directory drctr) { public AbstractContentNode<? extends Content> visit(Directory drctr) {
return new DirectoryNode(drctr); return new DirectoryNode(drctr);
} }
@Override @Override
public AbstractContentNode visit(File file) { public AbstractContentNode<? extends Content> visit(File file) {
return new FileNode(file); return new FileNode(file);
} }
@Override @Override
public AbstractContentNode visit(Image image) { public AbstractContentNode<? extends Content> visit(Image image) {
return new ImageNode(image); return new ImageNode(image);
} }
@Override @Override
public AbstractContentNode visit(Volume volume) { public AbstractContentNode<? extends Content> visit(Volume volume) {
return new VolumeNode(volume); return new VolumeNode(volume);
} }
@Override @Override
public AbstractContentNode visit(LayoutFile lf) { public AbstractContentNode<? extends Content> visit(LayoutFile lf) {
return new LayoutFileNode(lf); return new LayoutFileNode(lf);
} }
@Override @Override
public AbstractContentNode visit(DerivedFile df) { public AbstractContentNode<? extends Content> visit(DerivedFile df) {
return new LocalFileNode(df); return new LocalFileNode(df);
} }
@Override @Override
public AbstractContentNode visit(LocalFile lf) { public AbstractContentNode<? extends Content> visit(LocalFile lf) {
return new LocalFileNode(lf); return new LocalFileNode(lf);
} }
@Override @Override
public AbstractContentNode visit(VirtualDirectory ld) { public AbstractContentNode<? extends Content> visit(VirtualDirectory ld) {
return new VirtualDirectoryNode(ld); return new VirtualDirectoryNode(ld);
} }
@Override @Override
protected AbstractContentNode defaultVisit(SleuthkitVisitableItem di) { protected AbstractContentNode<? extends Content> defaultVisit(SleuthkitVisitableItem di) {
throw new UnsupportedOperationException(NbBundle.getMessage(this.getClass(), throw new UnsupportedOperationException(NbBundle.getMessage(this.getClass(),
"AbstractContentChildren.CreateTSKNodeVisitor.exception.noNodeMsg")); "AbstractContentChildren.CreateTSKNodeVisitor.exception.noNodeMsg"));
} }
} }
@ -189,7 +191,7 @@ abstract class AbstractContentChildren<T> extends Keys<T> {
protected AbstractNode defaultVisit(AutopsyVisitableItem di) { protected AbstractNode defaultVisit(AutopsyVisitableItem di) {
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"AbstractContentChildren.createAutopsyNodeVisitor.exception.noNodeMsg")); "AbstractContentChildren.createAutopsyNodeVisitor.exception.noNodeMsg"));
} }
} }
} }

View File

@ -78,10 +78,10 @@ public abstract class AbstractFsContentNode<T extends AbstractFile> extends Abst
for (int i = 0; i < FS_PROPS_LEN; ++i) { for (int i = 0; i < FS_PROPS_LEN; ++i) {
final AbstractFilePropertyType propType = AbstractFilePropertyType.values()[i]; final AbstractFilePropertyType propType = AbstractFilePropertyType.values()[i];
final String propString = propType.toString(); final String propString = propType.toString();
ss.put(new NodeProperty(propString, propString, NO_DESCR, map.get(propString))); ss.put(new NodeProperty<>(propString, propString, NO_DESCR, map.get(propString)));
} }
if (directoryBrowseMode) { if (directoryBrowseMode) {
ss.put(new NodeProperty(HIDE_PARENT, HIDE_PARENT, HIDE_PARENT, HIDE_PARENT)); ss.put(new NodeProperty<>(HIDE_PARENT, HIDE_PARENT, HIDE_PARENT, HIDE_PARENT));
} }
return s; return s;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -30,8 +30,9 @@ import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskException; import org.sleuthkit.datamodel.TskException;
/** /**
* Node encapsulating blackboard artifact type. This is used on the left-hand navigation side of the Autopsy UI as the * Node encapsulating blackboard artifact type. This is used on the left-hand
* parent node for all of the artifacts of a given type. Its children will be BlackboardArtifactNode objects. * navigation side of the Autopsy UI as the parent node for all of the artifacts
* of a given type. Its children will be BlackboardArtifactNode objects.
*/ */
public class ArtifactTypeNode extends DisplayableItemNode { public class ArtifactTypeNode extends DisplayableItemNode {
@ -65,15 +66,15 @@ public class ArtifactTypeNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.name"),
NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.displayName"), NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.displayName"),
NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.desc"), NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.desc"),
type.getDisplayName())); type.getDisplayName()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.name"),
NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.displayName"), NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.displayName"),
NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.desc"), NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.desc"),
childCount)); childCount));
return s; return s;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -48,7 +48,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
private BlackboardArtifact artifact; private BlackboardArtifact artifact;
private Content associated; private Content associated;
private List<NodeProperty> customProperties; private List<NodeProperty<? extends Object>> customProperties;
static final Logger logger = Logger.getLogger(BlackboardArtifactNode.class.getName()); static final Logger logger = Logger.getLogger(BlackboardArtifactNode.class.getName());
/** /**
* Artifact types which should have the associated content's full unique path * Artifact types which should have the associated content's full unique path
@ -107,16 +107,16 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
} }
final String NO_DESCR = NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.noDesc.text"); final String NO_DESCR = NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.noDesc.text");
Map<String, Object> map = new LinkedHashMap<String, Object>(); Map<String, Object> map = new LinkedHashMap<>();
fillPropertyMap(map, artifact); fillPropertyMap(map, artifact);
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.srcFile.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.srcFile.name"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.srcFile.displayName"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.srcFile.displayName"),
NO_DESCR, NO_DESCR,
associated.getName())); associated.getName()));
for (Map.Entry<String, Object> entry : map.entrySet()) { for (Map.Entry<String, Object> entry : map.entrySet()) {
ss.put(new NodeProperty(entry.getKey(), ss.put(new NodeProperty<>(entry.getKey(),
entry.getKey(), entry.getKey(),
NO_DESCR, NO_DESCR,
entry.getValue())); entry.getValue()));
@ -124,7 +124,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
//append custom node properties //append custom node properties
if (customProperties != null) { if (customProperties != null) {
for (NodeProperty np : customProperties) { for (NodeProperty<? extends Object> np : customProperties) {
ss.put(np); ss.put(np);
} }
} }
@ -137,7 +137,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
AbstractFile af = (AbstractFile) associated; AbstractFile af = (AbstractFile) associated;
ext = af.getNameExtension(); ext = af.getNameExtension();
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.ext.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.ext.name"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.ext.displayName"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.ext.displayName"),
NO_DESCR, NO_DESCR,
ext)); ext));
@ -156,7 +156,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
if (actualMimeType.isEmpty()) { if (actualMimeType.isEmpty()) {
logger.log(Level.WARNING, "Could not find expected TSK_FILE_TYPE_SIG attribute."); logger.log(Level.WARNING, "Could not find expected TSK_FILE_TYPE_SIG attribute.");
} else { } else {
ss.put(new NodeProperty( ss.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.mimeType.name"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.mimeType.name"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.mimeType.displayName"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.mimeType.displayName"),
NO_DESCR, NO_DESCR,
@ -172,11 +172,11 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
try { try {
sourcePath = associated.getUniquePath(); sourcePath = associated.getUniquePath();
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.WARNING, "Failed to get unique path from: " + associated.getName()); logger.log(Level.WARNING, "Failed to get unique path from: {0}", associated.getName());
} }
if (sourcePath.isEmpty() == false) { if (sourcePath.isEmpty() == false) {
ss.put(new NodeProperty( ss.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.filePath.name"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.filePath.name"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.filePath.displayName"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.filePath.displayName"),
NO_DESCR, NO_DESCR,
@ -192,11 +192,11 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
dataSource = getRootParentName(); dataSource = getRootParentName();
} }
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.WARNING, "Failed to get image name from " + associated.getName()); logger.log(Level.WARNING, "Failed to get image name from {0}", associated.getName());
} }
if (dataSource.isEmpty() == false) { if (dataSource.isEmpty() == false) {
ss.put(new NodeProperty( ss.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.dataSrc.name"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.dataSrc.name"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.dataSrc.displayName"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.dataSrc.displayName"),
NO_DESCR, NO_DESCR,
@ -215,7 +215,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
parentName = parent.getName(); parentName = parent.getName();
} }
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.WARNING, "Failed to get parent name from " + associated.getName()); logger.log(Level.WARNING, "Failed to get parent name from {0}", associated.getName());
return ""; return "";
} }
return parentName; return parentName;
@ -227,10 +227,10 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
* *
* @param np NodeProperty to add * @param np NodeProperty to add
*/ */
public void addNodeProperty(NodeProperty np) { public <T> void addNodeProperty(NodeProperty<T> np) {
if (customProperties == null) { if (customProperties == null) {
//lazy create the list //lazy create the list
customProperties = new ArrayList<NodeProperty>(); customProperties = new ArrayList<>();
} }
customProperties.add(np); customProperties.add(np);
@ -297,7 +297,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
private static Lookup getLookups(BlackboardArtifact artifact) { private static Lookup getLookups(BlackboardArtifact artifact) {
Content content = getAssociatedContent(artifact); Content content = getAssociatedContent(artifact);
HighlightLookup highlight = getHighlightLookup(artifact, content); HighlightLookup highlight = getHighlightLookup(artifact, content);
List<Object> forLookup = new ArrayList<Object>(); List<Object> forLookup = new ArrayList<>();
forLookup.add(artifact); forLookup.add(artifact);
if (content != null) { if (content != null) {
forLookup.add(content); forLookup.add(content);

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -37,7 +37,8 @@ import org.sleuthkit.datamodel.TskCoreException;
* tag name nodes have tag type child nodes; tag type nodes are the parents of * tag name nodes have tag type child nodes; tag type nodes are the parents of
* either content or blackboard artifact tag nodes. * either content or blackboard artifact tag nodes.
*/ */
public class BlackboardArtifactTagNode extends DisplayableItemNode { public class BlackboardArtifactTagNode extends DisplayableItemNode {
private static final String ICON_PATH = "org/sleuthkit/autopsy/images/green-tag-icon-16.png"; private static final String ICON_PATH = "org/sleuthkit/autopsy/images/green-tag-icon-16.png";
private final BlackboardArtifactTag tag; private final BlackboardArtifactTag tag;
@ -58,7 +59,7 @@ public class BlackboardArtifactTagNode extends DisplayableItemNode {
propertySheet.put(properties); propertySheet.put(properties);
} }
properties.put(new NodeProperty( properties.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFile.text"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFile.text"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFile.text"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFile.text"),
"", "",
@ -66,22 +67,21 @@ public class BlackboardArtifactTagNode extends DisplayableItemNode {
String contentPath; String contentPath;
try { try {
contentPath = tag.getContent().getUniquePath(); contentPath = tag.getContent().getUniquePath();
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(ContentTagNode.class.getName()).log(Level.SEVERE, "Failed to get path for content (id = " + tag.getContent().getId() + ")", ex); Logger.getLogger(ContentTagNode.class.getName()).log(Level.SEVERE, "Failed to get path for content (id = " + tag.getContent().getId() + ")", ex);
contentPath = NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.unavail.text"); contentPath = NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.unavail.text");
} }
properties.put(new NodeProperty( properties.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFilePath.text"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFilePath.text"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFilePath.text"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFilePath.text"),
"", "",
contentPath)); contentPath));
properties.put(new NodeProperty( properties.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.resultType.text"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.resultType.text"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.resultType.text"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.resultType.text"),
"", "",
tag.getArtifact().getDisplayName())); tag.getArtifact().getDisplayName()));
properties.put(new NodeProperty( properties.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.comment.text"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.comment.text"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.comment.text"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.comment.text"),
"", "",
@ -108,4 +108,3 @@ public class BlackboardArtifactTagNode extends DisplayableItemNode {
return true; return true;
} }
} }

View File

@ -16,7 +16,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.datamodel; package org.sleuthkit.autopsy.datamodel;
import java.util.List; import java.util.List;
@ -32,12 +31,13 @@ import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
/** /**
* Instances of this class wrap ContentTag objects. In the Autopsy * Instances of this class wrap ContentTag objects. In the Autopsy presentation
* presentation of the SleuthKit data model, they are leaf nodes of a tree * of the SleuthKit data model, they are leaf nodes of a tree consisting of
* consisting of content and blackboard artifact tags, grouped first by tag * content and blackboard artifact tags, grouped first by tag type, then by tag
* type, then by tag name. * name.
*/ */
class ContentTagNode extends DisplayableItemNode { class ContentTagNode extends DisplayableItemNode {
private static final String ICON_PATH = "org/sleuthkit/autopsy/images/blue-tag-icon-16.png"; private static final String ICON_PATH = "org/sleuthkit/autopsy/images/blue-tag-icon-16.png";
private final ContentTag tag; private final ContentTag tag;
@ -58,26 +58,25 @@ import org.sleuthkit.datamodel.TskCoreException;
propertySheet.put(properties); propertySheet.put(properties);
} }
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.file.name"), properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.file.name"),
NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.file.displayName"), NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.file.displayName"),
"", "",
tag.getContent().getName())); tag.getContent().getName()));
String contentPath; String contentPath;
try { try {
contentPath = tag.getContent().getUniquePath(); contentPath = tag.getContent().getUniquePath();
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(ContentTagNode.class.getName()).log(Level.SEVERE, "Failed to get path for content (id = " + tag.getContent().getId() + ")", ex); Logger.getLogger(ContentTagNode.class.getName()).log(Level.SEVERE, "Failed to get path for content (id = " + tag.getContent().getId() + ")", ex);
contentPath = NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.unavail.path"); contentPath = NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.unavail.path");
} }
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.filePath.name"), properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.filePath.name"),
NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.filePath.displayName"), NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.filePath.displayName"),
"", "",
contentPath)); contentPath));
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.comment.name"), properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.comment.name"),
NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.comment.displayName"), NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.comment.displayName"),
"", "",
tag.getComment())); tag.getComment()));
return propertySheet; return propertySheet;
} }

View File

@ -34,11 +34,12 @@ import org.sleuthkit.datamodel.TskCoreException;
/** /**
* Instances of this class are are elements of a directory tree sub-tree * Instances of this class are are elements of a directory tree sub-tree
* consisting of content and blackboard artifact tags, grouped first by tag type, * consisting of content and blackboard artifact tags, grouped first by tag
* then by tag name. * type, then by tag name.
*/ */
public class ContentTagTypeNode extends DisplayableItemNode { public class ContentTagTypeNode extends DisplayableItemNode {
private static final String DISPLAY_NAME = NbBundle.getMessage(ContentTagTypeNode.class, "ContentTagTypeNode.displayName.text");
private static final String DISPLAY_NAME = NbBundle.getMessage(ContentTagTypeNode.class, "ContentTagTypeNode.displayName.text");
private static final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png"; private static final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png";
public ContentTagTypeNode(TagName tagName) { public ContentTagTypeNode(TagName tagName) {
@ -47,8 +48,7 @@ public class ContentTagTypeNode extends DisplayableItemNode {
long tagsCount = 0; long tagsCount = 0;
try { try {
tagsCount = Case.getCurrentCase().getServices().getTagsManager().getContentTagsCountByTagName(tagName); tagsCount = Case.getCurrentCase().getServices().getTagsManager().getContentTagsCountByTagName(tagName);
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(ContentTagTypeNode.class.getName()).log(Level.SEVERE, "Failed to get content tags count for " + tagName.getDisplayName() + " tag name", ex); Logger.getLogger(ContentTagTypeNode.class.getName()).log(Level.SEVERE, "Failed to get content tags count for " + tagName.getDisplayName() + " tag name", ex);
} }
@ -66,10 +66,10 @@ public class ContentTagTypeNode extends DisplayableItemNode {
propertySheet.put(properties); propertySheet.put(properties);
} }
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ContentTagTypeNode.createSheet.name.name"), properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ContentTagTypeNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "ContentTagTypeNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "ContentTagTypeNode.createSheet.name.displayName"),
"", "",
getName())); getName()));
return propertySheet; return propertySheet;
} }
@ -85,6 +85,7 @@ public class ContentTagTypeNode extends DisplayableItemNode {
} }
private static class ContentTagNodeFactory extends ChildFactory<ContentTag> { private static class ContentTagNodeFactory extends ChildFactory<ContentTag> {
private final TagName tagName; private final TagName tagName;
ContentTagNodeFactory(TagName tagName) { ContentTagNodeFactory(TagName tagName) {
@ -96,8 +97,7 @@ public class ContentTagTypeNode extends DisplayableItemNode {
// Use the content tags bearing the specified tag name as the keys. // Use the content tags bearing the specified tag name as the keys.
try { try {
keys.addAll(Case.getCurrentCase().getServices().getTagsManager().getContentTagsByTagName(tagName)); keys.addAll(Case.getCurrentCase().getServices().getTagsManager().getContentTagsByTagName(tagName));
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(ContentTagTypeNode.ContentTagNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); Logger.getLogger(ContentTagTypeNode.ContentTagNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
} }
return true; return true;

View File

@ -159,8 +159,8 @@ public final class ContentUtils {
* @return number of bytes extracted * @return number of bytes extracted
* @throws IOException if file could not be written * @throws IOException if file could not be written
*/ */
public static long writeToFile(Content content, java.io.File outputFile, public static <T,V> long writeToFile(Content content, java.io.File outputFile,
ProgressHandle progress, SwingWorker worker, boolean source) throws IOException { ProgressHandle progress, SwingWorker<T,V> worker, boolean source) throws IOException {
InputStream in = new ReadContentInputStream(content); InputStream in = new ReadContentInputStream(content);
@ -215,11 +215,11 @@ public final class ContentUtils {
* Assumes there will be no collisions with existing directories/files, and * Assumes there will be no collisions with existing directories/files, and
* that the directory to contain the destination file already exists. * that the directory to contain the destination file already exists.
*/ */
public static class ExtractFscContentVisitor extends ContentVisitor.Default<Void> { public static class ExtractFscContentVisitor<T,V> extends ContentVisitor.Default<Void> {
java.io.File dest; java.io.File dest;
ProgressHandle progress; ProgressHandle progress;
SwingWorker worker; SwingWorker<T,V> worker;
boolean source = false; boolean source = false;
/** /**
@ -234,7 +234,7 @@ public final class ContentUtils {
* @param source true if source file * @param source true if source file
*/ */
public ExtractFscContentVisitor(java.io.File dest, public ExtractFscContentVisitor(java.io.File dest,
ProgressHandle progress, SwingWorker worker, boolean source) { ProgressHandle progress, SwingWorker<T,V> worker, boolean source) {
this.dest = dest; this.dest = dest;
this.progress = progress; this.progress = progress;
this.worker = worker; this.worker = worker;
@ -249,8 +249,8 @@ public final class ContentUtils {
* Convenience method to make a new instance for given destination and * Convenience method to make a new instance for given destination and
* extract given content * extract given content
*/ */
public static void extract(Content cntnt, java.io.File dest, ProgressHandle progress, SwingWorker worker) { public static <T,V> void extract(Content cntnt, java.io.File dest, ProgressHandle progress, SwingWorker<T,V> worker) {
cntnt.accept(new ExtractFscContentVisitor(dest, progress, worker, true)); cntnt.accept(new ExtractFscContentVisitor<>(dest, progress, worker, true));
} }
@Override @Override
@ -333,8 +333,8 @@ public final class ContentUtils {
// recurse on children // recurse on children
for (Content child : dir.getChildren()) { for (Content child : dir.getChildren()) {
java.io.File childFile = getFsContentDest(child); java.io.File childFile = getFsContentDest(child);
ExtractFscContentVisitor childVisitor = ExtractFscContentVisitor<T,V> childVisitor =
new ExtractFscContentVisitor(childFile, progress, worker, false); new ExtractFscContentVisitor<>(childFile, progress, worker, false);
// If this is the source directory of an extract it // If this is the source directory of an extract it
// will have a progress and worker, and will keep track // will have a progress and worker, and will keep track
// of the progress bar's progress // of the progress bar's progress

View File

@ -102,10 +102,10 @@ public class DataConversion {
outputStringBuilder.append(" "); outputStringBuilder.append(" ");
// print the ascii columns // print the ascii columns
String ascii = new String(array, curOffset, lineLen); String ascii = new String(array, curOffset, lineLen, java.nio.charset.StandardCharsets.US_ASCII);
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
char c = ' '; char c = ' ';
if (i < lineLen) { if (i < ascii.length()) {
c = ascii.charAt(i); c = ascii.charAt(i);
int dec = (int) c; int dec = (int) c;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -58,10 +58,10 @@ public class DataSourcesNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.desc"),
NAME)); NAME));
return s; return s;
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -53,11 +53,11 @@ public class DeletedContent implements AutopsyVisitableItem {
public enum DeletedContentFilter implements AutopsyVisitableItem { public enum DeletedContentFilter implements AutopsyVisitableItem {
FS_DELETED_FILTER(0, FS_DELETED_FILTER(0,
"FS_DELETED_FILTER", "FS_DELETED_FILTER",
NbBundle.getMessage(DeletedContent.class, "DeletedContent.fsDelFilter.text")), NbBundle.getMessage(DeletedContent.class, "DeletedContent.fsDelFilter.text")),
ALL_DELETED_FILTER(1, ALL_DELETED_FILTER(1,
"ALL_DELETED_FILTER", "ALL_DELETED_FILTER",
NbBundle.getMessage(DeletedContent.class, "DeletedContent.allDelFilter.text")); NbBundle.getMessage(DeletedContent.class, "DeletedContent.allDelFilter.text"));
private int id; private int id;
private String name; private String name;
private String displayName; private String displayName;
@ -103,7 +103,7 @@ public class DeletedContent implements AutopsyVisitableItem {
public static class DeletedContentsNode extends DisplayableItemNode { public static class DeletedContentsNode extends DisplayableItemNode {
private static final String NAME = NbBundle.getMessage(DeletedContent.class, private static final String NAME = NbBundle.getMessage(DeletedContent.class,
"DeletedContent.deletedContentsNode.name"); "DeletedContent.deletedContentsNode.name");
private SleuthkitCase skCase; private SleuthkitCase skCase;
DeletedContentsNode(SleuthkitCase skCase) { DeletedContentsNode(SleuthkitCase skCase) {
@ -133,10 +133,10 @@ public class DeletedContent implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.desc"),
NAME)); NAME));
return s; return s;
} }
} }
@ -163,14 +163,12 @@ public class DeletedContent implements AutopsyVisitableItem {
public class DeletedContentNode extends DisplayableItemNode { public class DeletedContentNode extends DisplayableItemNode {
private SleuthkitCase skCase;
private DeletedContent.DeletedContentFilter filter; private DeletedContent.DeletedContentFilter filter;
private final Logger logger = Logger.getLogger(DeletedContentNode.class.getName()); private final Logger logger = Logger.getLogger(DeletedContentNode.class.getName());
DeletedContentNode(SleuthkitCase skCase, DeletedContent.DeletedContentFilter filter) { DeletedContentNode(SleuthkitCase skCase, DeletedContent.DeletedContentFilter filter) {
super(Children.create(new DeletedContentChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName())); super(Children.create(new DeletedContentChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName()));
super.setName(filter.getName()); super.setName(filter.getName());
this.skCase = skCase;
this.filter = filter; this.filter = filter;
String tooltip = filter.getDisplayName(); String tooltip = filter.getDisplayName();
@ -197,7 +195,7 @@ public class DeletedContent implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty( ss.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.filterType.name"), NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.filterType.name"),
NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.filterType.displayName"), NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.filterType.displayName"),
NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.filterType.desc"), NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.filterType.desc"),
@ -217,8 +215,7 @@ public class DeletedContent implements AutopsyVisitableItem {
private SleuthkitCase skCase; private SleuthkitCase skCase;
private DeletedContent.DeletedContentFilter filter; private DeletedContent.DeletedContentFilter filter;
private final Logger logger = Logger.getLogger(DeletedContentChildren.class.getName()); private final Logger logger = Logger.getLogger(DeletedContentChildren.class.getName());
private static final int MAX_OBJECTS = 10001;
private static final int MAX_OBJECTS = 2001;
DeletedContentChildren(DeletedContent.DeletedContentFilter filter, SleuthkitCase skCase) { DeletedContentChildren(DeletedContent.DeletedContentFilter filter, SleuthkitCase skCase) {
this.skCase = skCase; this.skCase = skCase;
@ -233,8 +230,8 @@ public class DeletedContent implements AutopsyVisitableItem {
@Override @Override
public void run() { public void run() {
JOptionPane.showMessageDialog(null, NbBundle.getMessage(this.getClass(), JOptionPane.showMessageDialog(null, NbBundle.getMessage(this.getClass(),
"DeletedContent.createKeys.maxObjects.msg", "DeletedContent.createKeys.maxObjects.msg",
MAX_OBJECTS - 1)); MAX_OBJECTS - 1));
} }
}); });
} }
@ -273,7 +270,7 @@ public class DeletedContent implements AutopsyVisitableItem {
break; break;
default: default:
logger.log(Level.SEVERE, "Unsupported filter type to get deleted content: " + filter); logger.log(Level.SEVERE, "Unsupported filter type to get deleted content: {0}", filter);
} }
@ -282,7 +279,7 @@ public class DeletedContent implements AutopsyVisitableItem {
} }
private List<AbstractFile> runFsQuery() { private List<AbstractFile> runFsQuery() {
List<AbstractFile> ret = new ArrayList<AbstractFile>(); List<AbstractFile> ret = new ArrayList<>();
String query = makeQuery(); String query = makeQuery();
try { try {
@ -338,8 +335,8 @@ public class DeletedContent implements AutopsyVisitableItem {
@Override @Override
protected AbstractNode defaultVisit(Content di) { protected AbstractNode defaultVisit(Content di) {
throw new UnsupportedOperationException(NbBundle.getMessage(this.getClass(), throw new UnsupportedOperationException(NbBundle.getMessage(this.getClass(),
"DeletedContent.createNodeForKey.typeNotSupported.msg", "DeletedContent.createNodeForKey.typeNotSupported.msg",
di.toString())); di.toString()));
} }
}); });
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2012 Basis Technology Corp. * Copyright 2012-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -58,7 +58,7 @@ public class EmailExtracted implements AutopsyVisitableItem {
public EmailExtracted(SleuthkitCase skCase) { public EmailExtracted(SleuthkitCase skCase) {
this.skCase = skCase; this.skCase = skCase;
accounts = new LinkedHashMap<String, Map<String, List<Long>>>(); accounts = new LinkedHashMap<>();
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -82,12 +82,12 @@ public class EmailExtracted implements AutopsyVisitableItem {
Map<String, List<Long>> folders = accounts.get(account); Map<String, List<Long>> folders = accounts.get(account);
if (folders == null) { if (folders == null) {
folders = new LinkedHashMap<String, List<Long>>(); folders = new LinkedHashMap<>();
accounts.put(account, folders); accounts.put(account, folders);
} }
List<Long> messages = folders.get(folder); List<Long> messages = folders.get(folder);
if (messages == null) { if (messages == null) {
messages = new ArrayList<Long>(); messages = new ArrayList<>();
folders.put(folder, messages); folders.put(folder, messages);
} }
messages.add(artifactId); messages.add(artifactId);
@ -100,11 +100,10 @@ public class EmailExtracted implements AutopsyVisitableItem {
} }
private static Map<String, String> parsePath(String path) { private static Map<String, String> parsePath(String path) {
Map<String, String> parsed = new HashMap<String, String>(); Map<String, String> parsed = new HashMap<>();
String[] split = path.split(MAIL_PATH_SEPARATOR); String[] split = path.split(MAIL_PATH_SEPARATOR);
if (split.length < 4) { if (split.length < 4) {
logger.log(Level.WARNING, "Unexpected number of tokens when parsing email PATH: " logger.log(Level.WARNING, "Unexpected number of tokens when parsing email PATH: {0}, will use defaults", split.length);
+ split.length + ", will use defaults");
parsed.put(MAIL_ACCOUNT, NbBundle.getMessage(EmailExtracted.class, "EmailExtracted.defaultAcct.text")); parsed.put(MAIL_ACCOUNT, NbBundle.getMessage(EmailExtracted.class, "EmailExtracted.defaultAcct.text"));
parsed.put(MAIL_FOLDER, NbBundle.getMessage(EmailExtracted.class, "EmailExtracted.defaultFolder.text")); parsed.put(MAIL_FOLDER, NbBundle.getMessage(EmailExtracted.class, "EmailExtracted.defaultFolder.text"));
return parsed; return parsed;
@ -153,11 +152,10 @@ public class EmailExtracted implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"),
getName())); getName()));
return s; return s;
} }
} }
@ -190,7 +188,6 @@ public class EmailExtracted implements AutopsyVisitableItem {
} }
} }
list.addAll(tempList); list.addAll(tempList);
return true; return true;
} }
@ -235,10 +232,10 @@ public class EmailExtracted implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"),
getName())); getName()));
return s; return s;
} }
@ -282,10 +279,10 @@ public class EmailExtracted implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"),
getName())); getName()));
return s; return s;
} }
@ -352,10 +349,10 @@ public class EmailExtracted implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"),
getName())); getName()));
return s; return s;
} }

View File

@ -46,7 +46,7 @@ class ExtractedContentChildren extends ChildFactory<BlackboardArtifact.ARTIFACT_
this.skCase = skCase; this.skCase = skCase;
// these are shown in other parts of the UI tree // these are shown in other parts of the UI tree
doNotShow = new ArrayList(); doNotShow = new ArrayList<>();
doNotShow.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO); doNotShow.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO);
doNotShow.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG); doNotShow.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG);
doNotShow.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT); doNotShow.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT);

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -25,7 +25,8 @@ import org.openide.util.lookup.Lookups;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
/** /**
* Node for the extracted content artifacts (artifacts that are not shown in more specific areas of the tree) * Node for the extracted content artifacts (artifacts that are not shown in
* more specific areas of the tree)
*/ */
public class ExtractedContentNode extends DisplayableItemNode { public class ExtractedContentNode extends DisplayableItemNode {
@ -57,9 +58,9 @@ public class ExtractedContentNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.desc"),
NAME)); NAME));
return s; return s;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -101,13 +101,11 @@ public class FileSize implements AutopsyVisitableItem {
public static class FileSizeRootNode extends DisplayableItemNode { public static class FileSizeRootNode extends DisplayableItemNode {
private static final String NAME = NbBundle.getMessage(FileSize.class, "FileSize.fileSizeRootNode.name"); private static final String NAME = NbBundle.getMessage(FileSize.class, "FileSize.fileSizeRootNode.name");
private SleuthkitCase skCase;
FileSizeRootNode(SleuthkitCase skCase) { FileSizeRootNode(SleuthkitCase skCase) {
super(Children.create(new FileSizeRootChildren(skCase), true), Lookups.singleton(NAME)); super(Children.create(new FileSizeRootChildren(skCase), true), Lookups.singleton(NAME));
super.setName(NAME); super.setName(NAME);
super.setDisplayName(NAME); super.setDisplayName(NAME);
this.skCase = skCase;
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file-size-16.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file-size-16.png");
} }
@ -130,9 +128,9 @@ public class FileSize implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.desc"),
NAME)); NAME));
return s; return s;
} }
@ -160,14 +158,12 @@ public class FileSize implements AutopsyVisitableItem {
public class FileSizeNode extends DisplayableItemNode { public class FileSizeNode extends DisplayableItemNode {
private SleuthkitCase skCase;
private FileSizeFilter filter; private FileSizeFilter filter;
private final Logger logger = Logger.getLogger(FileSizeNode.class.getName()); private final Logger logger = Logger.getLogger(FileSizeNode.class.getName());
FileSizeNode(SleuthkitCase skCase, FileSizeFilter filter) { FileSizeNode(SleuthkitCase skCase, FileSizeFilter filter) {
super(Children.create(new FileSizeChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName())); super(Children.create(new FileSizeChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName()));
super.setName(filter.getName()); super.setName(filter.getName());
this.skCase = skCase;
this.filter = filter; this.filter = filter;
String tooltip = filter.getDisplayName(); String tooltip = filter.getDisplayName();
@ -194,10 +190,10 @@ public class FileSize implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.name"),
NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.displayName"), NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.displayName"),
NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.desc"), NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.desc"),
filter.getDisplayName())); filter.getDisplayName()));
return s; return s;
} }
@ -244,7 +240,7 @@ public class FileSize implements AutopsyVisitableItem {
break; break;
default: default:
logger.log(Level.SEVERE, "Unsupported filter type to get files by size: " + filter); logger.log(Level.SEVERE, "Unsupported filter type to get files by size: {0}", filter);
return null; return null;
} }
// ignore unalloc block files // ignore unalloc block files
@ -254,7 +250,7 @@ public class FileSize implements AutopsyVisitableItem {
} }
private List<AbstractFile> runFsQuery() { private List<AbstractFile> runFsQuery() {
List<AbstractFile> ret = new ArrayList<AbstractFile>(); List<AbstractFile> ret = new ArrayList<>();
String query = makeQuery(); String query = makeQuery();
if (query == null) { if (query == null) {
@ -330,8 +326,8 @@ public class FileSize implements AutopsyVisitableItem {
protected AbstractNode defaultVisit(Content di) { protected AbstractNode defaultVisit(Content di) {
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"FileSize.exception.notSupported.msg", "FileSize.exception.notSupported.msg",
di.toString())); di.toString()));
} }
}); });
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -62,19 +62,19 @@ public class FileTypeNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.name"),
NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.displayName"), NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.displayName"),
NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.desc"), NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.desc"),
filter.getDisplayName())); filter.getDisplayName()));
String extensions = ""; String extensions = "";
for (String ext : filter.getFilter()) { for (String ext : filter.getFilter()) {
extensions += "'" + ext + "', "; extensions += "'" + ext + "', ";
} }
extensions = extensions.substring(0, extensions.lastIndexOf(',')); extensions = extensions.substring(0, extensions.lastIndexOf(','));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.name"),
NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.displayName"), NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.displayName"),
NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.desc"), NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.desc"),
extensions)); extensions));
return s; return s;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -30,12 +30,12 @@ import org.sleuthkit.datamodel.SleuthkitCase;
public class FileTypesNode extends DisplayableItemNode { public class FileTypesNode extends DisplayableItemNode {
private static final String FNAME = NbBundle.getMessage(FileTypesNode.class, "FileTypesNode.fname.text"); private static final String FNAME = NbBundle.getMessage(FileTypesNode.class, "FileTypesNode.fname.text");
private SleuthkitCase skCase;
/** /**
* *
* @param skCase * @param skCase
* @param filter null to display root node of file type tree, pass in something to provide a sub-node. * @param filter null to display root node of file type tree, pass in
* something to provide a sub-node.
*/ */
FileTypesNode(SleuthkitCase skCase, FileTypeExtensionFilters.RootFilter filter) { FileTypesNode(SleuthkitCase skCase, FileTypeExtensionFilters.RootFilter filter) {
super(Children.create(new FileTypesChildren(skCase, filter), true), Lookups.singleton(filter == null ? FNAME : filter.getName())); super(Children.create(new FileTypesChildren(skCase, filter), true), Lookups.singleton(filter == null ? FNAME : filter.getName()));
@ -43,13 +43,11 @@ public class FileTypesNode extends DisplayableItemNode {
if (filter == null) { if (filter == null) {
super.setName(FNAME); super.setName(FNAME);
super.setDisplayName(FNAME); super.setDisplayName(FNAME);
} } // sub-node in file tree (i.e. documents, exec, etc.)
// sub-node in file tree (i.e. documents, exec, etc.)
else { else {
super.setName(filter.getName()); super.setName(filter.getName());
super.setDisplayName(filter.getDisplayName()); super.setDisplayName(filter.getDisplayName());
} }
this.skCase = skCase;
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file_types.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file_types.png");
} }
@ -72,9 +70,9 @@ public class FileTypesNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.desc"),
getName())); getName()));
return s; return s;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -52,7 +52,7 @@ public class HashsetHits implements AutopsyVisitableItem {
public HashsetHits(SleuthkitCase skCase) { public HashsetHits(SleuthkitCase skCase) {
this.skCase = skCase; this.skCase = skCase;
hashSetHitsMap = new LinkedHashMap<String, Set<Long>>(); hashSetHitsMap = new LinkedHashMap<>();
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -80,13 +80,12 @@ public class HashsetHits implements AutopsyVisitableItem {
} catch (SQLException ex) { } catch (SQLException ex) {
logger.log(Level.WARNING, "SQL Exception occurred: ", ex); logger.log(Level.WARNING, "SQL Exception occurred: ", ex);
} } finally {
finally {
if (rs != null) { if (rs != null) {
try { try {
skCase.closeRunQuery(rs); skCase.closeRunQuery(rs);
} catch (SQLException ex) { } catch (SQLException ex) {
logger.log(Level.WARNING, "Error closing result set after getting hashset hits", ex); logger.log(Level.WARNING, "Error closing result set after getting hashset hits", ex);
} }
} }
} }
@ -129,10 +128,10 @@ public class HashsetHits implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.desc"),
getName())); getName()));
return s; return s;
} }
@ -175,10 +174,10 @@ public class HashsetHits implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.desc"),
getName())); getName()));
return s; return s;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -85,11 +85,10 @@ public class ImageNode extends AbstractContentNode<Image> {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.desc"),
getName())); getName()));
// @@@ add more properties here...
return s; return s;
} }

View File

@ -135,7 +135,7 @@ public class InterestingHits implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.desc"),
getName())); getName()));
@ -181,7 +181,7 @@ public class InterestingHits implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.name"), NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.desc"),
getName())); getName()));

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -31,10 +31,8 @@ import org.sleuthkit.datamodel.AbstractFile;
* Node that contains a KeyValue object. The node also has that KeyValue object * Node that contains a KeyValue object. The node also has that KeyValue object
* set to its lookup so that when the node is passed to the content viewers its * set to its lookup so that when the node is passed to the content viewers its
* string will be displayed. * string will be displayed.
*
* @author alawrence
*/ */
public class KeyValueNode extends AbstractNode { public class KeyValueNode extends AbstractNode {
private KeyValue data; private KeyValue data;
@ -55,7 +53,7 @@ import org.sleuthkit.datamodel.AbstractFile;
} }
private void setIcon() { private void setIcon() {
//if file/dir, set icon //if file/dir, set icon
AbstractFile af = Lookup.getDefault().lookup(AbstractFile.class); AbstractFile af = Lookup.getDefault().lookup(AbstractFile.class);
if (af != null) { if (af != null) {
// set name, display name, and icon // set name, display name, and icon
@ -79,18 +77,18 @@ import org.sleuthkit.datamodel.AbstractFile;
// table view drops first column of properties under assumption // table view drops first column of properties under assumption
// that it contains the node's name // that it contains the node's name
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.desc"),
data.getName())); data.getName()));
for (Map.Entry<String, Object> entry : data.getMap().entrySet()) { for (Map.Entry<String, Object> entry : data.getMap().entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
ss.put(new NodeProperty(key, ss.put(new NodeProperty<>(key,
key, key,
NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.map.desc"), NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.map.desc"),
value)); value));
} }
return s; return s;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.openide.nodes.ChildFactory; import org.openide.nodes.ChildFactory;
@ -66,11 +65,11 @@ public class KeywordHits implements AutopsyVisitableItem {
public KeywordHits(SleuthkitCase skCase) { public KeywordHits(SleuthkitCase skCase) {
this.skCase = skCase; this.skCase = skCase;
artifacts = new LinkedHashMap<Long, Map<Long, String>>(); artifacts = new LinkedHashMap<>();
listsMap = new LinkedHashMap<String, Map<String, Set<Long>>>(); listsMap = new LinkedHashMap<>();
literalMap = new LinkedHashMap<String, Set<Long>>(); literalMap = new LinkedHashMap<>();
regexMap = new LinkedHashMap<String, Set<Long>>(); regexMap = new LinkedHashMap<>();
topLevelMap = new LinkedHashMap<String, Map<String, Set<Long>>>(); topLevelMap = new LinkedHashMap<>();
} }
private void initMaps() { private void initMaps() {
@ -107,7 +106,6 @@ public class KeywordHits implements AutopsyVisitableItem {
literalMap.get(word).add(id); literalMap.get(word).add(id);
} }
topLevelMap.putAll(listsMap); topLevelMap.putAll(listsMap);
} }
} }
@ -143,13 +141,12 @@ public class KeywordHits implements AutopsyVisitableItem {
} catch (SQLException ex) { } catch (SQLException ex) {
logger.log(Level.WARNING, "SQL Exception occurred: ", ex); logger.log(Level.WARNING, "SQL Exception occurred: ", ex);
} } finally {
finally { if (rs != null) {
if (rs != null) {
try { try {
skCase.closeRunQuery(rs); skCase.closeRunQuery(rs);
} catch (SQLException ex) { } catch (SQLException ex) {
logger.log(Level.WARNING, "Error closing result set after getting keyword hits", ex); logger.log(Level.WARNING, "Error closing result set after getting keyword hits", ex);
} }
} }
} }
@ -167,14 +164,11 @@ public class KeywordHits implements AutopsyVisitableItem {
super.setName(NAME); super.setName(NAME);
super.setDisplayName(KEYWORD_HITS); super.setDisplayName(KEYWORD_HITS);
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/keyword_hits.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/keyword_hits.png");
//long start = System.currentTimeMillis();
initArtifacts(); initArtifacts();
initMaps(); initMaps();
//long finish = System.currentTimeMillis();
//logger.info("Process took " + (finish-start) + " ms" );
} }
@Override @Override
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@ -193,10 +187,10 @@ public class KeywordHits implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.desc"),
getName())); getName()));
return s; return s;
} }
@ -243,16 +237,16 @@ public class KeywordHits implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.name"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.displayName"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.desc"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.desc"),
name)); name));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.name"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.displayName"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.desc"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.desc"),
children.size())); children.size()));
return s; return s;
} }
@ -291,7 +285,6 @@ public class KeywordHits implements AutopsyVisitableItem {
public class KeywordHitsKeywordNode extends DisplayableItemNode { public class KeywordHitsKeywordNode extends DisplayableItemNode {
private String name;
private Set<Long> children; private Set<Long> children;
public KeywordHitsKeywordNode(String name, Set<Long> children) { public KeywordHitsKeywordNode(String name, Set<Long> children) {
@ -299,7 +292,6 @@ public class KeywordHits implements AutopsyVisitableItem {
super.setName(name); super.setName(name);
super.setDisplayName(name + " (" + children.size() + ")"); super.setDisplayName(name + " (" + children.size() + ")");
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/keyword_hits.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/keyword_hits.png");
this.name = name;
this.children = children; this.children = children;
} }
@ -308,8 +300,6 @@ public class KeywordHits implements AutopsyVisitableItem {
return true; return true;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -324,16 +314,15 @@ public class KeywordHits implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.name"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.displayName"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.desc"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.desc"),
getDisplayName())); getDisplayName()));
ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.name"),
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.name"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.displayName"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.desc"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.desc"), children.size()));
children.size()));
return s; return s;
} }
@ -374,26 +363,26 @@ public class KeywordHits implements AutopsyVisitableItem {
return n; return n;
} }
n.addNodeProperty(new NodeProperty( n.addNodeProperty(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "KeywordHits.createNodeForKey.modTime.name"), NbBundle.getMessage(this.getClass(), "KeywordHits.createNodeForKey.modTime.name"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.modTime.displayName"), "KeywordHits.createNodeForKey.modTime.displayName"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.modTime.desc"), "KeywordHits.createNodeForKey.modTime.desc"),
ContentUtils.getStringTime(file.getMtime(), file))); ContentUtils.getStringTime(file.getMtime(), file)));
n.addNodeProperty(new NodeProperty( n.addNodeProperty(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "KeywordHits.createNodeForKey.accessTime.name"), NbBundle.getMessage(this.getClass(), "KeywordHits.createNodeForKey.accessTime.name"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.accessTime.displayName"), "KeywordHits.createNodeForKey.accessTime.displayName"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.accessTime.desc"), "KeywordHits.createNodeForKey.accessTime.desc"),
ContentUtils.getStringTime(file.getAtime(), file))); ContentUtils.getStringTime(file.getAtime(), file)));
n.addNodeProperty(new NodeProperty( n.addNodeProperty(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "KeywordHits.createNodeForKey.chgTime.name"), NbBundle.getMessage(this.getClass(), "KeywordHits.createNodeForKey.chgTime.name"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.chgTime.displayName"), "KeywordHits.createNodeForKey.chgTime.displayName"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.chgTime.desc"), "KeywordHits.createNodeForKey.chgTime.desc"),
ContentUtils.getStringTime(file.getCtime(), file))); ContentUtils.getStringTime(file.getCtime(), file)));
return n; return n;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 - 2013 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -73,19 +73,18 @@ public class LayoutFileNode extends AbstractAbstractFileNode<LayoutFile> {
s.put(ss); s.put(ss);
} }
Map<String, Object> map = new LinkedHashMap<String, Object>(); Map<String, Object> map = new LinkedHashMap<>();
fillPropertyMap(map, content); fillPropertyMap(map, content);
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.desc"),
getName())); getName()));
final String NO_DESCR = NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.noDescr.text"); final String NO_DESCR = NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.noDescr.text");
for (Map.Entry<String, Object> entry : map.entrySet()) { for (Map.Entry<String, Object> entry : map.entrySet()) {
ss.put(new NodeProperty(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue())); ss.put(new NodeProperty<>(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue()));
} }
// @@@ add more properties here...
return s; return s;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -16,7 +16,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.datamodel; package org.sleuthkit.autopsy.datamodel;
import java.util.ArrayList; import java.util.ArrayList;
@ -65,17 +64,17 @@ public class LocalFileNode extends AbstractAbstractFileNode<AbstractFile> {
s.put(ss); s.put(ss);
} }
Map<String, Object> map = new LinkedHashMap<String, Object>(); Map<String, Object> map = new LinkedHashMap<>();
fillPropertyMap(map, content); fillPropertyMap(map, content);
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.desc"),
getName())); getName()));
final String NO_DESCR = NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.noDescr.text"); final String NO_DESCR = NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.noDescr.text");
for (Map.Entry<String, Object> entry : map.entrySet()) { for (Map.Entry<String, Object> entry : map.entrySet()) {
ss.put(new NodeProperty(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue())); ss.put(new NodeProperty<>(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue()));
} }
// @@@ add more properties here... // @@@ add more properties here...

View File

@ -25,19 +25,19 @@ import org.openide.nodes.PropertySupport;
* This class is used to represent the properties for each node. * This class is used to represent the properties for each node.
* *
*/ */
public class NodeProperty extends PropertySupport.ReadOnly { public class NodeProperty<T> extends PropertySupport.ReadOnly<T> {
private Object value; private T value;
@SuppressWarnings({"unchecked"}) @SuppressWarnings("unchecked")
public NodeProperty(String name, String displayName, String desc, Object value) { public NodeProperty(String name, String displayName, String desc, T value) {
super(name, value.getClass(), displayName, desc); super(name, (Class<T>) value.getClass(), displayName, desc);
setValue("suppressCustomEditor", Boolean.TRUE); // remove the "..." (editing) button setValue("suppressCustomEditor", Boolean.TRUE); // remove the "..." (editing) button
this.value = value; this.value = value;
} }
@Override @Override
public Object getValue() throws IllegalAccessException, InvocationTargetException { public T getValue() throws IllegalAccessException, InvocationTargetException {
return this.value; return this.value;
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -20,10 +20,8 @@ package org.sleuthkit.autopsy.datamodel;
import java.util.Calendar; import java.util.Calendar;
import java.util.Locale; import java.util.Locale;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children; import org.openide.nodes.Children;
import org.openide.nodes.Sheet; import org.openide.nodes.Sheet;
import org.openide.util.lookup.Lookups; import org.openide.util.lookup.Lookups;
@ -42,7 +40,6 @@ public class RecentFilesFilterNode extends DisplayableItemNode {
RecentFilesFilterNode(SleuthkitCase skCase, RecentFilesFilter filter, Calendar lastDay) { RecentFilesFilterNode(SleuthkitCase skCase, RecentFilesFilter filter, Calendar lastDay) {
super(Children.create(new RecentFilesFilterChildren(filter, skCase, lastDay), true), Lookups.singleton(filter.getDisplayName())); super(Children.create(new RecentFilesFilterChildren(filter, skCase, lastDay), true), Lookups.singleton(filter.getDisplayName()));
super.setName(filter.getName()); super.setName(filter.getName());
//super.setDisplayName(filter.getDisplayName());
this.skCase = skCase; this.skCase = skCase;
this.filter = filter; this.filter = filter;
Calendar prevDay = (Calendar) lastDay.clone(); Calendar prevDay = (Calendar) lastDay.clone();
@ -55,7 +52,6 @@ public class RecentFilesFilterNode extends DisplayableItemNode {
//get count of children without preloading all children nodes //get count of children without preloading all children nodes
final long count = new RecentFilesFilterChildren(filter, skCase, lastDay).calculateItems(); final long count = new RecentFilesFilterChildren(filter, skCase, lastDay).calculateItems();
//final long count = getChildren().getNodesCount(true);
super.setDisplayName(filter.getDisplayName() + " (" + count + ")"); super.setDisplayName(filter.getDisplayName() + " (" + count + ")");
} }
@ -73,7 +69,7 @@ public class RecentFilesFilterNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty( ss.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "RecentFilesFilterNode.createSheet.filterType.name"), NbBundle.getMessage(this.getClass(), "RecentFilesFilterNode.createSheet.filterType.name"),
NbBundle.getMessage(this.getClass(), "RecentFilesFilterNode.createSheet.filterType.displayName"), NbBundle.getMessage(this.getClass(), "RecentFilesFilterNode.createSheet.filterType.displayName"),
NbBundle.getMessage(this.getClass(), "RecentFilesFilterNode.createSheet.filterType.desc"), NbBundle.getMessage(this.getClass(), "RecentFilesFilterNode.createSheet.filterType.desc"),

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -18,7 +18,6 @@
*/ */
package org.sleuthkit.autopsy.datamodel; package org.sleuthkit.autopsy.datamodel;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children; import org.openide.nodes.Children;
import org.openide.nodes.Sheet; import org.openide.nodes.Sheet;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
@ -39,7 +38,6 @@ public class RecentFilesNode extends DisplayableItemNode {
super.setDisplayName(NAME); super.setDisplayName(NAME);
this.skCase = skCase; this.skCase = skCase;
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/recent_files.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/recent_files.png");
} }
@Override @Override
@ -61,10 +59,10 @@ public class RecentFilesNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "RecentFilesNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "RecentFilesNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "RecentFilesNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "RecentFilesNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "RecentFilesNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "RecentFilesNode.createSheet.name.desc"),
NAME)); NAME));
return s; return s;
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -37,8 +37,7 @@ public class ResultsNode extends DisplayableItemNode {
new HashsetHits(sleuthkitCase), new HashsetHits(sleuthkitCase),
new EmailExtracted(sleuthkitCase), new EmailExtracted(sleuthkitCase),
new InterestingHits(sleuthkitCase), new InterestingHits(sleuthkitCase),
new TagsNodeKey() new TagsNodeKey())), Lookups.singleton(NAME));
)), Lookups.singleton(NAME));
setName(NAME); setName(NAME);
setDisplayName(NAME); setDisplayName(NAME);
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/results.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/results.png");
@ -63,10 +62,10 @@ public class ResultsNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.desc"),
NAME)); NAME));
return s; return s;
} }
} }

View File

@ -34,17 +34,18 @@ import org.sleuthkit.datamodel.TskCoreException;
/** /**
* Instances of this class are elements of Node hierarchies consisting of * Instances of this class are elements of Node hierarchies consisting of
* content and blackboard artifact tags, grouped first by tag type, then by * content and blackboard artifact tags, grouped first by tag type, then by tag
* tag name. * name.
*/ */
public class TagNameNode extends DisplayableItemNode { public class TagNameNode extends DisplayableItemNode {
private static final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png"; private static final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png";
private static final String BOOKMARK_TAG_ICON_PATH = "org/sleuthkit/autopsy/images/star-bookmark-icon-16.png"; private static final String BOOKMARK_TAG_ICON_PATH = "org/sleuthkit/autopsy/images/star-bookmark-icon-16.png";
private final TagName tagName; private final TagName tagName;
private static final String CONTENT_TAG_TYPE_NODE_KEY = NbBundle.getMessage(TagNameNode.class, private static final String CONTENT_TAG_TYPE_NODE_KEY = NbBundle.getMessage(TagNameNode.class,
"TagNameNode.contentTagTypeNodeKey.text"); "TagNameNode.contentTagTypeNodeKey.text");
private static final String BLACKBOARD_ARTIFACT_TAG_TYPE_NODE_KEY = NbBundle.getMessage(TagNameNode.class, private static final String BLACKBOARD_ARTIFACT_TAG_TYPE_NODE_KEY = NbBundle.getMessage(TagNameNode.class,
"TagNameNode.bbArtTagTypeNodeKey.text"); "TagNameNode.bbArtTagTypeNodeKey.text");
public TagNameNode(TagName tagName) { public TagNameNode(TagName tagName) {
super(Children.create(new TagTypeNodeFactory(tagName), true), Lookups.singleton( super(Children.create(new TagTypeNodeFactory(tagName), true), Lookups.singleton(
@ -55,8 +56,7 @@ public class TagNameNode extends DisplayableItemNode {
try { try {
tagsCount = Case.getCurrentCase().getServices().getTagsManager().getContentTagsCountByTagName(tagName); tagsCount = Case.getCurrentCase().getServices().getTagsManager().getContentTagsCountByTagName(tagName);
tagsCount += Case.getCurrentCase().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagName(tagName); tagsCount += Case.getCurrentCase().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagName(tagName);
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(TagNameNode.class.getName()).log(Level.SEVERE, "Failed to get tags count for " + tagName.getDisplayName() + " tag name", ex); Logger.getLogger(TagNameNode.class.getName()).log(Level.SEVERE, "Failed to get tags count for " + tagName.getDisplayName() + " tag name", ex);
} }
@ -64,8 +64,7 @@ public class TagNameNode extends DisplayableItemNode {
super.setDisplayName(tagName.getDisplayName() + " (" + tagsCount + ")"); super.setDisplayName(tagName.getDisplayName() + " (" + tagsCount + ")");
if (tagName.getDisplayName().equals(NbBundle.getMessage(this.getClass(), "TagNameNode.bookmark.text"))) { if (tagName.getDisplayName().equals(NbBundle.getMessage(this.getClass(), "TagNameNode.bookmark.text"))) {
setIconBaseWithExtension(BOOKMARK_TAG_ICON_PATH); setIconBaseWithExtension(BOOKMARK_TAG_ICON_PATH);
} } else {
else {
setIconBaseWithExtension(ICON_PATH); setIconBaseWithExtension(ICON_PATH);
} }
} }
@ -79,10 +78,10 @@ public class TagNameNode extends DisplayableItemNode {
propertySheet.put(properties); propertySheet.put(properties);
} }
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "TagNameNode.createSheet.name.name"), properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "TagNameNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "TagNameNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "TagNameNode.createSheet.name.displayName"),
tagName.getDescription(), tagName.getDescription(),
getName())); getName()));
return propertySheet; return propertySheet;
} }
@ -100,6 +99,7 @@ public class TagNameNode extends DisplayableItemNode {
} }
private static class TagTypeNodeFactory extends ChildFactory<String> { private static class TagTypeNodeFactory extends ChildFactory<String> {
private final TagName tagName; private final TagName tagName;
TagTypeNodeFactory(TagName tagName) { TagTypeNodeFactory(TagName tagName) {
@ -136,4 +136,3 @@ public class TagNameNode extends DisplayableItemNode {
} }
} }
} }

View File

@ -34,10 +34,11 @@ import org.sleuthkit.datamodel.TskCoreException;
/** /**
* Instances of this class are the root nodes of tree that is a sub-tree of the * Instances of this class are the root nodes of tree that is a sub-tree of the
* Autopsy presentation of the SleuthKit data model. The sub-tree consists of * Autopsy presentation of the SleuthKit data model. The sub-tree consists of
* content and blackboard artifact tags, grouped first by tag type, then by * content and blackboard artifact tags, grouped first by tag type, then by tag
* tag name. * name.
*/ */
class TagsNode extends DisplayableItemNode { class TagsNode extends DisplayableItemNode {
private static final String DISPLAY_NAME = NbBundle.getMessage(TagsNode.class, "TagsNode.displayName.text"); private static final String DISPLAY_NAME = NbBundle.getMessage(TagsNode.class, "TagsNode.displayName.text");
private static final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png"; private static final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png";
@ -67,21 +68,21 @@ import org.sleuthkit.datamodel.TskCoreException;
propertySheet.put(properties); propertySheet.put(properties);
} }
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "TagsNode.createSheet.name.name"), properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "TagsNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "TagsNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "TagsNode.createSheet.name.displayName"),
"", "",
getName())); getName()));
return propertySheet; return propertySheet;
} }
private static class TagNameNodeFactory extends ChildFactory<TagName> { private static class TagNameNodeFactory extends ChildFactory<TagName> {
@Override @Override
protected boolean createKeys(List<TagName> keys) { protected boolean createKeys(List<TagName> keys) {
try { try {
keys.addAll(Case.getCurrentCase().getServices().getTagsManager().getTagNamesInUse()); keys.addAll(Case.getCurrentCase().getServices().getTagsManager().getTagNamesInUse());
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(TagNameNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); Logger.getLogger(TagNameNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
} }
return true; return true;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -38,8 +38,7 @@ public class ViewsNode extends DisplayableItemNode {
new FileTypeExtensionFilters(sleuthkitCase), new FileTypeExtensionFilters(sleuthkitCase),
new RecentFiles(sleuthkitCase), new RecentFiles(sleuthkitCase),
new DeletedContent(sleuthkitCase), new DeletedContent(sleuthkitCase),
new FileSize(sleuthkitCase) new FileSize(sleuthkitCase))),
)),
Lookups.singleton(NAME)); Lookups.singleton(NAME));
setName(NAME); setName(NAME);
setDisplayName(NAME); setDisplayName(NAME);
@ -65,10 +64,10 @@ public class ViewsNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.desc"),
NAME)); NAME));
return s; return s;
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 - 2013 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -38,7 +38,6 @@ import org.sleuthkit.datamodel.TskData;
public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirectory> { public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirectory> {
private static Logger logger = Logger.getLogger(VirtualDirectoryNode.class.getName()); private static Logger logger = Logger.getLogger(VirtualDirectoryNode.class.getName());
//prefix for special VirtualDirectory root nodes grouping local files //prefix for special VirtualDirectory root nodes grouping local files
public final static String LOGICAL_FILE_SET_PREFIX = "LogicalFileSet"; public final static String LOGICAL_FILE_SET_PREFIX = "LogicalFileSet";
@ -56,20 +55,17 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
//set icon for name, special case for some built-ins //set icon for name, special case for some built-ins
if (name.equals(VirtualDirectory.NAME_UNALLOC)) { if (name.equals(VirtualDirectory.NAME_UNALLOC)) {
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/folder-icon-deleted.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/folder-icon-deleted.png");
} } else if (name.startsWith(LOGICAL_FILE_SET_PREFIX)) {
else if (name.startsWith(LOGICAL_FILE_SET_PREFIX)) {
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/fileset-icon-16.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/fileset-icon-16.png");
} } else if (name.equals(VirtualDirectory.NAME_CARVED)) {
else if (name.equals(VirtualDirectory.NAME_CARVED)) {
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png"); //TODO this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png"); //TODO
} } else {
else {
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png");
} }
} }
/** /**
* Right click action for this node * Right click action for this node
* *
* @param popup * @param popup
@ -96,20 +92,19 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
s.put(ss); s.put(ss);
} }
Map<String, Object> map = new LinkedHashMap<String, Object>(); Map<String, Object> map = new LinkedHashMap<>();
fillPropertyMap(map, content); fillPropertyMap(map, content);
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"VirtualDirectoryNode.createSheet.name.displayName"), "VirtualDirectoryNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.name.desc"),
getName())); getName()));
final String NO_DESCR = NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.noDesc"); final String NO_DESCR = NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.noDesc");
for (Map.Entry<String, Object> entry : map.entrySet()) { for (Map.Entry<String, Object> entry : map.entrySet()) {
ss.put(new NodeProperty(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue())); ss.put(new NodeProperty<>(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue()));
} }
// @@@ add more properties here...
return s; return s;
} }
@ -129,7 +124,6 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
return true; return true;
} }
/** /**
* Convert meta flag long to user-readable string / label * Convert meta flag long to user-readable string / label
* *
@ -143,12 +137,6 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
short allocFlag = TskData.TSK_FS_META_FLAG_ENUM.ALLOC.getValue(); short allocFlag = TskData.TSK_FS_META_FLAG_ENUM.ALLOC.getValue();
short unallocFlag = TskData.TSK_FS_META_FLAG_ENUM.UNALLOC.getValue(); short unallocFlag = TskData.TSK_FS_META_FLAG_ENUM.UNALLOC.getValue();
// some variables that might be needed in the future
//long usedFlag = TskData.TSK_FS_META_FLAG_ENUM.USED.getMetaFlag();
//long unusedFlag = TskData.TSK_FS_META_FLAG_ENUM.UNUSED.getMetaFlag();
//long compFlag = TskData.TSK_FS_META_FLAG_ENUM.COMP.getMetaFlag();
//long orphanFlag = TskData.TSK_FS_META_FLAG_ENUM.ORPHAN.getMetaFlag();
if ((metaFlag & allocFlag) == allocFlag) { if ((metaFlag & allocFlag) == allocFlag) {
result = TskData.TSK_FS_META_FLAG_ENUM.ALLOC.toString(); result = TskData.TSK_FS_META_FLAG_ENUM.ALLOC.toString();
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -69,7 +69,7 @@ public class VolumeNode extends AbstractContentNode<Volume> {
*/ */
@Override @Override
public Action[] getActions(boolean popup) { public Action[] getActions(boolean popup) {
List<Action> actionsList = new ArrayList<Action>(); List<Action> actionsList = new ArrayList<>();
actionsList.add(new NewWindowViewAction( actionsList.add(new NewWindowViewAction(
NbBundle.getMessage(this.getClass(), "VolumeNode.getActions.viewInNewWin.text"), this)); NbBundle.getMessage(this.getClass(), "VolumeNode.getActions.viewInNewWin.text"), this));
@ -87,30 +87,30 @@ public class VolumeNode extends AbstractContentNode<Volume> {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.desc"),
this.getDisplayName())); this.getDisplayName()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.displayName"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.desc"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.desc"),
content.getAddr())); content.getAddr()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.displayName"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.desc"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.desc"),
content.getStart())); content.getStart()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.displayName"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.desc"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.desc"),
content.getLength())); content.getLength()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.displayName"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.desc"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.desc"),
content.getDescription())); content.getDescription()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.displayName"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.desc"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.desc"),
content.getFlagsAsString())); content.getFlagsAsString()));
return s; return s;
} }

View File

@ -72,7 +72,7 @@ public class BlackboardArtifactTagTypeNode extends DisplayableItemNode {
propertySheet.put(properties); propertySheet.put(properties);
} }
properties.put(new NodeProperty( properties.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagTypeNode.createSheet.name.name"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagTypeNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagTypeNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagTypeNode.createSheet.name.displayName"),
"", "",

View File

@ -180,7 +180,7 @@ class DirectoryTreeFilterChildren extends FilterNode.Children {
return isLeafDirectory(dn); return isLeafDirectory(dn);
} }
private Boolean visitDeep(AbstractAbstractFileNode node) { private Boolean visitDeep(AbstractAbstractFileNode<? extends AbstractFile> node) {
//is a leaf if has no children, or children are files not dirs //is a leaf if has no children, or children are files not dirs
boolean hasChildren = node.hasContentChildren(); boolean hasChildren = node.hasContentChildren();
if (!hasChildren) { if (!hasChildren) {

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -92,7 +92,7 @@ class DirectoryTreeFilterNode extends FilterNode {
*/ */
@Override @Override
public Action[] getActions(boolean popup) { public Action[] getActions(boolean popup) {
List<Action> actions = new ArrayList<Action>(); List<Action> actions = new ArrayList<>();
final Content content = this.getLookup().lookup(Content.class); final Content content = this.getLookup().lookup(Content.class);
if (content != null) { if (content != null) {
@ -112,15 +112,15 @@ class DirectoryTreeFilterNode extends FilterNode {
} }
//ingest action //ingest action
actions.add(new AbstractAction( actions.add(new AbstractAction(
NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.runIngestMods.text")) { NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.runIngestMods.text")) {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final IngestDialog ingestDialog = new IngestDialog(); final IngestDialog ingestDialog = new IngestDialog();
ingestDialog.setContent(Collections.<Content>singletonList(content)); ingestDialog.setContent(Collections.<Content>singletonList(content));
ingestDialog.display(); ingestDialog.display();
} }
}); });
} }
//check if delete actions should be added //check if delete actions should be added
@ -135,7 +135,7 @@ class DirectoryTreeFilterNode extends FilterNode {
} }
private static List<Action> getDeleteActions(DisplayableItemNode original) { private static List<Action> getDeleteActions(DisplayableItemNode original) {
List<Action> actions = new ArrayList<Action>(); List<Action> actions = new ArrayList<>();
//actions.addAll(original.accept(getDeleteActionVisitor)); //actions.addAll(original.accept(getDeleteActionVisitor));
return actions; return actions;
} }

View File

@ -76,6 +76,8 @@ public class NewWindowViewAction extends AbstractAction{
@Override @Override
public void run() { public void run() {
dctc.setNode(contentNode); dctc.setNode(contentNode);
dctc.toFront();
dctc.requestActive();
} }
}); });
} }

View File

@ -39,6 +39,7 @@ import org.sleuthkit.autopsy.datamodel.AbstractFsContentNode;
import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode;
import org.sleuthkit.autopsy.datamodel.DataSourcesNode; import org.sleuthkit.autopsy.datamodel.DataSourcesNode;
import org.sleuthkit.autopsy.datamodel.RootContentChildren; import org.sleuthkit.autopsy.datamodel.RootContentChildren;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.ContentVisitor; import org.sleuthkit.datamodel.ContentVisitor;
import org.sleuthkit.datamodel.FileSystem; import org.sleuthkit.datamodel.FileSystem;
@ -66,7 +67,7 @@ public class ViewContextAction extends AbstractAction {
} }
public ViewContextAction(String title, AbstractFsContentNode node) { public ViewContextAction(String title, AbstractFsContentNode<? extends AbstractFile> node) {
super(title); super(title);
this.content = node.getLookup().lookup(Content.class); this.content = node.getLookup().lookup(Content.class);
} }

View File

@ -32,7 +32,6 @@ package org.sleuthkit.autopsy.examples;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.services.FileManager; import org.sleuthkit.autopsy.casemodule.services.FileManager;
import org.sleuthkit.autopsy.casemodule.services.Services; import org.sleuthkit.autopsy.casemodule.services.Services;
@ -50,8 +49,7 @@ import org.sleuthkit.datamodel.TskCoreException;
* Sample DataSource-level ingest module that doesn't do much at all. * Sample DataSource-level ingest module that doesn't do much at all.
* Just exists to show basic idea of these modules * Just exists to show basic idea of these modules
*/ */
class SampleDataSourceIngestModule extends org.sleuthkit.autopsy.ingest.IngestModuleDataSource { public class SampleDataSourceIngestModule extends org.sleuthkit.autopsy.ingest.IngestModuleDataSource {
/* Data Source modules operate on a disk or set of logical files. They /* Data Source modules operate on a disk or set of logical files. They
* are passed in teh data source refernce and query it for things they want. * are passed in teh data source refernce and query it for things they want.
*/ */
@ -84,23 +82,19 @@ import org.sleuthkit.datamodel.TskCoreException;
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
Logger log = Logger.getLogger(SampleDataSourceIngestModule.class); Logger log = Logger.getLogger(SampleDataSourceIngestModule.class);
log.fatal("Error retrieving files from database: " + ex.getLocalizedMessage()); log.fatal("Error retrieving files from database: " + ex.getLocalizedMessage());
return;
} }
} }
@Override @Override
public void init(IngestModuleInit initContext) throws IngestModuleException { public void init(IngestModuleInit initContext) throws IngestModuleException {
// do nothing
} }
@Override @Override
public void complete() { public void complete() {
// do nothing
} }
@Override @Override
public void stop() { public void stop() {
// do nothing
} }
@Override @Override

View File

@ -1,33 +1,32 @@
/* /*
* Sample module in the public domain. Feel free to use this as a template * Sample module in the public domain. Feel free to use this as a template
* for your modules. * for your modules.
* *
* Contact: Brian Carrier [carrier <at> sleuthkit [dot] org] * Contact: Brian Carrier [carrier <at> sleuthkit [dot] org]
* *
* This is free and unencumbered software released into the public domain. * This is free and unencumbered software released into the public domain.
* *
* Anyone is free to copy, modify, publish, use, compile, sell, or * Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled * distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any * binary, for any purpose, commercial or non-commercial, and by any
* means. * means.
* *
* In jurisdictions that recognize copyright laws, the author or authors * In jurisdictions that recognize copyright laws, the author or authors
* of this software dedicate any and all copyright interest in the * of this software dedicate any and all copyright interest in the
* software to the public domain. We make this dedication for the benefit * software to the public domain. We make this dedication for the benefit
* of the public at large and to the detriment of our heirs and * of the public at large and to the detriment of our heirs and
* successors. We intend this dedication to be an overt act of * successors. We intend this dedication to be an overt act of
* relinquishment in perpetuity of all present and future rights to this * relinquishment in perpetuity of all present and future rights to this
* software under copyright law. * software under copyright law.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
package org.sleuthkit.autopsy.examples; package org.sleuthkit.autopsy.examples;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -44,16 +43,18 @@ import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskData; import org.sleuthkit.datamodel.TskData;
/** /**
* This is a sample and simple module. It is a file-level ingest module, meaning * This is a sample and simple module. It is a file-level ingest module, meaning
* that it will get called on each file in the disk image / logical file set. * that it will get called on each file in the disk image / logical file set. It
* It does a stupid calculation of the number of null bytes in the beginning of the * does a stupid calculation of the number of null bytes in the beginning of the
* file in order to show the basic flow. * file in order to show the basic flow.
* *
* Autopsy has been hard coded to ignore this module based on the it's package name. * Autopsy has been hard coded to ignore this module based on the it's package
* IngestModuleLoader will not load things from the org.sleuthkit.autopsy.examples package. * name. IngestModuleLoader will not load things from the
* Either change the package or the loading code to make this module actually run. * org.sleuthkit.autopsy.examples package. Either change the package or the
* loading code to make this module actually run.
*/ */
class SampleFileIngestModule extends org.sleuthkit.autopsy.ingest.IngestModuleAbstractFile { public class SampleFileIngestModule extends org.sleuthkit.autopsy.ingest.IngestModuleAbstractFile {
private int attrId = -1; private int attrId = -1;
private static SampleFileIngestModule defaultInstance = null; private static SampleFileIngestModule defaultInstance = null;
@ -70,7 +71,6 @@ import org.sleuthkit.datamodel.TskData;
return defaultInstance; return defaultInstance;
} }
@Override @Override
public void init(IngestModuleInit initContext) throws IngestModuleException { public void init(IngestModuleInit initContext) throws IngestModuleException {
/* For this demo, we are going to make a private attribute to post our /* For this demo, we are going to make a private attribute to post our
@ -101,8 +101,8 @@ import org.sleuthkit.datamodel.TskData;
@Override @Override
public ProcessResult process(PipelineContext<IngestModuleAbstractFile> pipelineContext, AbstractFile abstractFile) { public ProcessResult process(PipelineContext<IngestModuleAbstractFile> pipelineContext, AbstractFile abstractFile) {
// skip non-files // skip non-files
if ((abstractFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) || if ((abstractFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)
(abstractFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS)) { || (abstractFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS)) {
return ProcessResult.OK; return ProcessResult.OK;
} }
@ -144,15 +144,12 @@ import org.sleuthkit.datamodel.TskData;
} }
} }
@Override @Override
public void complete() { public void complete() {
} }
@Override @Override
public void stop() { public void stop() {
} }
@Override @Override
@ -172,7 +169,6 @@ import org.sleuthkit.datamodel.TskData;
@Override @Override
public boolean hasBackgroundJobsRunning() { public boolean hasBackgroundJobsRunning() {
// we're single threaded...
return false; return false;
} }
} }

View File

@ -204,7 +204,7 @@ class DateSearchFilter extends AbstractFileSearchFilter<DateSearchPanel> {
/** /**
* Inner class to put the separator inside the combo box. * Inner class to put the separator inside the combo box.
*/ */
static class ComboBoxRenderer extends JLabel implements ListCellRenderer { static class ComboBoxRenderer extends JLabel implements ListCellRenderer<String> {
JSeparator separator; JSeparator separator;
@ -215,8 +215,8 @@ class DateSearchFilter extends AbstractFileSearchFilter<DateSearchPanel> {
} }
@Override @Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList<? extends String> list, String value, int index, boolean isSelected, boolean cellHasFocus) {
String str = (value == null) ? "" : value.toString(); String str = (value == null) ? "" : value;
if (SEPARATOR.equals(str)) { if (SEPARATOR.equals(str)) {
return separator; return separator;
} }

View File

@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents> <NonVisualComponents>
@ -181,8 +181,9 @@
</Property> </Property>
</Properties> </Properties>
<AuxValues> <AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JComboBox(this.timeZones.toArray());"/> <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JComboBox&lt;&gt;(this.timeZones.toArray(new String[this.timeZones.size()]))"/>
<AuxValue name="JavaCodeGenerator_CreateCodePost" type="java.lang.String" value="timeZoneComboBox.setRenderer(new DateSearchFilter.ComboBoxRenderer());"/> <AuxValue name="JavaCodeGenerator_CreateCodePost" type="java.lang.String" value="timeZoneComboBox.setRenderer(new DateSearchFilter.ComboBoxRenderer());"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues> </AuxValues>
</Component> </Component>
<Component class="javax.swing.JLabel" name="jLabel3"> <Component class="javax.swing.JLabel" name="jLabel3">

View File

@ -102,7 +102,7 @@ class DateSearchPanel extends javax.swing.JPanel {
return modifiedCheckBox; return modifiedCheckBox;
} }
JComboBox getTimeZoneComboBox() { JComboBox<String> getTimeZoneComboBox() {
return timeZoneComboBox; return timeZoneComboBox;
} }
@ -132,7 +132,7 @@ class DateSearchPanel extends javax.swing.JPanel {
jLabel1 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel();
dateCheckBox = new javax.swing.JCheckBox(); dateCheckBox = new javax.swing.JCheckBox();
timeZoneComboBox = new JComboBox(this.timeZones.toArray()); timeZoneComboBox = new JComboBox<>(this.timeZones.toArray(new String[this.timeZones.size()]));
timeZoneComboBox.setRenderer(new DateSearchFilter.ComboBoxRenderer()); timeZoneComboBox.setRenderer(new DateSearchFilter.ComboBoxRenderer());
jLabel3 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel();
dateFromTextField = new JFormattedTextField(this.dateFormat); dateFromTextField = new JFormattedTextField(this.dateFormat);
@ -359,7 +359,7 @@ class DateSearchPanel extends javax.swing.JPanel {
private javax.swing.JMenuItem pasteMenuItem; private javax.swing.JMenuItem pasteMenuItem;
private javax.swing.JPopupMenu rightClickMenu; private javax.swing.JPopupMenu rightClickMenu;
private javax.swing.JMenuItem selectAllMenuItem; private javax.swing.JMenuItem selectAllMenuItem;
private javax.swing.JComboBox timeZoneComboBox; private javax.swing.JComboBox<String> timeZoneComboBox;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
void addActionListener(ActionListener l) { void addActionListener(ActionListener l) {

View File

@ -51,7 +51,7 @@ class SizeSearchFilter extends AbstractFileSearchFilter<SizeSearchPanel> {
return "size " + operator + " " + size; return "size " + operator + " " + size;
} }
private String compareComboBoxToOperator(JComboBox compare) { private String compareComboBoxToOperator(JComboBox<String> compare) {
String compareSize = compare.getSelectedItem().toString(); String compareSize = compare.getSelectedItem().toString();
if (compareSize.equals("equal to")) { if (compareSize.equals("equal to")) {

View File

@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents> <NonVisualComponents>
@ -79,16 +79,13 @@
<SubComponents> <SubComponents>
<Component class="javax.swing.JComboBox" name="sizeUnitComboBox"> <Component class="javax.swing.JComboBox" name="sizeUnitComboBox">
<Properties> <Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<StringArray count="5"> <Connection code="new javax.swing.DefaultComboBoxModel&lt;String&gt;(new String[] { &quot;Byte(s)&quot;, &quot;KB&quot;, &quot;MB&quot;, &quot;GB&quot;, &quot;TB&quot; })" type="code"/>
<StringItem index="0" value="Byte(s)"/>
<StringItem index="1" value="KB"/>
<StringItem index="2" value="MB"/>
<StringItem index="3" value="GB"/>
<StringItem index="4" value="TB"/>
</StringArray>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component> </Component>
<Component class="javax.swing.JFormattedTextField" name="sizeTextField"> <Component class="javax.swing.JFormattedTextField" name="sizeTextField">
<Properties> <Properties>
@ -105,14 +102,13 @@
</Component> </Component>
<Component class="javax.swing.JComboBox" name="sizeCompareComboBox"> <Component class="javax.swing.JComboBox" name="sizeCompareComboBox">
<Properties> <Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<StringArray count="3"> <Connection code="new javax.swing.DefaultComboBoxModel&lt;String&gt;(new String[] { &quot;equal to&quot;, &quot;greater than&quot;, &quot;less than&quot; })" type="code"/>
<StringItem index="0" value="equal to"/>
<StringItem index="1" value="greater than"/>
<StringItem index="2" value="less than"/>
</StringArray>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component> </Component>
<Component class="javax.swing.JCheckBox" name="sizeCheckBox"> <Component class="javax.swing.JCheckBox" name="sizeCheckBox">
<Properties> <Properties>

View File

@ -67,7 +67,7 @@ class SizeSearchPanel extends javax.swing.JPanel {
return sizeCheckBox; return sizeCheckBox;
} }
JComboBox getSizeCompareComboBox() { JComboBox<String> getSizeCompareComboBox() {
return sizeCompareComboBox; return sizeCompareComboBox;
} }
@ -75,7 +75,7 @@ class SizeSearchPanel extends javax.swing.JPanel {
return sizeTextField; return sizeTextField;
} }
JComboBox getSizeUnitComboBox() { JComboBox<String> getSizeUnitComboBox() {
return sizeUnitComboBox; return sizeUnitComboBox;
} }
@ -93,9 +93,9 @@ class SizeSearchPanel extends javax.swing.JPanel {
copyMenuItem = new javax.swing.JMenuItem(); copyMenuItem = new javax.swing.JMenuItem();
pasteMenuItem = new javax.swing.JMenuItem(); pasteMenuItem = new javax.swing.JMenuItem();
selectAllMenuItem = new javax.swing.JMenuItem(); selectAllMenuItem = new javax.swing.JMenuItem();
sizeUnitComboBox = new javax.swing.JComboBox(); sizeUnitComboBox = new javax.swing.JComboBox<String>();
sizeTextField = new JFormattedTextField(NumberFormat.getIntegerInstance()); sizeTextField = new JFormattedTextField(NumberFormat.getIntegerInstance());
sizeCompareComboBox = new javax.swing.JComboBox(); sizeCompareComboBox = new javax.swing.JComboBox<String>();
sizeCheckBox = new javax.swing.JCheckBox(); sizeCheckBox = new javax.swing.JCheckBox();
cutMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.cutMenuItem.text")); // NOI18N cutMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.cutMenuItem.text")); // NOI18N
@ -110,7 +110,7 @@ class SizeSearchPanel extends javax.swing.JPanel {
selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.selectAllMenuItem.text")); // NOI18N selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.selectAllMenuItem.text")); // NOI18N
rightClickMenu.add(selectAllMenuItem); rightClickMenu.add(selectAllMenuItem);
sizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Byte(s)", "KB", "MB", "GB", "TB" })); sizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "Byte(s)", "KB", "MB", "GB", "TB" }));
sizeTextField.setValue(0); sizeTextField.setValue(0);
sizeTextField.addMouseListener(new java.awt.event.MouseAdapter() { sizeTextField.addMouseListener(new java.awt.event.MouseAdapter() {
@ -119,7 +119,7 @@ class SizeSearchPanel extends javax.swing.JPanel {
} }
}); });
sizeCompareComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "equal to", "greater than", "less than" })); sizeCompareComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "equal to", "greater than", "less than" }));
sizeCheckBox.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.sizeCheckBox.text")); // NOI18N sizeCheckBox.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.sizeCheckBox.text")); // NOI18N
@ -157,9 +157,9 @@ class SizeSearchPanel extends javax.swing.JPanel {
private javax.swing.JPopupMenu rightClickMenu; private javax.swing.JPopupMenu rightClickMenu;
private javax.swing.JMenuItem selectAllMenuItem; private javax.swing.JMenuItem selectAllMenuItem;
private javax.swing.JCheckBox sizeCheckBox; private javax.swing.JCheckBox sizeCheckBox;
private javax.swing.JComboBox sizeCompareComboBox; private javax.swing.JComboBox<String> sizeCompareComboBox;
private javax.swing.JFormattedTextField sizeTextField; private javax.swing.JFormattedTextField sizeTextField;
private javax.swing.JComboBox sizeUnitComboBox; private javax.swing.JComboBox<String> sizeUnitComboBox;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
void addActionListener(ActionListener l) { void addActionListener(ActionListener l) {

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -20,7 +20,6 @@
package org.sleuthkit.autopsy.ingest; package org.sleuthkit.autopsy.ingest;
import java.util.List; import java.util.List;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Content;
@ -93,6 +92,7 @@ class DataSourceTask<T extends IngestModuleAbstract> {
if (getClass() != obj.getClass()) { if (getClass() != obj.getClass()) {
return false; return false;
} }
@SuppressWarnings("unchecked")
final DataSourceTask<T> other = (DataSourceTask<T>) obj; final DataSourceTask<T> other = (DataSourceTask<T>) obj;
if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) {
return false; return false;

View File

@ -343,7 +343,7 @@ public class IngestManager {
* @param pipelineContext ingest context used to ingest parent of the file * @param pipelineContext ingest context used to ingest parent of the file
* to be scheduled * to be scheduled
*/ */
void scheduleFile(AbstractFile file, PipelineContext pipelineContext) { void scheduleFile(AbstractFile file, PipelineContext<IngestModuleAbstractFile> pipelineContext) {
scheduler.getFileScheduler().schedule(file, pipelineContext); scheduler.getFileScheduler().schedule(file, pipelineContext);
} }

View File

@ -100,11 +100,11 @@
<EmptySpace min="-2" pref="101" max="-2" attributes="0"/> <EmptySpace min="-2" pref="101" max="-2" attributes="0"/>
<Component id="totalMessagesNameLabel" min="-2" max="-2" attributes="0"/> <Component id="totalMessagesNameLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="totalMessagesNameVal" pref="9" max="32767" attributes="0"/> <Component id="totalMessagesNameVal" pref="24" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/> <EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
<Component id="totalUniqueMessagesNameLabel" min="-2" max="-2" attributes="0"/> <Component id="totalUniqueMessagesNameLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="totalUniqueMessagesNameVal" pref="8" max="32767" attributes="0"/> <Component id="totalUniqueMessagesNameVal" pref="24" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/> <EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
@ -132,11 +132,8 @@
</Component> </Component>
<Component class="javax.swing.JComboBox" name="sortByComboBox"> <Component class="javax.swing.JComboBox" name="sortByComboBox">
<Properties> <Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<StringArray count="2"> <Connection code="new javax.swing.DefaultComboBoxModel&lt;String&gt;(new String[] { &quot;Time&quot;, &quot;Priority&quot; })" type="code"/>
<StringItem index="0" value="Time"/>
<StringItem index="1" value="Priority"/>
</StringArray>
</Property> </Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/ingest/Bundle.properties" key="IngestMessagePanel.sortByComboBox.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/ingest/Bundle.properties" key="IngestMessagePanel.sortByComboBox.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
@ -146,7 +143,7 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="sortByComboBoxActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="sortByComboBoxActionPerformed"/>
</Events> </Events>
<AuxValues> <AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;String&gt;()"/> <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues> </AuxValues>
</Component> </Component>
<Component class="javax.swing.JLabel" name="totalMessagesNameLabel"> <Component class="javax.swing.JLabel" name="totalMessagesNameLabel">

View File

@ -149,7 +149,7 @@ class IngestMessagePanel extends JPanel implements TableModelListener {
sortByLabel.setText(org.openide.util.NbBundle.getMessage(IngestMessagePanel.class, "IngestMessagePanel.sortByLabel.text")); // NOI18N sortByLabel.setText(org.openide.util.NbBundle.getMessage(IngestMessagePanel.class, "IngestMessagePanel.sortByLabel.text")); // NOI18N
sortByComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Time", "Priority" })); sortByComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "Time", "Priority" }));
sortByComboBox.setToolTipText(org.openide.util.NbBundle.getMessage(IngestMessagePanel.class, "IngestMessagePanel.sortByComboBox.toolTipText")); // NOI18N sortByComboBox.setToolTipText(org.openide.util.NbBundle.getMessage(IngestMessagePanel.class, "IngestMessagePanel.sortByComboBox.toolTipText")); // NOI18N
sortByComboBox.addActionListener(new java.awt.event.ActionListener() { sortByComboBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -177,11 +177,11 @@ class IngestMessagePanel extends JPanel implements TableModelListener {
.addGap(101, 101, 101) .addGap(101, 101, 101)
.addComponent(totalMessagesNameLabel) .addComponent(totalMessagesNameLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(totalMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, 9, Short.MAX_VALUE) .addComponent(totalMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
.addGap(22, 22, 22) .addGap(22, 22, 22)
.addComponent(totalUniqueMessagesNameLabel) .addComponent(totalUniqueMessagesNameLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(totalUniqueMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, 8, Short.MAX_VALUE) .addComponent(totalUniqueMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
.addGap(22, 22, 22)) .addGap(22, 22, 22))
); );
controlPanelLayout.setVerticalGroup( controlPanelLayout.setVerticalGroup(
@ -224,7 +224,7 @@ class IngestMessagePanel extends JPanel implements TableModelListener {
private javax.swing.JPanel controlPanel; private javax.swing.JPanel controlPanel;
private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable messageTable; private javax.swing.JTable messageTable;
private javax.swing.JComboBox sortByComboBox; private javax.swing.JComboBox<String> sortByComboBox;
private javax.swing.JLabel sortByLabel; private javax.swing.JLabel sortByLabel;
private javax.swing.JLabel totalMessagesNameLabel; private javax.swing.JLabel totalMessagesNameLabel;
private javax.swing.JLabel totalMessagesNameVal; private javax.swing.JLabel totalMessagesNameVal;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2012-2013 Basis Technology Corp. * Copyright 2012-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -369,8 +369,8 @@ class IngestScheduler {
* @param originalContext original content schedule context that was used * @param originalContext original content schedule context that was used
* to schedule the parent origin content, with the modules, settings, etc. * to schedule the parent origin content, with the modules, settings, etc.
*/ */
synchronized void schedule(AbstractFile file, PipelineContext originalContext) { synchronized void schedule(AbstractFile file, PipelineContext<IngestModuleAbstractFile> originalContext) {
DataSourceTask originalTask = originalContext.getDataSourceTask(); DataSourceTask<IngestModuleAbstractFile> originalTask = originalContext.getDataSourceTask();
//skip if task contains no modules //skip if task contains no modules
if (originalTask.getModules().isEmpty()) { if (originalTask.getModules().isEmpty()) {
@ -393,7 +393,6 @@ class IngestScheduler {
* @param context context to schedule, with scheduled task containing content to process and modules * @param context context to schedule, with scheduled task containing content to process and modules
*/ */
synchronized void schedule(DataSourceTask<IngestModuleAbstractFile> task) { synchronized void schedule(DataSourceTask<IngestModuleAbstractFile> task) {
//skip if task contains no modules //skip if task contains no modules
if (task.getModules().isEmpty()) { if (task.getModules().isEmpty()) {
return; return;

View File

@ -136,7 +136,7 @@ public class IngestServices {
* @param file file to be scheduled * @param file file to be scheduled
* @param pipelineContext the ingest context for the file ingest pipeline * @param pipelineContext the ingest context for the file ingest pipeline
*/ */
public void scheduleFile(AbstractFile file, PipelineContext pipelineContext) { public void scheduleFile(AbstractFile file, PipelineContext<IngestModuleAbstractFile> pipelineContext) {
logger.log(Level.INFO, "Scheduling file: " + file.getName()); logger.log(Level.INFO, "Scheduling file: " + file.getName());
manager.scheduleFile(file, pipelineContext); manager.scheduleFile(file, pipelineContext);
} }

View File

@ -65,6 +65,7 @@ public class PipelineContext <T extends IngestModuleAbstract> {
if (getClass() != obj.getClass()) { if (getClass() != obj.getClass()) {
return false; return false;
} }
@SuppressWarnings("unchecked")
final PipelineContext<T> other = (PipelineContext<T>) obj; final PipelineContext<T> other = (PipelineContext<T>) obj;
if (!Objects.equals(this.task, other.task)) { if (!Objects.equals(this.task, other.task)) {

View File

@ -85,6 +85,10 @@
<Property name="selectionMode" type="int" value="0"/> <Property name="selectionMode" type="int" value="0"/>
<Property name="layoutOrientation" type="int" value="2"/> <Property name="layoutOrientation" type="int" value="2"/>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JList&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;ARTIFACT_TYPE&gt;"/>
</AuxValues>
</Component> </Component>
</SubComponents> </SubComponents>
</Container> </Container>

View File

@ -36,7 +36,6 @@ import javax.swing.JList;
import javax.swing.ListCellRenderer; import javax.swing.ListCellRenderer;
import javax.swing.ListModel; import javax.swing.ListModel;
import javax.swing.event.ListDataListener; import javax.swing.event.ListDataListener;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
@ -45,9 +44,9 @@ import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
public class ArtifactSelectionDialog extends javax.swing.JDialog { public class ArtifactSelectionDialog extends javax.swing.JDialog {
private ArtifactModel model; private ArtifactModel model;
private ArtifactRenderer renderer; private ArtifactRenderer renderer;
private Map<BlackboardArtifact.ARTIFACT_TYPE, Boolean> artifactStates; private Map<BlackboardArtifact.ARTIFACT_TYPE, Boolean> artifactStates;
private List<BlackboardArtifact.ARTIFACT_TYPE> artifacts; private List<BlackboardArtifact.ARTIFACT_TYPE> artifacts;
@ -66,7 +65,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
*/ */
private void populateList() { private void populateList() {
try { try {
ArrayList<BlackboardArtifact.ARTIFACT_TYPE> doNotReport = new ArrayList(); ArrayList<BlackboardArtifact.ARTIFACT_TYPE> doNotReport = new ArrayList<>();
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO); doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO);
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE); // Obsolete artifact type doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE); // Obsolete artifact type
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT); // Obsolete artifact type doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT); // Obsolete artifact type
@ -101,7 +100,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
public void mousePressed(MouseEvent evt) { public void mousePressed(MouseEvent evt) {
JList list = (JList) evt.getSource(); JList list = (JList) evt.getSource();
int index = list.locationToIndex(evt.getPoint()); int index = list.locationToIndex(evt.getPoint());
BlackboardArtifact.ARTIFACT_TYPE type = (BlackboardArtifact.ARTIFACT_TYPE) model.getElementAt(index); BlackboardArtifact.ARTIFACT_TYPE type = model.getElementAt(index);
artifactStates.put(type, !artifactStates.get(type)); artifactStates.put(type, !artifactStates.get(type));
list.repaint(); list.repaint();
} }
@ -135,7 +134,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
private void initComponents() { private void initComponents() {
artifactScrollPane = new javax.swing.JScrollPane(); artifactScrollPane = new javax.swing.JScrollPane();
artifactList = new javax.swing.JList(); artifactList = new javax.swing.JList<>();
okButton = new javax.swing.JButton(); okButton = new javax.swing.JButton();
titleLabel = new javax.swing.JLabel(); titleLabel = new javax.swing.JLabel();
selectAllButton = new javax.swing.JButton(); selectAllButton = new javax.swing.JButton();
@ -229,9 +228,8 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
} }
artifactList.repaint(); artifactList.repaint();
}//GEN-LAST:event_deselectAllButtonActionPerformed }//GEN-LAST:event_deselectAllButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JList artifactList; private javax.swing.JList<ARTIFACT_TYPE> artifactList;
private javax.swing.JScrollPane artifactScrollPane; private javax.swing.JScrollPane artifactScrollPane;
private javax.swing.JButton deselectAllButton; private javax.swing.JButton deselectAllButton;
private javax.swing.JButton okButton; private javax.swing.JButton okButton;
@ -239,7 +237,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
private javax.swing.JLabel titleLabel; private javax.swing.JLabel titleLabel;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
private class ArtifactModel implements ListModel { private class ArtifactModel implements ListModel<ARTIFACT_TYPE> {
@Override @Override
public int getSize() { public int getSize() {
@ -247,7 +245,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
} }
@Override @Override
public Object getElementAt(int index) { public ARTIFACT_TYPE getElementAt(int index) {
return artifacts.get(index); return artifacts.get(index);
} }
@ -263,7 +261,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
private class ArtifactRenderer extends JCheckBox implements ListCellRenderer<BlackboardArtifact.ARTIFACT_TYPE> { private class ArtifactRenderer extends JCheckBox implements ListCellRenderer<BlackboardArtifact.ARTIFACT_TYPE> {
@Override @Override
public Component getListCellRendererComponent(JList list, BlackboardArtifact.ARTIFACT_TYPE value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList<? extends ARTIFACT_TYPE> list, ARTIFACT_TYPE value, int index, boolean isSelected, boolean cellHasFocus) {
if (value != null) { if (value != null) {
setEnabled(list.isEnabled()); setEnabled(list.isEnabled());
setSelected(artifactStates.get(value)); setSelected(artifactStates.get(value));

View File

@ -345,7 +345,7 @@ import org.sleuthkit.datamodel.TskData;
return absFiles; return absFiles;
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
// TODO // TODO
return Collections.EMPTY_LIST; return Collections.<AbstractFile>emptyList();
} }
} }
@ -515,7 +515,6 @@ import org.sleuthkit.datamodel.TskData;
module.addRow(rowData); module.addRow(rowData);
} }
} }
// Finish up this data type // Finish up this data type
for (TableReportModule module : tableModules) { for (TableReportModule module : tableModules) {
tableProgress.get(module).increment(); tableProgress.get(module).increment();

View File

@ -123,16 +123,14 @@
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="f0" green="f0" red="f0" type="rgb"/> <Color blue="f0" green="f0" red="f0" type="rgb"/>
</Property> </Property>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor"> <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<StringArray count="5"> <Connection code="new javax.swing.AbstractListModel&lt;ReportModule&gt;() {&#xa; ReportModule[] modules = {};&#xa; public int getSize() { return modules.length; }&#xa; public ReportModule getElementAt(int i) { return modules[i]; }&#xa;}" type="code"/>
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringItem index="4" value="Item 5"/>
</StringArray>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JList&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;ReportModule&gt;"/>
</AuxValues>
</Component> </Component>
</SubComponents> </SubComponents>
</Container> </Container>

View File

@ -93,7 +93,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
modulesJList.getSelectionModel().addListSelectionListener(this); modulesJList.getSelectionModel().addListSelectionListener(this);
modulesJList.setCellRenderer(new ModuleCellRenderer()); modulesJList.setCellRenderer(new ModuleCellRenderer());
modulesJList.setListData(modules.toArray()); modulesJList.setListData(modules.toArray(new ReportModule[modules.size()]));
selectedIndex = 0; selectedIndex = 0;
modulesJList.setSelectedIndex(selectedIndex); modulesJList.setSelectedIndex(selectedIndex);
} }
@ -162,7 +162,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
descriptionScrollPane = new javax.swing.JScrollPane(); descriptionScrollPane = new javax.swing.JScrollPane();
descriptionTextPane = new javax.swing.JTextPane(); descriptionTextPane = new javax.swing.JTextPane();
modulesScrollPane = new javax.swing.JScrollPane(); modulesScrollPane = new javax.swing.JScrollPane();
modulesJList = new javax.swing.JList(); modulesJList = new javax.swing.JList<>();
setPreferredSize(new java.awt.Dimension(650, 250)); setPreferredSize(new java.awt.Dimension(650, 250));
@ -188,10 +188,10 @@ import org.sleuthkit.autopsy.coreutils.Logger;
descriptionScrollPane.setViewportView(descriptionTextPane); descriptionScrollPane.setViewportView(descriptionTextPane);
modulesJList.setBackground(new java.awt.Color(240, 240, 240)); modulesJList.setBackground(new java.awt.Color(240, 240, 240));
modulesJList.setModel(new javax.swing.AbstractListModel() { modulesJList.setModel(new javax.swing.AbstractListModel<ReportModule>() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; ReportModule[] modules = {};
public int getSize() { return strings.length; } public int getSize() { return modules.length; }
public Object getElementAt(int i) { return strings[i]; } public ReportModule getElementAt(int i) { return modules[i]; }
}); });
modulesScrollPane.setViewportView(modulesJList); modulesScrollPane.setViewportView(modulesJList);
@ -229,7 +229,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
private javax.swing.JPanel configurationPanel; private javax.swing.JPanel configurationPanel;
private javax.swing.JScrollPane descriptionScrollPane; private javax.swing.JScrollPane descriptionScrollPane;
private javax.swing.JTextPane descriptionTextPane; private javax.swing.JTextPane descriptionTextPane;
private javax.swing.JList modulesJList; private javax.swing.JList<ReportModule> modulesJList;
private javax.swing.JScrollPane modulesScrollPane; private javax.swing.JScrollPane modulesScrollPane;
private javax.swing.JLabel reportModulesLabel; private javax.swing.JLabel reportModulesLabel;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
@ -264,7 +264,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
private class ModuleCellRenderer extends JRadioButton implements ListCellRenderer<ReportModule> { private class ModuleCellRenderer extends JRadioButton implements ListCellRenderer<ReportModule> {
@Override @Override
public Component getListCellRendererComponent(JList list, ReportModule value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList<? extends ReportModule> list, ReportModule value, int index, boolean isSelected, boolean cellHasFocus) {
this.setText(value.getName()); this.setText(value.getName());
this.setEnabled(true); this.setEnabled(true);
this.setSelected(isSelected); this.setSelected(isSelected);

View File

@ -143,6 +143,10 @@
<Property name="selectionMode" type="int" value="0"/> <Property name="selectionMode" type="int" value="0"/>
<Property name="layoutOrientation" type="int" value="1"/> <Property name="layoutOrientation" type="int" value="1"/>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JList&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component> </Component>
</SubComponents> </SubComponents>
</Container> </Container>

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -45,16 +45,14 @@ import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
final class ReportVisualPanel2 extends JPanel { final class ReportVisualPanel2 extends JPanel {
private ReportWizardPanel2 wizPanel;
private ReportWizardPanel2 wizPanel;
private Map<String, Boolean> tagStates = new LinkedHashMap<>(); private Map<String, Boolean> tagStates = new LinkedHashMap<>();
private List<String> tags = new ArrayList<>(); private List<String> tags = new ArrayList<>();
ArtifactSelectionDialog dialog = new ArtifactSelectionDialog(new JFrame(), true); ArtifactSelectionDialog dialog = new ArtifactSelectionDialog(new JFrame(), true);
private Map<ARTIFACT_TYPE, Boolean> artifactStates = new EnumMap<>(ARTIFACT_TYPE.class); private Map<ARTIFACT_TYPE, Boolean> artifactStates = new EnumMap<>(ARTIFACT_TYPE.class);
private List<ARTIFACT_TYPE> artifacts = new ArrayList<>(); private List<ARTIFACT_TYPE> artifacts = new ArrayList<>();
private TagsListModel tagsModel; private TagsListModel tagsModel;
private TagsListRenderer tagsRenderer; private TagsListRenderer tagsRenderer;
@ -77,13 +75,12 @@ import org.sleuthkit.datamodel.TskCoreException;
List<TagName> tagNamesInUse; List<TagName> tagNamesInUse;
try { try {
tagNamesInUse = Case.getCurrentCase().getServices().getTagsManager().getTagNamesInUse(); tagNamesInUse = Case.getCurrentCase().getServices().getTagsManager().getTagNamesInUse();
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(ReportVisualPanel2.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); Logger.getLogger(ReportVisualPanel2.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
return; return;
} }
for(TagName tagName : tagNamesInUse) { for (TagName tagName : tagNamesInUse) {
tagStates.put(tagName.getDisplayName(), Boolean.FALSE); tagStates.put(tagName.getDisplayName(), Boolean.FALSE);
} }
tags.addAll(tagStates.keySet()); tags.addAll(tagStates.keySet());
@ -100,7 +97,7 @@ import org.sleuthkit.datamodel.TskCoreException;
public void mousePressed(MouseEvent evt) { public void mousePressed(MouseEvent evt) {
JList list = (JList) evt.getSource(); JList list = (JList) evt.getSource();
int index = list.locationToIndex(evt.getPoint()); int index = list.locationToIndex(evt.getPoint());
String value = (String) tagsModel.getElementAt(index); String value = tagsModel.getElementAt(index);
tagStates.put(value, !tagStates.get(value)); tagStates.put(value, !tagStates.get(value));
list.repaint(); list.repaint();
updateFinishButton(); updateFinishButton();
@ -112,7 +109,7 @@ import org.sleuthkit.datamodel.TskCoreException;
private void initArtifactTypes() { private void initArtifactTypes() {
try { try {
ArrayList<BlackboardArtifact.ARTIFACT_TYPE> doNotReport = new ArrayList(); ArrayList<BlackboardArtifact.ARTIFACT_TYPE> doNotReport = new ArrayList<>();
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO); doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO);
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE); // Obsolete artifact type doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE); // Obsolete artifact type
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT); // Obsolete artifact type doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT); // Obsolete artifact type
@ -151,7 +148,7 @@ import org.sleuthkit.datamodel.TskCoreException;
private boolean areTagsSelected() { private boolean areTagsSelected() {
boolean result = false; boolean result = false;
for (Entry<String, Boolean> entry: tagStates.entrySet()) { for (Entry<String, Boolean> entry : tagStates.entrySet()) {
if (entry.getValue()) { if (entry.getValue()) {
result = true; result = true;
} }
@ -161,7 +158,7 @@ import org.sleuthkit.datamodel.TskCoreException;
private boolean areArtifactsSelected() { private boolean areArtifactsSelected() {
boolean result = false; boolean result = false;
for (Entry<ARTIFACT_TYPE, Boolean> entry: artifactStates.entrySet()) { for (Entry<ARTIFACT_TYPE, Boolean> entry : artifactStates.entrySet()) {
if (entry.getValue()) { if (entry.getValue()) {
result = true; result = true;
} }
@ -199,7 +196,7 @@ import org.sleuthkit.datamodel.TskCoreException;
selectAllButton = new javax.swing.JButton(); selectAllButton = new javax.swing.JButton();
deselectAllButton = new javax.swing.JButton(); deselectAllButton = new javax.swing.JButton();
tagsScrollPane = new javax.swing.JScrollPane(); tagsScrollPane = new javax.swing.JScrollPane();
tagsList = new javax.swing.JList(); tagsList = new javax.swing.JList<>();
advancedButton = new javax.swing.JButton(); advancedButton = new javax.swing.JButton();
setPreferredSize(new java.awt.Dimension(650, 250)); setPreferredSize(new java.awt.Dimension(650, 250));
@ -316,7 +313,6 @@ import org.sleuthkit.datamodel.TskCoreException;
artifactStates = dialog.display(); artifactStates = dialog.display();
wizPanel.setFinish(areArtifactsSelected()); wizPanel.setFinish(areArtifactsSelected());
}//GEN-LAST:event_advancedButtonActionPerformed }//GEN-LAST:event_advancedButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton advancedButton; private javax.swing.JButton advancedButton;
private javax.swing.JRadioButton allResultsRadioButton; private javax.swing.JRadioButton allResultsRadioButton;
@ -325,11 +321,11 @@ import org.sleuthkit.datamodel.TskCoreException;
private javax.swing.ButtonGroup optionsButtonGroup; private javax.swing.ButtonGroup optionsButtonGroup;
private javax.swing.JButton selectAllButton; private javax.swing.JButton selectAllButton;
private javax.swing.JRadioButton taggedResultsRadioButton; private javax.swing.JRadioButton taggedResultsRadioButton;
private javax.swing.JList tagsList; private javax.swing.JList<String> tagsList;
private javax.swing.JScrollPane tagsScrollPane; private javax.swing.JScrollPane tagsScrollPane;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
private class TagsListModel implements ListModel { private class TagsListModel implements ListModel<String> {
@Override @Override
public int getSize() { public int getSize() {
@ -337,7 +333,7 @@ import org.sleuthkit.datamodel.TskCoreException;
} }
@Override @Override
public Object getElementAt(int index) { public String getElementAt(int index) {
return tags.get(index); return tags.get(index);
} }
@ -351,10 +347,10 @@ import org.sleuthkit.datamodel.TskCoreException;
} }
// Render the Tags as JCheckboxes // Render the Tags as JCheckboxes
private class TagsListRenderer extends JCheckBox implements ListCellRenderer { private class TagsListRenderer extends JCheckBox implements ListCellRenderer<String> {
@Override @Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList<? extends String> list, String value, int index, boolean isSelected, boolean cellHasFocus) {
if (value != null) { if (value != null) {
setEnabled(list.isEnabled()); setEnabled(list.isEnabled());
setSelected(tagStates.get(value.toString())); setSelected(tagStates.get(value.toString()));

View File

@ -64,11 +64,13 @@ public final class ReportWizardAction extends CallableSystemAction implements P
* When the wizard is finished, create a ReportGenerator with the wizard information, * When the wizard is finished, create a ReportGenerator with the wizard information,
* and start all necessary reports. * and start all necessary reports.
*/ */
@SuppressWarnings("unchecked")
public static void doReportWizard() { public static void doReportWizard() {
WizardDescriptor wiz = new WizardDescriptor(new ReportWizardIterator()); WizardDescriptor wiz = new WizardDescriptor(new ReportWizardIterator());
wiz.setTitleFormat(new MessageFormat("{0} {1}")); wiz.setTitleFormat(new MessageFormat("{0} {1}"));
wiz.setTitle(NbBundle.getMessage(ReportWizardAction.class, "ReportWizardAction.reportWiz.title")); wiz.setTitle(NbBundle.getMessage(ReportWizardAction.class, "ReportWizardAction.reportWiz.title"));
if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) { if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
@SuppressWarnings("unchecked")
ReportGenerator generator = new ReportGenerator((Map<TableReportModule, Boolean>)wiz.getProperty("tableModuleStates"), ReportGenerator generator = new ReportGenerator((Map<TableReportModule, Boolean>)wiz.getProperty("tableModuleStates"),
(Map<GeneralReportModule, Boolean>)wiz.getProperty("generalModuleStates"), (Map<GeneralReportModule, Boolean>)wiz.getProperty("generalModuleStates"),
(Map<FileReportModule, Boolean>)wiz.getProperty("fileModuleStates")); (Map<FileReportModule, Boolean>)wiz.getProperty("fileModuleStates"));

View File

@ -63,16 +63,14 @@
<SubComponents> <SubComponents>
<Component class="javax.swing.JList" name="optionsList"> <Component class="javax.swing.JList" name="optionsList">
<Properties> <Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor"> <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<StringArray count="5"> <Connection code="new javax.swing.AbstractListModel&lt;FileReportDataTypes&gt;() {&#xa; FileReportDataTypes[] types = { };&#xa; public int getSize() { return types.length; }&#xa; public FileReportDataTypes getElementAt(int i) { return types[i]; }&#xa;}" type="code"/>
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringItem index="4" value="Item 5"/>
</StringArray>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JList&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;FileReportDataTypes&gt;"/>
</AuxValues>
</Component> </Component>
</SubComponents> </SubComponents>
</Container> </Container>

View File

@ -42,7 +42,7 @@ import javax.swing.event.ListDataListener;
class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel { class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
private List<FileReportDataTypes> options; private List<FileReportDataTypes> options;
private Map<FileReportDataTypes, Boolean> optionStates = new EnumMap<>(FileReportDataTypes.class); private Map<FileReportDataTypes, Boolean> optionStates = new EnumMap<>(FileReportDataTypes.class);
private ListModel model; private ListModel<FileReportDataTypes> model;
private ReportWizardFileOptionsPanel wizPanel; private ReportWizardFileOptionsPanel wizPanel;
@ -80,7 +80,7 @@ class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
public void mousePressed(MouseEvent evt) { public void mousePressed(MouseEvent evt) {
JList list = (JList) evt.getSource(); JList list = (JList) evt.getSource();
int index = list.locationToIndex(evt.getPoint()); int index = list.locationToIndex(evt.getPoint());
FileReportDataTypes value = (FileReportDataTypes) model.getElementAt(index); FileReportDataTypes value = model.getElementAt(index);
optionStates.put(value, !optionStates.get(value)); optionStates.put(value, !optionStates.get(value));
list.repaint(); list.repaint();
boolean anySelected = anySelected(); boolean anySelected = anySelected();
@ -134,15 +134,15 @@ class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
private void initComponents() { private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane(); jScrollPane1 = new javax.swing.JScrollPane();
optionsList = new javax.swing.JList(); optionsList = new javax.swing.JList<>();
selectAllButton = new javax.swing.JButton(); selectAllButton = new javax.swing.JButton();
deselectAllButton = new javax.swing.JButton(); deselectAllButton = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel();
optionsList.setModel(new javax.swing.AbstractListModel() { optionsList.setModel(new javax.swing.AbstractListModel<FileReportDataTypes>() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; FileReportDataTypes[] types = { };
public int getSize() { return strings.length; } public int getSize() { return types.length; }
public Object getElementAt(int i) { return strings[i]; } public FileReportDataTypes getElementAt(int i) { return types[i]; }
}); });
jScrollPane1.setViewportView(optionsList); jScrollPane1.setViewportView(optionsList);
@ -219,11 +219,11 @@ class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
private javax.swing.JButton deselectAllButton; private javax.swing.JButton deselectAllButton;
private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JList optionsList; private javax.swing.JList<FileReportDataTypes> optionsList;
private javax.swing.JButton selectAllButton; private javax.swing.JButton selectAllButton;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
private class OptionsListModel implements ListModel { private class OptionsListModel implements ListModel<FileReportDataTypes> {
@Override @Override
public int getSize() { public int getSize() {
@ -231,7 +231,7 @@ class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
} }
@Override @Override
public Object getElementAt(int index) { public FileReportDataTypes getElementAt(int index) {
return options.get(index); return options.get(index);
} }
@ -247,12 +247,12 @@ class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
/** /**
* Render each item in the list to be a selectable check box. * Render each item in the list to be a selectable check box.
*/ */
private class OptionsListRenderer extends JCheckBox implements ListCellRenderer { private class OptionsListRenderer extends JCheckBox implements ListCellRenderer<FileReportDataTypes> {
@Override @Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList<? extends FileReportDataTypes> list, FileReportDataTypes value, int index, boolean isSelected, boolean cellHasFocus) {
if (value != null) { if (value != null) {
FileReportDataTypes col = (FileReportDataTypes) value; FileReportDataTypes col = value;
setEnabled(list.isEnabled()); setEnabled(list.isEnabled());
setSelected(optionStates.get(col)); setSelected(optionStates.get(col));
setFont(list.getFont()); setFont(list.getFont());

View File

@ -49,6 +49,7 @@ import org.openide.util.NbPreferences;
private WizardDescriptor.Panel<WizardDescriptor>[] fileConfigPanels; private WizardDescriptor.Panel<WizardDescriptor>[] fileConfigPanels;
private String[] fileConfigIndex; private String[] fileConfigIndex;
@SuppressWarnings({"rawtypes", "unchecked"})
ReportWizardIterator() { ReportWizardIterator() {
firstPanel = new ReportWizardPanel1(); firstPanel = new ReportWizardPanel1();
tableConfigPanel = new ReportWizardPanel2(); tableConfigPanel = new ReportWizardPanel2();

View File

@ -1,6 +1,6 @@
Manifest-Version: 1.0 Manifest-Version: 1.0
AutoUpdate-Show-In-Client: true AutoUpdate-Show-In-Client: true
OpenIDE-Module: org.sleuthkit.autopsy.exifparser/3 OpenIDE-Module: org.sleuthkit.autopsy.exifparser/3
OpenIDE-Module-Implementation-Version: 9 OpenIDE-Module-Implementation-Version: 10
OpenIDE-Module-Layer: org/sleuthkit/autopsy/exifparser/layer.xml OpenIDE-Module-Layer: org/sleuthkit/autopsy/exifparser/layer.xml
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/exifparser/Bundle.properties OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/exifparser/Bundle.properties

View File

@ -20,7 +20,7 @@
<compile-dependency/> <compile-dependency/>
<run-dependency> <run-dependency>
<release-version>9</release-version> <release-version>9</release-version>
<specification-version>7.0</specification-version> <specification-version>7.1</specification-version>
</run-dependency> </run-dependency>
</dependency> </dependency>
</module-dependencies> </module-dependencies>

View File

@ -120,7 +120,7 @@ class FileExtMismatchXML {
Element extEl = (Element)extNList.item(extIndex); Element extEl = (Element)extNList.item(extIndex);
extStrings.add(extEl.getTextContent()); extStrings.add(extEl.getTextContent());
} }
String[] sarray = (String[])extStrings.toArray(new String[0]); String[] sarray = extStrings.toArray(new String[0]);
sigTypeToExtMap.put(mimetype, sarray); sigTypeToExtMap.put(mimetype, sarray);
} else { } else {
sigTypeToExtMap.put(mimetype, null); //ok to have an empty type (the ingest module will not use it) sigTypeToExtMap.put(mimetype, null); //ok to have an empty type (the ingest module will not use it)

View File

@ -1,7 +1,7 @@
Manifest-Version: 1.0 Manifest-Version: 1.0
AutoUpdate-Show-In-Client: true AutoUpdate-Show-In-Client: true
OpenIDE-Module: org.sleuthkit.autopsy.hashdatabase/3 OpenIDE-Module: org.sleuthkit.autopsy.hashdatabase/3
OpenIDE-Module-Implementation-Version: 9 OpenIDE-Module-Implementation-Version: 10
OpenIDE-Module-Layer: org/sleuthkit/autopsy/hashdatabase/layer.xml OpenIDE-Module-Layer: org/sleuthkit/autopsy/hashdatabase/layer.xml
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/hashdatabase/Bundle.properties OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/hashdatabase/Bundle.properties

View File

@ -78,7 +78,7 @@
<compile-dependency/> <compile-dependency/>
<run-dependency> <run-dependency>
<release-version>9</release-version> <release-version>9</release-version>
<specification-version>7.0</specification-version> <specification-version>7.1</specification-version>
</run-dependency> </run-dependency>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 - 2013 Basis Technology Corp. * Copyright 2011 - 2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -16,7 +16,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.hashdatabase; package org.sleuthkit.autopsy.hashdatabase;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
@ -31,7 +30,6 @@ import javax.swing.filechooser.FileNameExtensionFilter;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.coreutils.XMLUtil; import org.sleuthkit.autopsy.coreutils.XMLUtil;
@ -48,7 +46,6 @@ import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.netbeans.api.progress.ProgressHandle; import org.netbeans.api.progress.ProgressHandle;
import org.netbeans.api.progress.ProgressHandleFactory; import org.netbeans.api.progress.ProgressHandleFactory;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Content;
@ -59,9 +56,10 @@ import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.IngestManager;
/** /**
* This class implements a singleton that manages the set of hash databases * This class implements a singleton that manages the set of hash databases used
* used to classify files as unknown, known or known bad. * to classify files as unknown, known or known bad.
*/ */
public class HashDbManager implements PropertyChangeListener { public class HashDbManager implements PropertyChangeListener {
@ -88,12 +86,14 @@ public class HashDbManager implements PropertyChangeListener {
private boolean alwaysCalculateHashes = true; private boolean alwaysCalculateHashes = true;
PropertyChangeSupport changeSupport = new PropertyChangeSupport(HashDbManager.class); PropertyChangeSupport changeSupport = new PropertyChangeSupport(HashDbManager.class);
private static final Logger logger = Logger.getLogger(HashDbManager.class.getName()); private static final Logger logger = Logger.getLogger(HashDbManager.class.getName());
/** /**
* Property change event support * Property change event support In events: For both of these enums, the old
* In events: For both of these enums, the old value should be null, and * value should be null, and the new value should be the hashset name
* the new value should be the hashset name string. * string.
*/ */
public enum SetEvt { public enum SetEvt {
DB_ADDED, DB_DELETED DB_ADDED, DB_DELETED
}; };
@ -118,42 +118,48 @@ public class HashDbManager implements PropertyChangeListener {
} }
/** /**
* Gets the extension, without the dot separator, that the SleuthKit requires * Gets the extension, without the dot separator, that the SleuthKit
* for the hash database files that combine a database and an index and can * requires for the hash database files that combine a database and an index
* therefore be updated. * and can therefore be updated.
*/ */
static String getHashDatabaseFileExtension() { static String getHashDatabaseFileExtension() {
return HASH_DATABASE_FILE_EXTENSON; return HASH_DATABASE_FILE_EXTENSON;
} }
public class HashDbManagerException extends Exception { public class HashDbManagerException extends Exception {
private HashDbManagerException(String message) { private HashDbManagerException(String message) {
super(message); super(message);
} }
} }
/** /**
* Adds an existing hash database to the set of hash databases used to classify files as known or known bad * Adds an existing hash database to the set of hash databases used to
* and saves the configuration. * classify files as known or known bad and saves the configuration.
* @param hashSetName Name used to represent the hash database in user interface components. *
* @param path Full path to either a hash database file or a hash database index file. * @param hashSetName Name used to represent the hash database in user
* @param searchDuringIngest A flag indicating whether or not the hash database should be searched during ingest. * interface components.
* @param sendIngestMessages A flag indicating whether hash set hit messages should be sent as ingest messages. * @param path Full path to either a hash database file or a hash database
* @param knownFilesType The classification to apply to files whose hashes are found in the hash database. * index file.
* @param searchDuringIngest A flag indicating whether or not the hash
* database should be searched during ingest.
* @param sendIngestMessages A flag indicating whether hash set hit messages
* should be sent as ingest messages.
* @param knownFilesType The classification to apply to files whose hashes
* are found in the hash database.
* @return A HashDb representing the hash database. * @return A HashDb representing the hash database.
* @throws HashDbManagerException * @throws HashDbManagerException
*/ */
public HashDb addExistingHashDatabase(String hashSetName, String path, boolean searchDuringIngest, boolean sendIngestMessages, HashDb.KnownFilesType knownFilesType) throws HashDbManagerException{ public HashDb addExistingHashDatabase(String hashSetName, String path, boolean searchDuringIngest, boolean sendIngestMessages, HashDb.KnownFilesType knownFilesType) throws HashDbManagerException {
HashDb hashDb = null; HashDb hashDb = null;
try{ try {
addExistingHashDatabaseInternal(hashSetName, path, searchDuringIngest, sendIngestMessages, knownFilesType); addExistingHashDatabaseInternal(hashSetName, path, searchDuringIngest, sendIngestMessages, knownFilesType);
} } catch (TskCoreException ex) {
catch(TskCoreException ex){
throw new HashDbManagerException(ex.getMessage()); throw new HashDbManagerException(ex.getMessage());
} }
// Save the configuration // Save the configuration
if(! save()){ if (!save()) {
throw new HashDbManagerException(NbBundle.getMessage(this.getClass(), "HashDbManager.saveErrorExceptionMsg")); throw new HashDbManagerException(NbBundle.getMessage(this.getClass(), "HashDbManager.saveErrorExceptionMsg"));
} }
@ -161,14 +167,21 @@ public class HashDbManager implements PropertyChangeListener {
} }
/** /**
* Adds an existing hash database to the set of hash databases used to classify files as known or known bad. * Adds an existing hash database to the set of hash databases used to
* Does not save the configuration - the configuration is only saved on demand to support cancellation of * classify files as known or known bad. Does not save the configuration -
* the configuration is only saved on demand to support cancellation of
* configuration panels. * configuration panels.
* @param hashSetName Name used to represent the hash database in user interface components. *
* @param path Full path to either a hash database file or a hash database index file. * @param hashSetName Name used to represent the hash database in user
* @param searchDuringIngest A flag indicating whether or not the hash database should be searched during ingest. * interface components.
* @param sendIngestMessages A flag indicating whether hash set hit messages should be sent as ingest messages. * @param path Full path to either a hash database file or a hash database
* @param knownFilesType The classification to apply to files whose hashes are found in the hash database. * index file.
* @param searchDuringIngest A flag indicating whether or not the hash
* database should be searched during ingest.
* @param sendIngestMessages A flag indicating whether hash set hit messages
* should be sent as ingest messages.
* @param knownFilesType The classification to apply to files whose hashes
* are found in the hash database.
* @return A HashDb representing the hash database. * @return A HashDb representing the hash database.
* @throws HashDbManagerException, TskCoreException * @throws HashDbManagerException, TskCoreException
*/ */
@ -189,29 +202,33 @@ public class HashDbManager implements PropertyChangeListener {
} }
/** /**
* Adds a new hash database to the set of hash databases used to classify files as known or known bad * Adds a new hash database to the set of hash databases used to classify
* and saves the configuration. * files as known or known bad and saves the configuration.
* @param hashSetName Hash set name used to represent the hash database in user interface components. *
* @param hashSetName Hash set name used to represent the hash database in
* user interface components.
* @param path Full path to the database file to be created. * @param path Full path to the database file to be created.
* @param searchDuringIngest A flag indicating whether or not the hash database should be searched during ingest. * @param searchDuringIngest A flag indicating whether or not the hash
* @param sendIngestMessages A flag indicating whether hash set hit messages should be sent as ingest messages. * database should be searched during ingest.
* @param knownFilesType The classification to apply to files whose hashes are found in the hash database. * @param sendIngestMessages A flag indicating whether hash set hit messages
* should be sent as ingest messages.
* @param knownFilesType The classification to apply to files whose hashes
* are found in the hash database.
* @return A HashDb representing the hash database. * @return A HashDb representing the hash database.
* @throws HashDbManagerException * @throws HashDbManagerException
*/ */
public HashDb addNewHashDatabase(String hashSetName, String path, boolean searchDuringIngest, boolean sendIngestMessages, public HashDb addNewHashDatabase(String hashSetName, String path, boolean searchDuringIngest, boolean sendIngestMessages,
HashDb.KnownFilesType knownFilesType) throws HashDbManagerException{ HashDb.KnownFilesType knownFilesType) throws HashDbManagerException {
HashDb hashDb = null; HashDb hashDb = null;
try{ try {
hashDb = addNewHashDatabaseInternal(hashSetName, path, searchDuringIngest, sendIngestMessages, knownFilesType); hashDb = addNewHashDatabaseInternal(hashSetName, path, searchDuringIngest, sendIngestMessages, knownFilesType);
} } catch (TskCoreException ex) {
catch(TskCoreException ex){
throw new HashDbManagerException(ex.getMessage()); throw new HashDbManagerException(ex.getMessage());
} }
// Save the configuration // Save the configuration
if(! save()){ if (!save()) {
throw new HashDbManagerException(NbBundle.getMessage(this.getClass(), "HashDbManager.saveErrorExceptionMsg")); throw new HashDbManagerException(NbBundle.getMessage(this.getClass(), "HashDbManager.saveErrorExceptionMsg"));
} }
@ -219,14 +236,20 @@ public class HashDbManager implements PropertyChangeListener {
} }
/** /**
* Adds a new hash database to the set of hash databases used to classify files as known or known bad. * Adds a new hash database to the set of hash databases used to classify
* Does not save the configuration - the configuration is only saved on demand to support cancellation of * files as known or known bad. Does not save the configuration - the
* configuration is only saved on demand to support cancellation of
* configuration panels. * configuration panels.
* @param hashSetName Hash set name used to represent the hash database in user interface components. *
* @param hashSetName Hash set name used to represent the hash database in
* user interface components.
* @param path Full path to the database file to be created. * @param path Full path to the database file to be created.
* @param searchDuringIngest A flag indicating whether or not the hash database should be searched during ingest. * @param searchDuringIngest A flag indicating whether or not the hash
* @param sendIngestMessages A flag indicating whether hash set hit messages should be sent as ingest messages. * database should be searched during ingest.
* @param knownFilesType The classification to apply to files whose hashes are found in the hash database. * @param sendIngestMessages A flag indicating whether hash set hit messages
* should be sent as ingest messages.
* @param knownFilesType The classification to apply to files whose hashes
* are found in the hash database.
* @return A HashDb representing the hash database. * @return A HashDb representing the hash database.
* @throws HashDbManagerException, TskCoreException * @throws HashDbManagerException, TskCoreException
*/ */
@ -237,7 +260,7 @@ public class HashDbManager implements PropertyChangeListener {
} }
if (!FilenameUtils.getExtension(file.getName()).equalsIgnoreCase(HASH_DATABASE_FILE_EXTENSON)) { if (!FilenameUtils.getExtension(file.getName()).equalsIgnoreCase(HASH_DATABASE_FILE_EXTENSON)) {
throw new HashDbManagerException(NbBundle.getMessage(HashDbManager.class, "HashDbManager.illegalHashDbFileNameExtensionMsg", throw new HashDbManagerException(NbBundle.getMessage(HashDbManager.class, "HashDbManager.illegalHashDbFileNameExtensionMsg",
getHashDatabaseFileExtension())); getHashDatabaseFileExtension()));
} }
if (hashSetPaths.contains(path)) { if (hashSetPaths.contains(path)) {
@ -273,16 +296,14 @@ public class HashDbManager implements PropertyChangeListener {
// Add the hash database to the appropriate collection for its type. // Add the hash database to the appropriate collection for its type.
if (hashDb.getKnownFilesType() == HashDb.KnownFilesType.KNOWN) { if (hashDb.getKnownFilesType() == HashDb.KnownFilesType.KNOWN) {
knownHashSets.add(hashDb); knownHashSets.add(hashDb);
} } else {
else {
knownBadHashSets.add(hashDb); knownBadHashSets.add(hashDb);
} }
// Let any external listeners know that there's a new set // Let any external listeners know that there's a new set
try { try {
changeSupport.firePropertyChange(SetEvt.DB_ADDED.toString(), null, hashSetName); changeSupport.firePropertyChange(SetEvt.DB_ADDED.toString(), null, hashSetName);
} } catch (Exception e) {
catch (Exception e) {
logger.log(Level.SEVERE, "HashDbManager listener threw exception", e); logger.log(Level.SEVERE, "HashDbManager listener threw exception", e);
MessageNotifyUtil.Notify.show( MessageNotifyUtil.Notify.show(
"Module Error", "Module Error",
@ -301,15 +322,14 @@ public class HashDbManager implements PropertyChangeListener {
@Override @Override
public void propertyChange(PropertyChangeEvent event) { public void propertyChange(PropertyChangeEvent event) {
if (event.getPropertyName().equals(HashDb.Event.INDEXING_DONE.name())) { if (event.getPropertyName().equals(HashDb.Event.INDEXING_DONE.name())) {
HashDb hashDb = (HashDb)event.getNewValue(); HashDb hashDb = (HashDb) event.getNewValue();
if (null != hashDb) { if (null != hashDb) {
try { try {
String indexPath = hashDb.getIndexPath(); String indexPath = hashDb.getIndexPath();
if (!indexPath.equals("None")) { if (!indexPath.equals("None")) {
hashSetPaths.add(indexPath); hashSetPaths.add(indexPath);
} }
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error getting index path of " + hashDb.getHashSetName() + " hash database after indexing", ex); Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error getting index path of " + hashDb.getHashSetName() + " hash database after indexing", ex);
} }
} }
@ -319,17 +339,18 @@ public class HashDbManager implements PropertyChangeListener {
/** /**
* Removes a hash database from the set of hash databases used to classify * Removes a hash database from the set of hash databases used to classify
* files as known or known bad and saves the configuration. * files as known or known bad and saves the configuration.
*
* @param hashDb * @param hashDb
* @throws HashDbManagerException * @throws HashDbManagerException
*/ */
public synchronized void removeHashDatabase(HashDb hashDb) throws HashDbManagerException { public synchronized void removeHashDatabase(HashDb hashDb) throws HashDbManagerException {
// Don't remove a database if ingest is running // Don't remove a database if ingest is running
boolean ingestIsRunning = IngestManager.getDefault().isIngestRunning(); boolean ingestIsRunning = IngestManager.getDefault().isIngestRunning();
if(ingestIsRunning){ if (ingestIsRunning) {
throw new HashDbManagerException(NbBundle.getMessage(this.getClass(), "HashDbManager.ingestRunningExceptionMsg")); throw new HashDbManagerException(NbBundle.getMessage(this.getClass(), "HashDbManager.ingestRunningExceptionMsg"));
} }
removeHashDatabaseInternal(hashDb); removeHashDatabaseInternal(hashDb);
if(! save()){ if (!save()) {
throw new HashDbManagerException(NbBundle.getMessage(this.getClass(), "HashDbManager.saveErrorExceptionMsg")); throw new HashDbManagerException(NbBundle.getMessage(this.getClass(), "HashDbManager.saveErrorExceptionMsg"));
} }
} }
@ -339,6 +360,7 @@ public class HashDbManager implements PropertyChangeListener {
* files as known or known bad. Does not save the configuration - the * files as known or known bad. Does not save the configuration - the
* configuration is only saved on demand to support cancellation of * configuration is only saved on demand to support cancellation of
* configuration panels. * configuration panels.
*
* @throws TskCoreException * @throws TskCoreException
*/ */
synchronized void removeHashDatabaseInternal(HashDb hashDb) { synchronized void removeHashDatabaseInternal(HashDb hashDb) {
@ -354,31 +376,27 @@ public class HashDbManager implements PropertyChangeListener {
// Now undertake the operations that could throw. // Now undertake the operations that could throw.
try { try {
hashSetPaths.remove(hashDb.getIndexPath()); hashSetPaths.remove(hashDb.getIndexPath());
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error getting index path of " + hashDb.getHashSetName() + " hash database when removing the database", ex); Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error getting index path of " + hashDb.getHashSetName() + " hash database when removing the database", ex);
} }
try { try {
if (!hashDb.hasIndexOnly()) { if (!hashDb.hasIndexOnly()) {
hashSetPaths.remove(hashDb.getDatabasePath()); hashSetPaths.remove(hashDb.getDatabasePath());
} }
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error getting database path of " + hashDb.getHashSetName() + " hash database when removing the database", ex); Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error getting database path of " + hashDb.getHashSetName() + " hash database when removing the database", ex);
} }
try { try {
hashDb.close(); hashDb.close();
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error closing " + hashDb.getHashSetName() + " hash database when removing the database", ex); Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error closing " + hashDb.getHashSetName() + " hash database when removing the database", ex);
} }
// Let any external listeners know that a set has been deleted // Let any external listeners know that a set has been deleted
try { try {
changeSupport.firePropertyChange(SetEvt.DB_DELETED.toString(), null, hashSetName); changeSupport.firePropertyChange(SetEvt.DB_DELETED.toString(), null, hashSetName);
} } catch (Exception e) {
catch (Exception e) {
logger.log(Level.SEVERE, "HashDbManager listener threw exception", e); logger.log(Level.SEVERE, "HashDbManager listener threw exception", e);
MessageNotifyUtil.Notify.show( MessageNotifyUtil.Notify.show(
"Module Error", "Module Error",
@ -388,7 +406,9 @@ public class HashDbManager implements PropertyChangeListener {
} }
/** /**
* Gets all of the hash databases used to classify files as known or known bad. * Gets all of the hash databases used to classify files as known or known
* bad.
*
* @return A list, possibly empty, of hash databases. * @return A list, possibly empty, of hash databases.
*/ */
public synchronized List<HashDb> getAllHashSets() { public synchronized List<HashDb> getAllHashSets() {
@ -400,6 +420,7 @@ public class HashDbManager implements PropertyChangeListener {
/** /**
* Gets all of the hash databases used to classify files as known. * Gets all of the hash databases used to classify files as known.
*
* @return A list, possibly empty, of hash databases. * @return A list, possibly empty, of hash databases.
*/ */
public synchronized List<HashDb> getKnownFileHashSets() { public synchronized List<HashDb> getKnownFileHashSets() {
@ -410,6 +431,7 @@ public class HashDbManager implements PropertyChangeListener {
/** /**
* Gets all of the hash databases used to classify files as known bad. * Gets all of the hash databases used to classify files as known bad.
*
* @return A list, possibly empty, of hash databases. * @return A list, possibly empty, of hash databases.
*/ */
public synchronized List<HashDb> getKnownBadFileHashSets() { public synchronized List<HashDb> getKnownBadFileHashSets() {
@ -420,6 +442,7 @@ public class HashDbManager implements PropertyChangeListener {
/** /**
* Gets all of the hash databases that accept updates. * Gets all of the hash databases that accept updates.
*
* @return A list, possibly empty, of hash databases. * @return A list, possibly empty, of hash databases.
*/ */
public synchronized List<HashDb> getUpdateableHashSets() { public synchronized List<HashDb> getUpdateableHashSets() {
@ -435,8 +458,7 @@ public class HashDbManager implements PropertyChangeListener {
if (db.isUpdateable()) { if (db.isUpdateable()) {
updateableDbs.add(db); updateableDbs.add(db);
} }
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error checking updateable status of " + db.getHashSetName() + " hash database", ex); Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error checking updateable status of " + db.getHashSetName() + " hash database", ex);
} }
} }
@ -444,16 +466,16 @@ public class HashDbManager implements PropertyChangeListener {
} }
/** /**
* Sets the value for the flag that indicates whether hashes should be calculated * Sets the value for the flag that indicates whether hashes should be
* for content even if no hash databases are configured. * calculated for content even if no hash databases are configured.
*/ */
synchronized void setAlwaysCalculateHashes(boolean alwaysCalculateHashes) { synchronized void setAlwaysCalculateHashes(boolean alwaysCalculateHashes) {
this.alwaysCalculateHashes = alwaysCalculateHashes; this.alwaysCalculateHashes = alwaysCalculateHashes;
} }
/** /**
* Gets the flag that indicates whether hashes should be calculated * Gets the flag that indicates whether hashes should be calculated for
* for content even if no hash databases are configured. * content even if no hash databases are configured.
*/ */
synchronized boolean getAlwaysCalculateHashes() { synchronized boolean getAlwaysCalculateHashes() {
return alwaysCalculateHashes; return alwaysCalculateHashes;
@ -462,6 +484,7 @@ public class HashDbManager implements PropertyChangeListener {
/** /**
* Saves the hash sets configuration. Note that the configuration is only * Saves the hash sets configuration. Note that the configuration is only
* saved on demand to support cancellation of configuration panels. * saved on demand to support cancellation of configuration panels.
*
* @return True on success, false otherwise. * @return True on success, false otherwise.
*/ */
synchronized boolean save() { synchronized boolean save() {
@ -487,8 +510,7 @@ public class HashDbManager implements PropertyChangeListener {
for (HashDb database : hashDatabases) { for (HashDb database : hashDatabases) {
try { try {
database.close(); database.close();
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error closing " + database.getHashSetName() + " hash database", ex); Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error closing " + database.getHashSetName() + " hash database", ex);
} }
} }
@ -513,8 +535,7 @@ public class HashDbManager implements PropertyChangeListener {
rootEl.appendChild(setCalc); rootEl.appendChild(setCalc);
success = XMLUtil.saveDoc(HashDbManager.class, configFilePath, ENCODING, doc); success = XMLUtil.saveDoc(HashDbManager.class, configFilePath, ENCODING, doc);
} } catch (ParserConfigurationException ex) {
catch (ParserConfigurationException ex) {
Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error saving hash databases", ex); Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error saving hash databases", ex);
} }
return success; return success;
@ -528,12 +549,10 @@ public class HashDbManager implements PropertyChangeListener {
try { try {
if (db.hasIndexOnly()) { if (db.hasIndexOnly()) {
path = db.getIndexPath(); path = db.getIndexPath();
} } else {
else {
path = db.getDatabasePath(); path = db.getDatabasePath();
} }
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error getting path of hash database " + db.getHashSetName() + ", discarding from hash database configuration", ex); Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error getting path of hash database " + db.getHashSetName() + ", discarding from hash database configuration", ex);
continue; continue;
} }
@ -574,7 +593,7 @@ public class HashDbManager implements PropertyChangeListener {
// Get the hash set elements. // Get the hash set elements.
NodeList setsNList = root.getElementsByTagName(SET_ELEMENT); NodeList setsNList = root.getElementsByTagName(SET_ELEMENT);
int numSets = setsNList.getLength(); int numSets = setsNList.getLength();
if(numSets == 0) { if (numSets == 0) {
Logger.getLogger(HashDbManager.class.getName()).log(Level.WARNING, "No element hash_set exists."); Logger.getLogger(HashDbManager.class.getName()).log(Level.WARNING, "No element hash_set exists.");
} }
@ -598,19 +617,18 @@ public class HashDbManager implements PropertyChangeListener {
do { do {
++suffix; ++suffix;
newHashSetName = hashSetName + suffix; newHashSetName = hashSetName + suffix;
} } while (hashSetNames.contains(newHashSetName));
while (hashSetNames.contains(newHashSetName));
JOptionPane.showMessageDialog(null, JOptionPane.showMessageDialog(null,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbManager.replacingDuplicateHashsetNameMsg", "HashDbManager.replacingDuplicateHashsetNameMsg",
hashSetName, newHashSetName), hashSetName, newHashSetName),
NbBundle.getMessage(this.getClass(), "HashDbManager.openHashDbErr"), NbBundle.getMessage(this.getClass(), "HashDbManager.openHashDbErr"),
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
hashSetName = newHashSetName; hashSetName = newHashSetName;
} }
String knownFilesType = setEl.getAttribute(SET_TYPE_ATTRIBUTE); String knownFilesType = setEl.getAttribute(SET_TYPE_ATTRIBUTE);
if(knownFilesType.isEmpty()) { if (knownFilesType.isEmpty()) {
Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, SET_TYPE_ATTRIBUTE + attributeErrorMessage, i); Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, SET_TYPE_ATTRIBUTE + attributeErrorMessage, i);
continue; continue;
} }
@ -643,7 +661,7 @@ public class HashDbManager implements PropertyChangeListener {
// Check for legacy path number attribute. // Check for legacy path number attribute.
String legacyPathNumber = pathEl.getAttribute(LEGACY_PATH_NUMBER_ATTRIBUTE); String legacyPathNumber = pathEl.getAttribute(LEGACY_PATH_NUMBER_ATTRIBUTE);
if (null != legacyPathNumber && !legacyPathNumber.isEmpty()) { if (null != legacyPathNumber && !legacyPathNumber.isEmpty()) {
updatedSchema = true; updatedSchema = true;
} }
dbPath = pathEl.getTextContent(); dbPath = pathEl.getTextContent();
@ -651,8 +669,7 @@ public class HashDbManager implements PropertyChangeListener {
Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, PATH_ELEMENT + elementErrorMessage, i); Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, PATH_ELEMENT + elementErrorMessage, i);
continue; continue;
} }
} } else {
else {
Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, PATH_ELEMENT + elementErrorMessage, i); Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, PATH_ELEMENT + elementErrorMessage, i);
continue; continue;
} }
@ -661,17 +678,15 @@ public class HashDbManager implements PropertyChangeListener {
if (null != dbPath) { if (null != dbPath) {
try { try {
addExistingHashDatabaseInternal(hashSetName, dbPath, seearchDuringIngestFlag, sendIngestMessagesFlag, HashDb.KnownFilesType.valueOf(knownFilesType)); addExistingHashDatabaseInternal(hashSetName, dbPath, seearchDuringIngestFlag, sendIngestMessagesFlag, HashDb.KnownFilesType.valueOf(knownFilesType));
} } catch (HashDbManagerException | TskCoreException ex) {
catch (HashDbManagerException | TskCoreException ex) {
Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error opening hash database", ex); Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error opening hash database", ex);
JOptionPane.showMessageDialog(null, JOptionPane.showMessageDialog(null,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbManager.unableToOpenHashDbMsg", dbPath), "HashDbManager.unableToOpenHashDbMsg", dbPath),
NbBundle.getMessage(this.getClass(), "HashDbManager.openHashDbErr"), NbBundle.getMessage(this.getClass(), "HashDbManager.openHashDbErr"),
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
} }
} } else {
else {
Logger.getLogger(HashDbManager.class.getName()).log(Level.WARNING, "No valid path for hash_set at index {0}, cannot make instance of HashDb class", i); Logger.getLogger(HashDbManager.class.getName()).log(Level.WARNING, "No valid path for hash_set at index {0}, cannot make instance of HashDb class", i);
} }
} }
@ -682,8 +697,7 @@ public class HashDbManager implements PropertyChangeListener {
Element calcEl = (Element) calcList.item(0); // Shouldn't be more than one. Element calcEl = (Element) calcList.item(0); // Shouldn't be more than one.
final String value = calcEl.getAttribute(VALUE_ATTRIBUTE); final String value = calcEl.getAttribute(VALUE_ATTRIBUTE);
alwaysCalculateHashes = Boolean.parseBoolean(value); alwaysCalculateHashes = Boolean.parseBoolean(value);
} } else {
else {
Logger.getLogger(HashDbManager.class.getName()).log(Level.WARNING, " element "); Logger.getLogger(HashDbManager.class.getName()).log(Level.WARNING, " element ");
alwaysCalculateHashes = true; alwaysCalculateHashes = true;
} }
@ -691,19 +705,18 @@ public class HashDbManager implements PropertyChangeListener {
if (updatedSchema) { if (updatedSchema) {
String backupFilePath = configFilePath + ".v1_backup"; String backupFilePath = configFilePath + ".v1_backup";
String messageBoxTitle = NbBundle.getMessage(this.getClass(), String messageBoxTitle = NbBundle.getMessage(this.getClass(),
"HashDbManager.msgBoxTitle.confFileFmtChanged"); "HashDbManager.msgBoxTitle.confFileFmtChanged");
String baseMessage = NbBundle.getMessage(this.getClass(), String baseMessage = NbBundle.getMessage(this.getClass(),
"HashDbManager.baseMessage.updatedFormatHashDbConfig"); "HashDbManager.baseMessage.updatedFormatHashDbConfig");
try { try {
FileUtils.copyFile(new File(configFilePath), new File (backupFilePath)); FileUtils.copyFile(new File(configFilePath), new File(backupFilePath));
JOptionPane.showMessageDialog(null, JOptionPane.showMessageDialog(null,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbManager.savedBackupOfOldConfigMsg", "HashDbManager.savedBackupOfOldConfigMsg",
baseMessage, backupFilePath), baseMessage, backupFilePath),
messageBoxTitle, messageBoxTitle,
JOptionPane.INFORMATION_MESSAGE); JOptionPane.INFORMATION_MESSAGE);
} } catch (IOException ex) {
catch (IOException ex) {
Logger.getLogger(HashDbManager.class.getName()).log(Level.WARNING, "Failed to save backup of old format configuration file to " + backupFilePath, ex); Logger.getLogger(HashDbManager.class.getName()).log(Level.WARNING, "Failed to save backup of old format configuration file to " + backupFilePath, ex);
JOptionPane.showMessageDialog(null, baseMessage, messageBoxTitle, JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, baseMessage, messageBoxTitle, JOptionPane.INFORMATION_MESSAGE);
} }
@ -724,15 +737,15 @@ public class HashDbManager implements PropertyChangeListener {
// Give the user an opportunity to find the desired file. // Give the user an opportunity to find the desired file.
String newPath = null; String newPath = null;
if (JOptionPane.showConfirmDialog(null, if (JOptionPane.showConfirmDialog(null,
NbBundle.getMessage(this.getClass(), "HashDbManager.dlgMsg.dbNotFoundAtLoc", NbBundle.getMessage(this.getClass(), "HashDbManager.dlgMsg.dbNotFoundAtLoc",
hashSetName, configuredPath), hashSetName, configuredPath),
NbBundle.getMessage(this.getClass(), "HashDbManager.dlgTitle.MissingDb"), NbBundle.getMessage(this.getClass(), "HashDbManager.dlgTitle.MissingDb"),
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
newPath = searchForFile(); newPath = searchForFile();
if (null != newPath && !newPath.isEmpty()) { if (null != newPath && !newPath.isEmpty()) {
database = new File(newPath); database = new File(newPath);
if (!database.exists()) { if (!database.exists()) {
newPath = null; newPath = null;
} }
} }
} }
@ -744,7 +757,7 @@ public class HashDbManager implements PropertyChangeListener {
JFileChooser fc = new JFileChooser(); JFileChooser fc = new JFileChooser();
fc.setDragEnabled(false); fc.setDragEnabled(false);
fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
String[] EXTENSION = new String[] { "txt", "idx", "hash", "Hash", "kdb" }; String[] EXTENSION = new String[]{"txt", "idx", "hash", "Hash", "kdb"};
FileNameExtensionFilter filter = new FileNameExtensionFilter( FileNameExtensionFilter filter = new FileNameExtensionFilter(
NbBundle.getMessage(this.getClass(), "HashDbManager.fileNameExtensionFilter.title"), EXTENSION); NbBundle.getMessage(this.getClass(), "HashDbManager.fileNameExtensionFilter.title"), EXTENSION);
fc.setFileFilter(filter); fc.setFileFilter(filter);
@ -753,8 +766,7 @@ public class HashDbManager implements PropertyChangeListener {
File f = fc.getSelectedFile(); File f = fc.getSelectedFile();
try { try {
filePath = f.getCanonicalPath(); filePath = f.getCanonicalPath();
} } catch (IOException ex) {
catch (IOException ex) {
Logger.getLogger(HashDbManager.class.getName()).log(Level.WARNING, "Couldn't get selected file path", ex); Logger.getLogger(HashDbManager.class.getName()).log(Level.WARNING, "Couldn't get selected file path", ex);
} }
} }
@ -762,7 +774,8 @@ public class HashDbManager implements PropertyChangeListener {
} }
/** /**
* Instances of this class represent hash databases used to classify files as known or know bad. * Instances of this class represent hash databases used to classify files
* as known or know bad.
*/ */
public static class HashDb { public static class HashDb {
@ -770,10 +783,10 @@ public class HashDbManager implements PropertyChangeListener {
* Indicates how files with hashes stored in a particular hash database * Indicates how files with hashes stored in a particular hash database
* object should be classified. * object should be classified.
*/ */
public enum KnownFilesType{ public enum KnownFilesType {
KNOWN(NbBundle.getMessage(HashDbManager.class, "HashDbManager.known.text")), KNOWN(NbBundle.getMessage(HashDbManager.class, "HashDbManager.known.text")),
KNOWN_BAD(NbBundle.getMessage(HashDbManager.class, "HashDbManager.knownBad.text")); KNOWN_BAD(NbBundle.getMessage(HashDbManager.class, "HashDbManager.knownBad.text"));
private String displayName; private String displayName;
private KnownFilesType(String displayName) { private KnownFilesType(String displayName) {
@ -789,9 +802,9 @@ public class HashDbManager implements PropertyChangeListener {
* Property change events published by hash database objects. * Property change events published by hash database objects.
*/ */
public enum Event { public enum Event {
INDEXING_DONE INDEXING_DONE
} }
private int handle; private int handle;
private String hashSetName; private String hashSetName;
private boolean searchDuringIngest; private boolean searchDuringIngest;
@ -857,6 +870,7 @@ public class HashDbManager implements PropertyChangeListener {
/** /**
* Indicates whether the hash database accepts updates. * Indicates whether the hash database accepts updates.
*
* @return True if the database accepts updates, false otherwise. * @return True if the database accepts updates, false otherwise.
*/ */
public boolean isUpdateable() throws TskCoreException { public boolean isUpdateable() throws TskCoreException {
@ -865,7 +879,9 @@ public class HashDbManager implements PropertyChangeListener {
/** /**
* Adds hashes of content (if calculated) to the hash database. * Adds hashes of content (if calculated) to the hash database.
* @param content The content for which the calculated hashes, if any, are to be added to the hash database. *
* @param content The content for which the calculated hashes, if any,
* are to be added to the hash database.
* @throws TskCoreException * @throws TskCoreException
*/ */
public void addHashes(Content content) throws TskCoreException { public void addHashes(Content content) throws TskCoreException {
@ -874,15 +890,18 @@ public class HashDbManager implements PropertyChangeListener {
/** /**
* Adds hashes of content (if calculated) to the hash database. * Adds hashes of content (if calculated) to the hash database.
* @param content The content for which the calculated hashes, if any, are to be added to the hash database. *
* @param comment A comment to associate with the hashes, e.g., the name of the case in which the content was encountered. * @param content The content for which the calculated hashes, if any,
* are to be added to the hash database.
* @param comment A comment to associate with the hashes, e.g., the name
* of the case in which the content was encountered.
* @throws TskCoreException * @throws TskCoreException
*/ */
public void addHashes(Content content, String comment) throws TskCoreException { public void addHashes(Content content, String comment) throws TskCoreException {
// This only works for AbstractFiles and MD5 hashes at present. // This only works for AbstractFiles and MD5 hashes at present.
assert content instanceof AbstractFile; assert content instanceof AbstractFile;
if (content instanceof AbstractFile) { if (content instanceof AbstractFile) {
AbstractFile file = (AbstractFile)content; AbstractFile file = (AbstractFile) content;
if (null != file.getMd5Hash()) { if (null != file.getMd5Hash()) {
SleuthkitJNI.addToHashDatabase(null, file.getMd5Hash(), null, null, comment, handle); SleuthkitJNI.addToHashDatabase(null, file.getMd5Hash(), null, null, comment, handle);
} }
@ -891,31 +910,32 @@ public class HashDbManager implements PropertyChangeListener {
/** /**
* Adds a list of hashes to the hash database at once * Adds a list of hashes to the hash database at once
*
* @param hashes List of hashes * @param hashes List of hashes
* @throws TskCoreException * @throws TskCoreException
*/ */
public void addHashes(List<HashEntry> hashes) throws TskCoreException{ public void addHashes(List<HashEntry> hashes) throws TskCoreException {
SleuthkitJNI.addToHashDatabase(hashes, handle); SleuthkitJNI.addToHashDatabase(hashes, handle);
} }
public boolean hasMd5HashOf(Content content) throws TskCoreException { public boolean hasMd5HashOf(Content content) throws TskCoreException {
boolean result = false; boolean result = false;
assert content instanceof AbstractFile; assert content instanceof AbstractFile;
if (content instanceof AbstractFile) { if (content instanceof AbstractFile) {
AbstractFile file = (AbstractFile)content; AbstractFile file = (AbstractFile) content;
if (null != file.getMd5Hash()) { if (null != file.getMd5Hash()) {
result = SleuthkitJNI.lookupInHashDatabase(file.getMd5Hash(), handle); result = SleuthkitJNI.lookupInHashDatabase(file.getMd5Hash(), handle);
} }
} }
return result; return result;
} }
public HashInfo lookUp(Content content) throws TskCoreException { public HashInfo lookUp(Content content) throws TskCoreException {
HashInfo result = null; HashInfo result = null;
// This only works for AbstractFiles and MD5 hashes at present. // This only works for AbstractFiles and MD5 hashes at present.
assert content instanceof AbstractFile; assert content instanceof AbstractFile;
if (content instanceof AbstractFile) { if (content instanceof AbstractFile) {
AbstractFile file = (AbstractFile)content; AbstractFile file = (AbstractFile) content;
if (null != file.getMd5Hash()) { if (null != file.getMd5Hash()) {
result = SleuthkitJNI.lookupInHashDatabaseVerbose(file.getMd5Hash(), handle); result = SleuthkitJNI.lookupInHashDatabaseVerbose(file.getMd5Hash(), handle);
} }
@ -948,12 +968,15 @@ public class HashDbManager implements PropertyChangeListener {
* Worker thread to make an index of a database * Worker thread to make an index of a database
*/ */
private class HashDbIndexer extends SwingWorker<Object, Void> { private class HashDbIndexer extends SwingWorker<Object, Void> {
private ProgressHandle progress = null; private ProgressHandle progress = null;
private HashDb hashDb = null; private HashDb hashDb = null;
HashDbIndexer(HashDb hashDb) { HashDbIndexer(HashDb hashDb) {
this.hashDb = hashDb; this.hashDb = hashDb;
}; }
;
@Override @Override
protected Object doInBackground() { protected Object doInBackground() {
@ -964,15 +987,14 @@ public class HashDbManager implements PropertyChangeListener {
progress.switchToIndeterminate(); progress.switchToIndeterminate();
try { try {
SleuthkitJNI.createLookupIndexForHashDatabase(hashDb.handle); SleuthkitJNI.createLookupIndexForHashDatabase(hashDb.handle);
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(HashDb.class.getName()).log(Level.SEVERE, "Error indexing hash database", ex); Logger.getLogger(HashDb.class.getName()).log(Level.SEVERE, "Error indexing hash database", ex);
JOptionPane.showMessageDialog(null, JOptionPane.showMessageDialog(null,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"HashDbManager.dlgMsg.errorIndexingHashSet", "HashDbManager.dlgMsg.errorIndexingHashSet",
hashDb.getHashSetName()), hashDb.getHashSetName()),
NbBundle.getMessage(this.getClass(), "HashDbManager.hashDbIndexingErr"), NbBundle.getMessage(this.getClass(), "HashDbManager.hashDbIndexingErr"),
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
} }
return null; return null;
} }
@ -988,14 +1010,13 @@ public class HashDbManager implements PropertyChangeListener {
} catch (InterruptedException | ExecutionException ex) { } catch (InterruptedException | ExecutionException ex) {
logger.log(Level.SEVERE, "Error creating index", ex); logger.log(Level.SEVERE, "Error creating index", ex);
MessageNotifyUtil.Notify.show("Error creating index", MessageNotifyUtil.Notify.show("Error creating index",
"Error creating index: " + ex.getMessage(), "Error creating index: " + ex.getMessage(),
MessageNotifyUtil.MessageType.ERROR); MessageNotifyUtil.MessageType.ERROR);
} }
try { try {
hashDb.propertyChangeSupport.firePropertyChange(HashDb.Event.INDEXING_DONE.toString(), null, hashDb); hashDb.propertyChangeSupport.firePropertyChange(HashDb.Event.INDEXING_DONE.toString(), null, hashDb);
} } catch (Exception e) {
catch (Exception e) {
logger.log(Level.SEVERE, "HashDbManager listener threw exception", e); logger.log(Level.SEVERE, "HashDbManager listener threw exception", e);
MessageNotifyUtil.Notify.show( MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "HashDbManager.moduleErr"), NbBundle.getMessage(this.getClass(), "HashDbManager.moduleErr"),

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -51,7 +51,6 @@ class HashDbPanelSearchAction extends CallableSystemAction {
setEnabled(evt.getNewValue() != null); setEnabled(evt.getNewValue() != null);
} }
} }
}); });
} }

View File

@ -1,7 +1,7 @@
Manifest-Version: 1.0 Manifest-Version: 1.0
AutoUpdate-Show-In-Client: true AutoUpdate-Show-In-Client: true
OpenIDE-Module: org.sleuthkit.autopsy.keywordsearch/5 OpenIDE-Module: org.sleuthkit.autopsy.keywordsearch/5
OpenIDE-Module-Implementation-Version: 9 OpenIDE-Module-Implementation-Version: 10
OpenIDE-Module-Install: org/sleuthkit/autopsy/keywordsearch/Installer.class OpenIDE-Module-Install: org/sleuthkit/autopsy/keywordsearch/Installer.class
OpenIDE-Module-Layer: org/sleuthkit/autopsy/keywordsearch/layer.xml OpenIDE-Module-Layer: org/sleuthkit/autopsy/keywordsearch/layer.xml
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/keywordsearch/Bundle.properties OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/keywordsearch/Bundle.properties

View File

@ -96,7 +96,7 @@
<compile-dependency/> <compile-dependency/>
<run-dependency> <run-dependency>
<release-version>9</release-version> <release-version>9</release-version>
<specification-version>7.0</specification-version> <specification-version>7.1</specification-version>
</run-dependency> </run-dependency>
</dependency> </dependency>
</module-dependencies> </module-dependencies>

View File

@ -45,6 +45,7 @@ import org.sleuthkit.datamodel.ReadContentInputStream;
private static final int SINGLE_READ_CHARS = 1024; private static final int SINGLE_READ_CHARS = 1024;
private static final int EXTRA_CHARS = 128; //for whitespace private static final int EXTRA_CHARS = 128; //for whitespace
private static final char[] TEXT_CHUNK_BUF = new char[MAX_EXTR_TEXT_CHARS]; private static final char[] TEXT_CHUNK_BUF = new char[MAX_EXTR_TEXT_CHARS];
private static final int MAX_SIZE = 50000000;
private KeywordSearchIngestModule module; private KeywordSearchIngestModule module;
private Ingester ingester; private Ingester ingester;
private AbstractFile sourceFile; private AbstractFile sourceFile;
@ -217,7 +218,7 @@ import org.sleuthkit.datamodel.ReadContentInputStream;
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 (WEB_MIME_TYPES.contains(detectedFormat)) { } else if (WEB_MIME_TYPES.contains(detectedFormat) && file.getSize() <= MAX_SIZE) {
return true; return true;
} else { } else {
return false; return false;

View File

@ -279,6 +279,10 @@ class AbstractFileTikaTextExtract implements AbstractFileExtract {
else if (detectedFormat.contains("video/") else if (detectedFormat.contains("video/")
&& !detectedFormat.equals("video/x-flv")) { && !detectedFormat.equals("video/x-flv")) {
return false; return false;
} else if (detectedFormat.contains("application/x-font-ttf")) {
// Tika currently has a bug in the ttf parser in fontbox.
// It will throw an out of memory exception
return false;
} }

Some files were not shown because too many files have changed in this diff Show More