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

This commit is contained in:
Nick Davis 2014-03-12 12:18:50 -04:00
commit 3d3f18ed6a
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-Localizing-Bundle: org/sleuthkit/autopsy/core/Bundle.properties
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
AutoUpdate-Show-In-Client: true
AutoUpdate-Essential-Module: true

View File

@ -6,5 +6,5 @@ license.file=../LICENSE-2.0.txt
nbm.homepage=http://www.sleuthkit.org/
nbm.module.author=Brian Carrier
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.casemodule</package>
<package>org.sleuthkit.autopsy.casemodule.services</package>
<package>org.sleuthkit.autopsy.contentviewers</package>
<package>org.sleuthkit.autopsy.core</package>
<package>org.sleuthkit.autopsy.corecomponentinterfaces</package>
<package>org.sleuthkit.autopsy.corecomponents</package>
@ -206,14 +207,14 @@
<package>org.sleuthkit.autopsy.report</package>
<package>org.sleuthkit.datamodel</package>
</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>
<runtime-relative-path>ext/Tsk_DataModel.jar</runtime-relative-path>
<binary-origin>release/modules/ext/Tsk_DataModel.jar</binary-origin>
</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>
</configuration>
</project>

View File

@ -109,6 +109,7 @@
</Properties>
<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>
</Component>
<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.JButton newTagButton;
private javax.swing.JButton okButton;
private javax.swing.JComboBox tagCombo;
private javax.swing.JComboBox<String> tagCombo;
private javax.swing.JLabel tagLabel;
// End of variables declaration//GEN-END:variables
}

View File

@ -18,7 +18,6 @@
*/
package org.sleuthkit.autopsy.casemodule;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -42,21 +41,17 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
/**
* visual component for the first panel of add image wizard.
* Allows the user to choose the data source type and then select the data source
* visual component for the first panel of add image wizard. Allows the user to
* choose the data source type and then select the data source
*
*/
final class AddImageWizardChooseDataSourceVisual extends JPanel {
static final Logger logger = Logger.getLogger(AddImageWizardChooseDataSourceVisual.class.getName());
private AddImageWizardChooseDataSourcePanel wizPanel;
private JPanel currentPanel;
private Map<String, DataSourceProcessor> datasourceProcessorsMap = new HashMap<String, DataSourceProcessor>();
List<String> coreDSPTypes = new ArrayList<String>();
private Map<String, DataSourceProcessor> datasourceProcessorsMap = new HashMap<>();
List<String> coreDSPTypes = new ArrayList<>();
/**
* Creates new form AddImageVisualPanel1
@ -87,21 +82,20 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
coreDSPTypes.add(LocalDiskDSProcessor.getType());
coreDSPTypes.add(LocalFilesDSProcessor.getType());
for(String dspType:coreDSPTypes){
for (String dspType : coreDSPTypes) {
typeComboBox.addItem(dspType);
}
// now add any addtional DSPs that haven't already been added
for(String dspType:dspTypes){
for (String dspType : dspTypes) {
if (!coreDSPTypes.contains(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
protected boolean addSeparatorAfter(JList list, Object value, int index){
protected boolean addSeparatorAfter(JList list, Object value, int index) {
return (index == coreDSPTypes.size() - 1);
}
});
@ -119,21 +113,20 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
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);
}
else {
logger.log(Level.SEVERE, "discoverDataSourceProcessors(): A DataSourceProcessor already exists for type = " + dsProcessor.getDataSourceType() );
} else {
logger.log(Level.SEVERE, "discoverDataSourceProcessors(): A DataSourceProcessor already exists for type = {0}", dsProcessor.getDataSourceType());
}
}
}
}
private void dspSelectionChanged() {
// update the current panel to selection
currentPanel = getCurrentDSProcessor().getPanel();
updateCurrentPanel(currentPanel);
private void dspSelectionChanged() {
// update the current panel to selection
currentPanel = getCurrentDSProcessor().getPanel();
updateCurrentPanel(currentPanel);
}
/**
@ -144,7 +137,7 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
private void updateCurrentPanel(JPanel panel) {
currentPanel = panel;
typePanel.removeAll();
typePanel.add((JPanel) currentPanel, BorderLayout.CENTER);
typePanel.add(currentPanel, BorderLayout.CENTER);
typePanel.validate();
typePanel.repaint();
currentPanel.addPropertyChangeListener(new PropertyChangeListener() {
@ -162,9 +155,11 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
updateUI(null);
}
/**
/**
* 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() {
// 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");
}
/**
* 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
@ -310,25 +304,27 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
this.wizPanel.enableNextButton(getCurrentDSProcessor().isPanelValid());
}
public abstract class ComboboxSeparatorRenderer implements ListCellRenderer {
public abstract class ComboboxSeparatorRenderer implements ListCellRenderer{
private ListCellRenderer delegate;
private JPanel separatorPanel = new JPanel(new BorderLayout());
private JSeparator separator = new JSeparator();
public ComboboxSeparatorRenderer(ListCellRenderer delegate){
this.delegate = delegate;
public ComboboxSeparatorRenderer(ListCellRenderer 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);
if(index!=-1 && addSeparatorAfter(list, value, index)){
if (index != -1 && addSeparatorAfter(list, value, index)) {
separatorPanel.removeAll();
separatorPanel.add(comp, BorderLayout.CENTER);
separatorPanel.add(separator, BorderLayout.SOUTH);
return separatorPanel;
}else
} else {
return comp;
}
}
protected abstract boolean addSeparatorAfter(JList list, Object value, int index);

View File

@ -80,6 +80,10 @@
<StringArray count="0"/>
</Property>
</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 class="javax.swing.JLabel" name="errorLabel">
<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:.
*/
class LocalDiskPanel extends JPanel {
final class LocalDiskPanel extends JPanel {
private static final Logger logger = Logger.getLogger(LocalDiskPanel.class.getName());
private static LocalDiskPanel instance;
private PropertyChangeSupport pcs = null;
private List<LocalDisk> disks = new ArrayList<LocalDisk>();
private List<LocalDisk> disks;
private LocalDiskModel model;
private boolean enableNext = false;
@ -63,6 +63,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
* Creates new form LocalDiskPanel
*/
public LocalDiskPanel() {
this.disks = new ArrayList<>();
initComponents();
customInit();
@ -101,7 +102,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
private void initComponents() {
diskLabel = new javax.swing.JLabel();
diskComboBox = new javax.swing.JComboBox();
diskComboBox = new javax.swing.JComboBox<>();
errorLabel = new javax.swing.JLabel();
timeZoneLabel = new javax.swing.JLabel();
timeZoneComboBox = new javax.swing.JComboBox<String>();
@ -165,7 +166,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
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 errorLabel;
private javax.swing.JCheckBox noFatOrphansCheckbox;
@ -296,14 +297,13 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
private Object selected;
private boolean ready = false;
private volatile boolean loadingDisks = false;
List<LocalDisk> physical = new ArrayList<LocalDisk>();
List<LocalDisk> partitions = new ArrayList<LocalDisk>();
List<LocalDisk> physical = new ArrayList<>();
List<LocalDisk> partitions = new ArrayList<>();
//private String SELECT = "Select a local disk:";
private String LOADING = NbBundle.getMessage(this.getClass(), "LocalDiskPanel.localDiskModel.loading.msg");
LocalDiskThread worker = null;
private void loadDisks() {
// 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
errorLabel.setText("");
disks = new ArrayList<LocalDisk>();
physical = new ArrayList<LocalDisk>();
partitions = new ArrayList<LocalDisk>();
disks = new ArrayList<>();
physical = new ArrayList<>();
partitions = new ArrayList<>();
diskComboBox.setEnabled(false);
ready = false;
enableNext = false;
@ -330,7 +330,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
@Override
public void setSelectedItem(Object anItem) {
if(ready) {
selected = anItem;
selected = (LocalDisk) anItem;
enableNext = true;
try {
@ -384,13 +384,14 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
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());
label.setText(LOADING);
label.setFont(font);
label.setBackground(Color.GRAY);
} else {
label.setText(value != null ? value.toString() : "");
label.setText(value.toString());
}
label.setOpaque(true);
label.setBorder(new EmptyBorder(2, 2, 2, 2));

View File

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

View File

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

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013 Basis Technology Corp.
* Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* 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.text.html.HTMLEditorKit;
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"/>-->
<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="Java.instance_hidden"/>
<folder name="Advanced.instance_hidden"/> <!-- Miscellaneous -->

View File

@ -284,6 +284,10 @@
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="languageComboActionPerformed"/>
</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 class="javax.swing.JLabel" name="languageLabel">
<Properties>

View File

@ -116,7 +116,7 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC
prevPageButton = new javax.swing.JButton();
goToPageLabel = new javax.swing.JLabel();
goToPageTextField = new javax.swing.JTextField();
languageCombo = new javax.swing.JComboBox();
languageCombo = new javax.swing.JComboBox<>();
languageLabel = new javax.swing.JLabel();
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.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JComboBox languageCombo;
private javax.swing.JComboBox<SCRIPT> languageCombo;
private javax.swing.JLabel languageLabel;
private javax.swing.JButton nextPageButton;
private javax.swing.JLabel ofLabel;

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013 Basis Technology Corp.
* Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* 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
// multiple selection actions.
//@ServiceProvider(service = DataResultViewer.class)
public class DataResultViewerTable extends AbstractDataResultViewer {
public class DataResultViewerTable extends AbstractDataResultViewer {
private String firstColumnLabel = NbBundle.getMessage(DataResultViewerTable.class, "DataResultViewerTable.firstColLbl");
private Set<Property> propertiesAcc = new LinkedHashSet<>();
private static final Logger logger = Logger.getLogger(DataResultViewerTable.class.getName());
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
@ -179,6 +178,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
* @param parent Node with at least one child to get properties from
* @return Properties,
*/
@SuppressWarnings("rawtypes")
private Node.Property[] getAllChildPropertyHeaders(Node parent) {
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
*/
@Override
@ -303,10 +305,10 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
return;
}
propertiesAcc.clear();
propertiesAcc.clear();
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) {
Node.Property prop = props.remove(0);
((DefaultOutlineModel) ov.getOutline().getOutlineModel()).setNodesColumnLabel(prop.getDisplayName());
@ -346,13 +348,13 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
int totalColumns = props.size();
//int scrollWidth = ttv.getWidth();
int margin = 4;
int startColumn = 1;
//int scrollWidth = ttv.getWidth();
int margin = 4;
int startColumn = 1;
// If there is only one column (which was removed from props above)
// Just let the table resize itself.
ov.getOutline().setAutoResizeMode((props.size() > 0) ? JTable.AUTO_RESIZE_OFF : JTable.AUTO_RESIZE_ALL_COLUMNS);
// If there is only one column (which was removed from props above)
// Just let the table resize itself.
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;
}
PropertySet[] propertySets = child.getPropertySets();
if (propertySets.length > 0)
{
if (propertySets.length > 0) {
Property[] properties = propertySets[0].getProperties();
rowValues[rowCount] = new Object[properties.length];
for (int j = 0; j < properties.length; ++j) {
try {
rowValues[rowCount][j] = properties[j].getValue();
}
catch (IllegalAccessException | InvocationTargetException ignore) {
} catch (IllegalAccessException | InvocationTargetException ignore) {
rowValues[rowCount][j] = "n/a";
}
}
@ -435,6 +435,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
* @param table the object table
* @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) {
// set the tree (the node / names column) width
String headerName = header.get(index - 1).getDisplayName();
@ -487,6 +488,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
}
private class DummyNodeListener implements NodeListener {
private volatile boolean load = true;
public void reset() {

View File

@ -16,7 +16,7 @@
<Layout>
<DimensionLayout dim="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">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
@ -201,18 +201,17 @@
</Component>
<Component class="javax.swing.JComboBox" name="thumbnailSizeComboBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="3">
<StringItem index="0" value="Small Thumbnails"/>
<StringItem index="1" value="Medium Thumbnails"/>
<StringItem index="2" value="Large Thumbnails"/>
</StringArray>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<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"/>
</Property>
<Property name="selectedIndex" type="int" value="1"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="thumbnailSizeComboBoxActionPerformed"/>
</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>
</SubComponents>
</Form>

View File

@ -121,7 +121,7 @@ import org.sleuthkit.datamodel.TskCoreException;
filePathLabel = new javax.swing.JLabel();
goToPageLabel = new javax.swing.JLabel();
goToPageField = new javax.swing.JTextField();
thumbnailSizeComboBox = new javax.swing.JComboBox();
thumbnailSizeComboBox = new javax.swing.JComboBox<>();
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.setSelectedIndex(1);
thumbnailSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "Small Thumbnails", "Medium Thumbnails", "Large Thumbnails" }));
thumbnailSizeComboBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
thumbnailSizeComboBoxActionPerformed(evt);
@ -183,7 +182,7 @@ import org.sleuthkit.datamodel.TskCoreException;
this.setLayout(layout);
layout.setHorizontalGroup(
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()
.addContainerGap()
.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.JLabel pagesLabel;
private javax.swing.JScrollPane thumbnailScrollPanel;
private javax.swing.JComboBox thumbnailSizeComboBox;
private javax.swing.JComboBox<String> thumbnailSizeComboBox;
// End of variables declaration//GEN-END:variables
@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;
import java.io.File;

View File

@ -1,6 +1,20 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
* Autopsy Forensic Browser
*
* 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;
@ -15,54 +29,60 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger;
@OptionsPanelController.TopLevelRegistration(
categoryName = "#OptionsCategory_Name_General",
iconBase = "org/sleuthkit/autopsy/corecomponents/general-options.png",
position = 1,
keywords = "#OptionsCategory_Keywords_General",
keywordsCategory = "General")
// moved to Bundle
//@org.openide.util.NbBundle.Messages({"OptionsCategory_Name_General=General", "OptionsCategory_Keywords_General=general"})
@OptionsPanelController.TopLevelRegistration(categoryName = "#OptionsCategory_Name_General",
iconBase = "org/sleuthkit/autopsy/corecomponents/display-options.png",
position = 1,
keywords = "#OptionsCategory_Keywords_General",
keywordsCategory = "General")
public final class GeneralOptionsPanelController extends OptionsPanelController {
private GeneralPanel panel;
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
private boolean changed;
private static final Logger logger = Logger.getLogger(GeneralOptionsPanelController.class.getName());
@Override
public void update() {
getPanel().load();
changed = false;
}
@Override
public void applyChanges() {
getPanel().store();
changed = false;
}
@Override
public void cancel() {
// need not do anything special, if no changes have been persisted yet
}
@Override
public boolean isValid() {
return getPanel().valid();
}
@Override
public boolean isChanged() {
return changed;
}
@Override
public HelpCtx getHelpCtx() {
return null; // new HelpCtx("...ID") if you have a help set
return null;
}
@Override
public JComponent getComponent(Lookup masterLookup) {
return getPanel();
}
@Override
public void addPropertyChangeListener(PropertyChangeListener l) {
pcs.addPropertyChangeListener(l);
}
@Override
public void removePropertyChangeListener(PropertyChangeListener l) {
pcs.removePropertyChangeListener(l);
}
@ -80,8 +100,7 @@ public final class GeneralOptionsPanelController extends OptionsPanelController
try {
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
}
catch (Exception e) {
} catch (Exception e) {
logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e);
MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
@ -90,15 +109,14 @@ public final class GeneralOptionsPanelController extends OptionsPanelController
}
}
try {
pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
}
catch (Exception e) {
logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e);
MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"),
MessageNotifyUtil.MessageType.ERROR);
}
try {
pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
} catch (Exception e) {
logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e);
MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"),
MessageNotifyUtil.MessageType.ERROR);
}
}
}

View File

@ -107,7 +107,7 @@ public class Installer extends ModuleInstall {
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
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
for(Map.Entry entry : uiEntries.entrySet()) {
for(Map.Entry<Object,Object> entry : uiEntries.entrySet()) {
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
* to an int first.
*/
if (((int) (fileHeaderBuffer[0] & 0xff) == 0xff) && ((int) (fileHeaderBuffer[1] & 0xff) == 0xd8)) {
return true;
}
return false;
return (((fileHeaderBuffer[0] & 0xff) == 0xff) && ((fileHeaderBuffer[1] & 0xff) == 0xd8));
}

View File

@ -208,7 +208,7 @@ public class PlatformUtil {
* @throws IOException exception thrown if extract the file failed for IO
* 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 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.
*
*/
public static boolean xmlIsValid(DOMSource xmlfile, Class clazz, String schemaFile) {
public static <T> boolean xmlIsValid(DOMSource xmlfile, Class<T> clazz, String schemaFile) {
try{
PlatformUtil.extractResourceToUserConfigDir(clazz, 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.
*
*/
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);
return xmlIsValid(dms, clazz, type);
}
@ -118,7 +118,7 @@ public class XMLUtil {
* @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.newInstance();
Document ret = null;
@ -154,7 +154,7 @@ public class XMLUtil {
* @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();
xf.setAttribute("indent-number", new Integer(1));
boolean success = false;

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -189,7 +189,7 @@ public abstract class AbstractAbstractFileNode<T extends AbstractFile> extends A
try {
path = content.getUniquePath();
} 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));
@ -217,10 +217,13 @@ public abstract class AbstractAbstractFileNode<T extends AbstractFile> extends A
static String getContentDisplayName(AbstractFile file) {
String name = file.getName();
if (name.equals("..")) {
name = DirectoryNode.DOTDOTDIR;
} else if (name.equals(".")) {
name = DirectoryNode.DOTDIR;
switch (name) {
case "..":
name = DirectoryNode.DOTDOTDIR;
break;
case ".":
name = DirectoryNode.DOTDIR;
break;
}
return name;
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* 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.Node;
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.Directory;
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
*/
public static class CreateSleuthkitNodeVisitor extends SleuthkitItemVisitor.Default<AbstractContentNode> {
public static class CreateSleuthkitNodeVisitor extends SleuthkitItemVisitor.Default<AbstractContentNode<? extends Content>> {
@Override
public AbstractContentNode visit(Directory drctr) {
public AbstractContentNode<? extends Content> visit(Directory drctr) {
return new DirectoryNode(drctr);
}
@Override
public AbstractContentNode visit(File file) {
public AbstractContentNode<? extends Content> visit(File file) {
return new FileNode(file);
}
@Override
public AbstractContentNode visit(Image image) {
public AbstractContentNode<? extends Content> visit(Image image) {
return new ImageNode(image);
}
@Override
public AbstractContentNode visit(Volume volume) {
public AbstractContentNode<? extends Content> visit(Volume volume) {
return new VolumeNode(volume);
}
@Override
public AbstractContentNode visit(LayoutFile lf) {
public AbstractContentNode<? extends Content> visit(LayoutFile lf) {
return new LayoutFileNode(lf);
}
@Override
public AbstractContentNode visit(DerivedFile df) {
public AbstractContentNode<? extends Content> visit(DerivedFile df) {
return new LocalFileNode(df);
}
@Override
public AbstractContentNode visit(LocalFile lf) {
public AbstractContentNode<? extends Content> visit(LocalFile lf) {
return new LocalFileNode(lf);
}
@Override
public AbstractContentNode visit(VirtualDirectory ld) {
public AbstractContentNode<? extends Content> visit(VirtualDirectory ld) {
return new VirtualDirectoryNode(ld);
}
@Override
protected AbstractContentNode defaultVisit(SleuthkitVisitableItem di) {
protected AbstractContentNode<? extends Content> defaultVisit(SleuthkitVisitableItem di) {
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) {
throw new UnsupportedOperationException(
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) {
final AbstractFilePropertyType propType = AbstractFilePropertyType.values()[i];
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) {
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;

View File

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

View File

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

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013 Basis Technology Corp.
* Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* 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
* 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 final BlackboardArtifactTag tag;
@ -58,7 +59,7 @@ public class BlackboardArtifactTagNode extends DisplayableItemNode {
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"),
"",
@ -66,22 +67,21 @@ public class BlackboardArtifactTagNode extends DisplayableItemNode {
String contentPath;
try {
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);
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"),
"",
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"),
"",
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"),
"",
@ -108,4 +108,3 @@ public class BlackboardArtifactTagNode extends DisplayableItemNode {
return true;
}
}

View File

@ -16,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.datamodel;
import java.util.List;
@ -32,12 +31,13 @@ import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.TskCoreException;
/**
* Instances of this class wrap ContentTag objects. In the Autopsy
* presentation of the SleuthKit data model, they are leaf nodes of a tree
* consisting of content and blackboard artifact tags, grouped first by tag
* type, then by tag name.
* Instances of this class wrap ContentTag objects. In the Autopsy presentation
* of the SleuthKit data model, they are leaf nodes of a tree consisting of
* content and blackboard artifact tags, grouped first by tag type, then by tag
* 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 final ContentTag tag;
@ -58,26 +58,25 @@ import org.sleuthkit.datamodel.TskCoreException;
propertySheet.put(properties);
}
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.file.name"),
NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.file.displayName"),
"",
tag.getContent().getName()));
properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.file.name"),
NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.file.displayName"),
"",
tag.getContent().getName()));
String contentPath;
try {
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);
contentPath = NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.unavail.path");
}
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.filePath.name"),
NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.filePath.displayName"),
"",
contentPath));
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.comment.name"),
NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.comment.displayName"),
"",
tag.getComment()));
properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.filePath.name"),
NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.filePath.displayName"),
"",
contentPath));
properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.comment.name"),
NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.comment.displayName"),
"",
tag.getComment()));
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
* consisting of content and blackboard artifact tags, grouped first by tag type,
* then by tag name.
* consisting of content and blackboard artifact tags, grouped first by tag
* type, then by tag name.
*/
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";
public ContentTagTypeNode(TagName tagName) {
@ -47,8 +48,7 @@ public class ContentTagTypeNode extends DisplayableItemNode {
long tagsCount = 0;
try {
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);
}
@ -66,10 +66,10 @@ public class ContentTagTypeNode extends DisplayableItemNode {
propertySheet.put(properties);
}
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ContentTagTypeNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "ContentTagTypeNode.createSheet.name.displayName"),
"",
getName()));
properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ContentTagTypeNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "ContentTagTypeNode.createSheet.name.displayName"),
"",
getName()));
return propertySheet;
}
@ -85,6 +85,7 @@ public class ContentTagTypeNode extends DisplayableItemNode {
}
private static class ContentTagNodeFactory extends ChildFactory<ContentTag> {
private final 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.
try {
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);
}
return true;

View File

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

View File

@ -102,10 +102,10 @@ public class DataConversion {
outputStringBuilder.append(" ");
// 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++) {
char c = ' ';
if (i < lineLen) {
if (i < ascii.length()) {
c = ascii.charAt(i);
int dec = (int) c;

View File

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

View File

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

View File

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

View File

@ -46,7 +46,7 @@ class ExtractedContentChildren extends ChildFactory<BlackboardArtifact.ARTIFACT_
this.skCase = skCase;
// 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_EMAIL_MSG);
doNotShow.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT);

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* 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;
/**
* 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 {
@ -57,9 +58,9 @@ public class ExtractedContentNode extends DisplayableItemNode {
s.put(ss);
}
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.desc"),
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.desc"),
NAME));
return s;
}

View File

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

View File

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

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -30,12 +30,12 @@ import org.sleuthkit.datamodel.SleuthkitCase;
public class FileTypesNode extends DisplayableItemNode {
private static final String FNAME = NbBundle.getMessage(FileTypesNode.class, "FileTypesNode.fname.text");
private SleuthkitCase 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) {
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) {
super.setName(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 {
super.setName(filter.getName());
super.setDisplayName(filter.getDisplayName());
}
this.skCase = skCase;
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file_types.png");
}
@ -72,9 +70,9 @@ public class FileTypesNode extends DisplayableItemNode {
s.put(ss);
}
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.desc"),
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.desc"),
getName()));
return s;
}

View File

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

View File

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

View File

@ -135,7 +135,7 @@ public class InterestingHits implements AutopsyVisitableItem {
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.desc"),
getName()));
@ -181,7 +181,7 @@ public class InterestingHits implements AutopsyVisitableItem {
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.desc"),
getName()));

View File

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

View File

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

View File

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

View File

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

View File

@ -25,19 +25,19 @@ import org.openide.nodes.PropertySupport;
* 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"})
public NodeProperty(String name, String displayName, String desc, Object value) {
super(name, value.getClass(), displayName, desc);
@SuppressWarnings("unchecked")
public NodeProperty(String name, String displayName, String desc, T value) {
super(name, (Class<T>) value.getClass(), displayName, desc);
setValue("suppressCustomEditor", Boolean.TRUE); // remove the "..." (editing) button
this.value = value;
}
@Override
public Object getValue() throws IllegalAccessException, InvocationTargetException {
public T getValue() throws IllegalAccessException, InvocationTargetException {
return this.value;
}
}

View File

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

View File

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

View File

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

View File

@ -34,17 +34,18 @@ import org.sleuthkit.datamodel.TskCoreException;
/**
* Instances of this class are elements of Node hierarchies consisting of
* content and blackboard artifact tags, grouped first by tag type, then by
* tag name.
* content and blackboard artifact tags, grouped first by tag type, then by tag
* 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 BOOKMARK_TAG_ICON_PATH = "org/sleuthkit/autopsy/images/star-bookmark-icon-16.png";
private final TagName tagName;
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,
"TagNameNode.bbArtTagTypeNodeKey.text");
"TagNameNode.bbArtTagTypeNodeKey.text");
public TagNameNode(TagName tagName) {
super(Children.create(new TagTypeNodeFactory(tagName), true), Lookups.singleton(
@ -55,8 +56,7 @@ public class TagNameNode extends DisplayableItemNode {
try {
tagsCount = Case.getCurrentCase().getServices().getTagsManager().getContentTagsCountByTagName(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);
}
@ -64,8 +64,7 @@ public class TagNameNode extends DisplayableItemNode {
super.setDisplayName(tagName.getDisplayName() + " (" + tagsCount + ")");
if (tagName.getDisplayName().equals(NbBundle.getMessage(this.getClass(), "TagNameNode.bookmark.text"))) {
setIconBaseWithExtension(BOOKMARK_TAG_ICON_PATH);
}
else {
} else {
setIconBaseWithExtension(ICON_PATH);
}
}
@ -79,10 +78,10 @@ public class TagNameNode extends DisplayableItemNode {
propertySheet.put(properties);
}
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "TagNameNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "TagNameNode.createSheet.name.displayName"),
tagName.getDescription(),
getName()));
properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "TagNameNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "TagNameNode.createSheet.name.displayName"),
tagName.getDescription(),
getName()));
return propertySheet;
}
@ -100,6 +99,7 @@ public class TagNameNode extends DisplayableItemNode {
}
private static class TagTypeNodeFactory extends ChildFactory<String> {
private final 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
* Autopsy presentation of the SleuthKit data model. The sub-tree consists of
* content and blackboard artifact tags, grouped first by tag type, then by
* tag name.
* content and blackboard artifact tags, grouped first by tag type, then by tag
* 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 ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png";
@ -67,21 +68,21 @@ import org.sleuthkit.datamodel.TskCoreException;
propertySheet.put(properties);
}
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "TagsNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "TagsNode.createSheet.name.displayName"),
"",
getName()));
properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "TagsNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "TagsNode.createSheet.name.displayName"),
"",
getName()));
return propertySheet;
}
private static class TagNameNodeFactory extends ChildFactory<TagName> {
@Override
protected boolean createKeys(List<TagName> keys) {
try {
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);
}
return true;

View File

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

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 - 2013 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* 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> {
private static Logger logger = Logger.getLogger(VirtualDirectoryNode.class.getName());
//prefix for special VirtualDirectory root nodes grouping local files
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
if (name.equals(VirtualDirectory.NAME_UNALLOC)) {
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");
}
else if (name.equals(VirtualDirectory.NAME_CARVED)) {
} else if (name.equals(VirtualDirectory.NAME_CARVED)) {
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png"); //TODO
}
else {
} else {
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png");
}
}
/**
/**
* Right click action for this node
*
* @param popup
@ -96,20 +92,19 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
s.put(ss);
}
Map<String, Object> map = new LinkedHashMap<String, Object>();
Map<String, Object> map = new LinkedHashMap<>();
fillPropertyMap(map, content);
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(),
"VirtualDirectoryNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.name.desc"),
getName()));
ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(),
"VirtualDirectoryNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.name.desc"),
getName()));
final String NO_DESCR = NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.noDesc");
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;
}
@ -129,7 +124,6 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
return true;
}
/**
* 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 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) {
result = TskData.TSK_FS_META_FLAG_ENUM.ALLOC.toString();
}

View File

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

View File

@ -72,7 +72,7 @@ public class BlackboardArtifactTagTypeNode extends DisplayableItemNode {
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.displayName"),
"",

View File

@ -180,7 +180,7 @@ class DirectoryTreeFilterChildren extends FilterNode.Children {
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
boolean hasChildren = node.hasContentChildren();
if (!hasChildren) {

View File

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

View File

@ -76,6 +76,8 @@ public class NewWindowViewAction extends AbstractAction{
@Override
public void run() {
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.DataSourcesNode;
import org.sleuthkit.autopsy.datamodel.RootContentChildren;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.ContentVisitor;
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);
this.content = node.getLookup().lookup(Content.class);
}

View File

@ -32,7 +32,6 @@ package org.sleuthkit.autopsy.examples;
import java.util.List;
import org.apache.log4j.Logger;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.services.FileManager;
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.
* 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
* 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) {
Logger log = Logger.getLogger(SampleDataSourceIngestModule.class);
log.fatal("Error retrieving files from database: " + ex.getLocalizedMessage());
return;
}
}
@Override
public void init(IngestModuleInit initContext) throws IngestModuleException {
// do nothing
}
@Override
public void complete() {
// do nothing
}
@Override
public void stop() {
// do nothing
}
@Override

View File

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

View File

@ -204,7 +204,7 @@ class DateSearchFilter extends AbstractFileSearchFilter<DateSearchPanel> {
/**
* 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;
@ -215,8 +215,8 @@ class DateSearchFilter extends AbstractFileSearchFilter<DateSearchPanel> {
}
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
String str = (value == null) ? "" : value.toString();
public Component getListCellRendererComponent(JList<? extends String> list, String value, int index, boolean isSelected, boolean cellHasFocus) {
String str = (value == null) ? "" : value;
if (SEPARATOR.equals(str)) {
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">
<NonVisualComponents>
@ -181,8 +181,9 @@
</Property>
</Properties>
<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_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">

View File

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

View File

@ -51,7 +51,7 @@ class SizeSearchFilter extends AbstractFileSearchFilter<SizeSearchPanel> {
return "size " + operator + " " + size;
}
private String compareComboBoxToOperator(JComboBox compare) {
private String compareComboBoxToOperator(JComboBox<String> compare) {
String compareSize = compare.getSelectedItem().toString();
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">
<NonVisualComponents>
@ -79,16 +79,13 @@
<SubComponents>
<Component class="javax.swing.JComboBox" name="sizeUnitComboBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="5">
<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 name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<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"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JFormattedTextField" name="sizeTextField">
<Properties>
@ -105,14 +102,13 @@
</Component>
<Component class="javax.swing.JComboBox" name="sizeCompareComboBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="3">
<StringItem index="0" value="equal to"/>
<StringItem index="1" value="greater than"/>
<StringItem index="2" value="less than"/>
</StringArray>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<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"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JCheckBox" name="sizeCheckBox">
<Properties>

View File

@ -67,7 +67,7 @@ class SizeSearchPanel extends javax.swing.JPanel {
return sizeCheckBox;
}
JComboBox getSizeCompareComboBox() {
JComboBox<String> getSizeCompareComboBox() {
return sizeCompareComboBox;
}
@ -75,7 +75,7 @@ class SizeSearchPanel extends javax.swing.JPanel {
return sizeTextField;
}
JComboBox getSizeUnitComboBox() {
JComboBox<String> getSizeUnitComboBox() {
return sizeUnitComboBox;
}
@ -93,9 +93,9 @@ class SizeSearchPanel extends javax.swing.JPanel {
copyMenuItem = new javax.swing.JMenuItem();
pasteMenuItem = 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());
sizeCompareComboBox = new javax.swing.JComboBox();
sizeCompareComboBox = new javax.swing.JComboBox<String>();
sizeCheckBox = new javax.swing.JCheckBox();
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
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.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
@ -157,9 +157,9 @@ class SizeSearchPanel extends javax.swing.JPanel {
private javax.swing.JPopupMenu rightClickMenu;
private javax.swing.JMenuItem selectAllMenuItem;
private javax.swing.JCheckBox sizeCheckBox;
private javax.swing.JComboBox sizeCompareComboBox;
private javax.swing.JComboBox<String> sizeCompareComboBox;
private javax.swing.JFormattedTextField sizeTextField;
private javax.swing.JComboBox sizeUnitComboBox;
private javax.swing.JComboBox<String> sizeUnitComboBox;
// End of variables declaration//GEN-END:variables
void addActionListener(ActionListener l) {

View File

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

View File

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

View File

@ -100,11 +100,11 @@
<EmptySpace min="-2" pref="101" max="-2" attributes="0"/>
<Component id="totalMessagesNameLabel" min="-2" 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"/>
<Component id="totalUniqueMessagesNameLabel" min="-2" 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"/>
</Group>
</Group>
@ -132,11 +132,8 @@
</Component>
<Component class="javax.swing.JComboBox" name="sortByComboBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="2">
<StringItem index="0" value="Time"/>
<StringItem index="1" value="Priority"/>
</StringArray>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new javax.swing.DefaultComboBoxModel&lt;String&gt;(new String[] { &quot;Time&quot;, &quot;Priority&quot; })" type="code"/>
</Property>
<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;)"/>
@ -146,7 +143,7 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="sortByComboBoxActionPerformed"/>
</Events>
<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>
</Component>
<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
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.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -177,11 +177,11 @@ class IngestMessagePanel extends JPanel implements TableModelListener {
.addGap(101, 101, 101)
.addComponent(totalMessagesNameLabel)
.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)
.addComponent(totalUniqueMessagesNameLabel)
.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))
);
controlPanelLayout.setVerticalGroup(
@ -224,7 +224,7 @@ class IngestMessagePanel extends JPanel implements TableModelListener {
private javax.swing.JPanel controlPanel;
private javax.swing.JScrollPane jScrollPane1;
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 totalMessagesNameLabel;
private javax.swing.JLabel totalMessagesNameVal;

View File

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

View File

@ -136,7 +136,7 @@ public class IngestServices {
* @param file file to be scheduled
* @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());
manager.scheduleFile(file, pipelineContext);
}

View File

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

View File

@ -85,6 +85,10 @@
<Property name="selectionMode" type="int" value="0"/>
<Property name="layoutOrientation" type="int" value="2"/>
</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>
</SubComponents>
</Container>

View File

@ -36,7 +36,6 @@ import javax.swing.JList;
import javax.swing.ListCellRenderer;
import javax.swing.ListModel;
import javax.swing.event.ListDataListener;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
@ -45,9 +44,9 @@ import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
import org.sleuthkit.datamodel.TskCoreException;
public class ArtifactSelectionDialog extends javax.swing.JDialog {
private ArtifactModel model;
private ArtifactRenderer renderer;
private Map<BlackboardArtifact.ARTIFACT_TYPE, Boolean> artifactStates;
private List<BlackboardArtifact.ARTIFACT_TYPE> artifacts;
@ -66,7 +65,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
*/
private void populateList() {
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_TAG_FILE); // 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) {
JList list = (JList) evt.getSource();
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));
list.repaint();
}
@ -135,7 +134,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
private void initComponents() {
artifactScrollPane = new javax.swing.JScrollPane();
artifactList = new javax.swing.JList();
artifactList = new javax.swing.JList<>();
okButton = new javax.swing.JButton();
titleLabel = new javax.swing.JLabel();
selectAllButton = new javax.swing.JButton();
@ -229,9 +228,8 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
}
artifactList.repaint();
}//GEN-LAST:event_deselectAllButtonActionPerformed
// 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.JButton deselectAllButton;
private javax.swing.JButton okButton;
@ -239,7 +237,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
private javax.swing.JLabel titleLabel;
// End of variables declaration//GEN-END:variables
private class ArtifactModel implements ListModel {
private class ArtifactModel implements ListModel<ARTIFACT_TYPE> {
@Override
public int getSize() {
@ -247,7 +245,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
}
@Override
public Object getElementAt(int index) {
public ARTIFACT_TYPE getElementAt(int 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> {
@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) {
setEnabled(list.isEnabled());
setSelected(artifactStates.get(value));

View File

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

View File

@ -123,16 +123,14 @@
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="f0" green="f0" red="f0" type="rgb"/>
</Property>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="5">
<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 name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<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"/>
</Property>
</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>
</SubComponents>
</Container>

View File

@ -93,7 +93,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
modulesJList.getSelectionModel().addListSelectionListener(this);
modulesJList.setCellRenderer(new ModuleCellRenderer());
modulesJList.setListData(modules.toArray());
modulesJList.setListData(modules.toArray(new ReportModule[modules.size()]));
selectedIndex = 0;
modulesJList.setSelectedIndex(selectedIndex);
}
@ -162,7 +162,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
descriptionScrollPane = new javax.swing.JScrollPane();
descriptionTextPane = new javax.swing.JTextPane();
modulesScrollPane = new javax.swing.JScrollPane();
modulesJList = new javax.swing.JList();
modulesJList = new javax.swing.JList<>();
setPreferredSize(new java.awt.Dimension(650, 250));
@ -188,10 +188,10 @@ import org.sleuthkit.autopsy.coreutils.Logger;
descriptionScrollPane.setViewportView(descriptionTextPane);
modulesJList.setBackground(new java.awt.Color(240, 240, 240));
modulesJList.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
modulesJList.setModel(new javax.swing.AbstractListModel<ReportModule>() {
ReportModule[] modules = {};
public int getSize() { return modules.length; }
public ReportModule getElementAt(int i) { return modules[i]; }
});
modulesScrollPane.setViewportView(modulesJList);
@ -229,7 +229,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
private javax.swing.JPanel configurationPanel;
private javax.swing.JScrollPane descriptionScrollPane;
private javax.swing.JTextPane descriptionTextPane;
private javax.swing.JList modulesJList;
private javax.swing.JList<ReportModule> modulesJList;
private javax.swing.JScrollPane modulesScrollPane;
private javax.swing.JLabel reportModulesLabel;
// 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> {
@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.setEnabled(true);
this.setSelected(isSelected);

View File

@ -143,6 +143,10 @@
<Property name="selectionMode" type="int" value="0"/>
<Property name="layoutOrientation" type="int" value="1"/>
</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>
</SubComponents>
</Container>

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013 Basis Technology Corp.
* Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* 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.TskCoreException;
final class ReportVisualPanel2 extends JPanel {
private ReportWizardPanel2 wizPanel;
final class ReportVisualPanel2 extends JPanel {
private ReportWizardPanel2 wizPanel;
private Map<String, Boolean> tagStates = new LinkedHashMap<>();
private List<String> tags = new ArrayList<>();
ArtifactSelectionDialog dialog = new ArtifactSelectionDialog(new JFrame(), true);
private Map<ARTIFACT_TYPE, Boolean> artifactStates = new EnumMap<>(ARTIFACT_TYPE.class);
private List<ARTIFACT_TYPE> artifacts = new ArrayList<>();
private TagsListModel tagsModel;
private TagsListRenderer tagsRenderer;
@ -77,13 +75,12 @@ import org.sleuthkit.datamodel.TskCoreException;
List<TagName> tagNamesInUse;
try {
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);
return;
}
for(TagName tagName : tagNamesInUse) {
for (TagName tagName : tagNamesInUse) {
tagStates.put(tagName.getDisplayName(), Boolean.FALSE);
}
tags.addAll(tagStates.keySet());
@ -100,7 +97,7 @@ import org.sleuthkit.datamodel.TskCoreException;
public void mousePressed(MouseEvent evt) {
JList list = (JList) evt.getSource();
int index = list.locationToIndex(evt.getPoint());
String value = (String) tagsModel.getElementAt(index);
String value = tagsModel.getElementAt(index);
tagStates.put(value, !tagStates.get(value));
list.repaint();
updateFinishButton();
@ -112,7 +109,7 @@ import org.sleuthkit.datamodel.TskCoreException;
private void initArtifactTypes() {
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_TAG_FILE); // 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() {
boolean result = false;
for (Entry<String, Boolean> entry: tagStates.entrySet()) {
for (Entry<String, Boolean> entry : tagStates.entrySet()) {
if (entry.getValue()) {
result = true;
}
@ -161,7 +158,7 @@ import org.sleuthkit.datamodel.TskCoreException;
private boolean areArtifactsSelected() {
boolean result = false;
for (Entry<ARTIFACT_TYPE, Boolean> entry: artifactStates.entrySet()) {
for (Entry<ARTIFACT_TYPE, Boolean> entry : artifactStates.entrySet()) {
if (entry.getValue()) {
result = true;
}
@ -199,7 +196,7 @@ import org.sleuthkit.datamodel.TskCoreException;
selectAllButton = new javax.swing.JButton();
deselectAllButton = new javax.swing.JButton();
tagsScrollPane = new javax.swing.JScrollPane();
tagsList = new javax.swing.JList();
tagsList = new javax.swing.JList<>();
advancedButton = new javax.swing.JButton();
setPreferredSize(new java.awt.Dimension(650, 250));
@ -316,7 +313,6 @@ import org.sleuthkit.datamodel.TskCoreException;
artifactStates = dialog.display();
wizPanel.setFinish(areArtifactsSelected());
}//GEN-LAST:event_advancedButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton advancedButton;
private javax.swing.JRadioButton allResultsRadioButton;
@ -325,11 +321,11 @@ import org.sleuthkit.datamodel.TskCoreException;
private javax.swing.ButtonGroup optionsButtonGroup;
private javax.swing.JButton selectAllButton;
private javax.swing.JRadioButton taggedResultsRadioButton;
private javax.swing.JList tagsList;
private javax.swing.JList<String> tagsList;
private javax.swing.JScrollPane tagsScrollPane;
// End of variables declaration//GEN-END:variables
private class TagsListModel implements ListModel {
private class TagsListModel implements ListModel<String> {
@Override
public int getSize() {
@ -337,7 +333,7 @@ import org.sleuthkit.datamodel.TskCoreException;
}
@Override
public Object getElementAt(int index) {
public String getElementAt(int index) {
return tags.get(index);
}
@ -351,10 +347,10 @@ import org.sleuthkit.datamodel.TskCoreException;
}
// Render the Tags as JCheckboxes
private class TagsListRenderer extends JCheckBox implements ListCellRenderer {
private class TagsListRenderer extends JCheckBox implements ListCellRenderer<String> {
@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) {
setEnabled(list.isEnabled());
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,
* and start all necessary reports.
*/
@SuppressWarnings("unchecked")
public static void doReportWizard() {
WizardDescriptor wiz = new WizardDescriptor(new ReportWizardIterator());
wiz.setTitleFormat(new MessageFormat("{0} {1}"));
wiz.setTitle(NbBundle.getMessage(ReportWizardAction.class, "ReportWizardAction.reportWiz.title"));
if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
@SuppressWarnings("unchecked")
ReportGenerator generator = new ReportGenerator((Map<TableReportModule, Boolean>)wiz.getProperty("tableModuleStates"),
(Map<GeneralReportModule, Boolean>)wiz.getProperty("generalModuleStates"),
(Map<FileReportModule, Boolean>)wiz.getProperty("fileModuleStates"));

View File

@ -63,16 +63,14 @@
<SubComponents>
<Component class="javax.swing.JList" name="optionsList">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="5">
<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 name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<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"/>
</Property>
</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>
</SubComponents>
</Container>

View File

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

View File

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

View File

@ -1,6 +1,6 @@
Manifest-Version: 1.0
AutoUpdate-Show-In-Client: true
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-Localizing-Bundle: org/sleuthkit/autopsy/exifparser/Bundle.properties

View File

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

View File

@ -120,7 +120,7 @@ class FileExtMismatchXML {
Element extEl = (Element)extNList.item(extIndex);
extStrings.add(extEl.getTextContent());
}
String[] sarray = (String[])extStrings.toArray(new String[0]);
String[] sarray = extStrings.toArray(new String[0]);
sigTypeToExtMap.put(mimetype, sarray);
} else {
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
AutoUpdate-Show-In-Client: true
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-Localizing-Bundle: org/sleuthkit/autopsy/hashdatabase/Bundle.properties

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
Manifest-Version: 1.0
AutoUpdate-Show-In-Client: true
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-Layer: org/sleuthkit/autopsy/keywordsearch/layer.xml
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/keywordsearch/Bundle.properties

View File

@ -96,7 +96,7 @@
<compile-dependency/>
<run-dependency>
<release-version>9</release-version>
<specification-version>7.0</specification-version>
<specification-version>7.1</specification-version>
</run-dependency>
</dependency>
</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 EXTRA_CHARS = 128; //for whitespace
private static final char[] TEXT_CHUNK_BUF = new char[MAX_EXTR_TEXT_CHARS];
private static final int MAX_SIZE = 50000000;
private KeywordSearchIngestModule module;
private Ingester ingester;
private AbstractFile sourceFile;
@ -217,7 +218,7 @@ import org.sleuthkit.datamodel.ReadContentInputStream;
public boolean isSupported(AbstractFile file, String detectedFormat) {
if (detectedFormat == null) {
return false;
} else if (WEB_MIME_TYPES.contains(detectedFormat)) {
} else if (WEB_MIME_TYPES.contains(detectedFormat) && file.getSize() <= MAX_SIZE) {
return true;
} else {
return false;

View File

@ -279,6 +279,10 @@ class AbstractFileTikaTextExtract implements AbstractFileExtract {
else if (detectedFormat.contains("video/")
&& !detectedFormat.equals("video/x-flv")) {
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