Merger in release-4.6.0 branch

This commit is contained in:
Richard Cordovano 2018-01-23 11:34:53 -05:00
commit 447c4d430d
24 changed files with 444 additions and 319 deletions

View File

@ -229,5 +229,5 @@ CueBannerPanel.openCaseButton.text=
CueBannerPanel.openCaseLabel.text=Open Case
MultiUserCasesPanel.bnOpenSingleUserCase.text=Open Single-User Case...
CueBannerPanel.newCaseButton.text=
MultiUserCasesPanel.searchLabel.text=Start typing to search by case name
MultiUserCasesPanel.searchLabel.text=Select any case and start typing to search by case name
MultiUserCasesPanel.cancelButton.text=Cancel

View File

@ -18,11 +18,9 @@
*/
package org.sleuthkit.autopsy.casemodule;
import java.awt.Component;
import java.lang.reflect.InvocationTargetException;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumnModel;
import org.netbeans.swing.etable.ETableColumn;
import org.netbeans.swing.etable.ETableColumnModel;
@ -33,14 +31,12 @@ import java.awt.EventQueue;
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import javax.swing.SwingWorker;
import org.openide.explorer.ExplorerManager;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coordinationservice.CaseNodeData;
import org.sleuthkit.autopsy.coordinationservice.CoordinationService;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.EmptyNode;
@ -61,7 +57,7 @@ class CaseBrowser extends javax.swing.JPanel implements ExplorerManager.Provider
private final org.openide.explorer.view.OutlineView outlineView;
private int originalPathColumnIndex = 0;
private static final Logger LOGGER = Logger.getLogger(CaseBrowser.class.getName());
private LoadCaseMapWorker tableWorker;
private LoadCaseListWorker tableWorker;
@Override
public ExplorerManager getExplorerManager() {
@ -78,7 +74,6 @@ class CaseBrowser extends javax.swing.JPanel implements ExplorerManager.Provider
outline = outlineView.getOutline();
outlineView.setPropertyColumns(
Bundle.CaseNode_column_createdTime(), Bundle.CaseNode_column_createdTime(),
Bundle.CaseNode_column_status(), Bundle.CaseNode_column_status(),
Bundle.CaseNode_column_metadataFilePath(), Bundle.CaseNode_column_metadataFilePath());
((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel(Bundle.CaseNode_column_name());
customize();
@ -100,7 +95,7 @@ class CaseBrowser extends javax.swing.JPanel implements ExplorerManager.Provider
dateColumnIndex = index;
}
}
//Hide path column by default will need to
//Hide path column by default (user can unhide it)
ETableColumn column = (ETableColumn) columnModel.getColumn(originalPathColumnIndex);
((ETableColumnModel) columnModel).setColumnHidden(column, true);
outline.setRootVisible(false);
@ -124,6 +119,11 @@ class CaseBrowser extends javax.swing.JPanel implements ExplorerManager.Provider
outline.getSelectionModel().addListSelectionListener(listener);
}
/**
* Get the path to the .aut file for the selected case.
*
* @return the full path to the selected case's .aut file
*/
String getCasePath() {
int[] selectedRows = outline.getSelectedRows();
if (selectedRows.length == 1) {
@ -157,7 +157,7 @@ class CaseBrowser extends javax.swing.JPanel implements ExplorerManager.Provider
//set the table to display text informing the user that the list is being retreived and disable case selection
EmptyNode emptyNode = new EmptyNode(Bundle.CaseBrowser_caseListLoading_message());
em.setRootContext(emptyNode);
tableWorker = new LoadCaseMapWorker();
tableWorker = new LoadCaseListWorker();
tableWorker.execute();
}
@ -189,13 +189,11 @@ class CaseBrowser extends javax.swing.JPanel implements ExplorerManager.Provider
// End of variables declaration//GEN-END:variables
/**
* Swingworker to fetch the updated map of cases and their status in a
* background thread
* Swingworker to fetch the updated List of cases in a background thread
*/
private class LoadCaseMapWorker extends SwingWorker<Void, Void> {
private class LoadCaseListWorker extends SwingWorker<Void, Void> {
private static final String ALERT_FILE_NAME = "autoingest.alert";
private Map<CaseMetadata, Boolean> cases;
private List<CaseMetadata> cases;
/**
* Gets a list of the cases in the top level case folder
@ -204,8 +202,8 @@ class CaseBrowser extends javax.swing.JPanel implements ExplorerManager.Provider
*
* @throws CoordinationServiceException
*/
private Map<CaseMetadata, Boolean> getCases() throws CoordinationService.CoordinationServiceException {
Map<CaseMetadata, Boolean> casesMap = new HashMap<>();
private List<CaseMetadata> getCases() throws CoordinationService.CoordinationServiceException {
List<CaseMetadata> caseList = new ArrayList<>();
List<String> nodeList = CoordinationService.getInstance().getNodeList(CoordinationService.CategoryNode.CASES);
for (String node : nodeList) {
@ -213,64 +211,27 @@ class CaseBrowser extends javax.swing.JPanel implements ExplorerManager.Provider
File caseFolder = casePath.toFile();
if (caseFolder.exists()) {
/*
* Search for '*.aut' and 'autoingest.alert' files.
* Search for '*.aut' files.
*/
File[] fileArray = caseFolder.listFiles();
if (fileArray == null) {
continue;
}
String autFilePath = null;
boolean alertFileFound = false;
for (File file : fileArray) {
String name = file.getName().toLowerCase();
if (autFilePath == null && name.endsWith(".aut")) {
autFilePath = file.getAbsolutePath();
if (!alertFileFound) {
continue;
try {
caseList.add(new CaseMetadata(Paths.get(file.getAbsolutePath())));
} catch (CaseMetadata.CaseMetadataException ex) {
LOGGER.log(Level.SEVERE, String.format("Error reading case metadata file '%s'.", autFilePath), ex);
}
}
if (!alertFileFound && name.endsWith(ALERT_FILE_NAME)) {
alertFileFound = true;
}
if (autFilePath != null && alertFileFound) {
break;
}
}
if (autFilePath != null) {
try {
boolean hasAlertStatus = false;
if (alertFileFound) {
/*
* When an alert file exists, ignore the node
* data and use the ALERT status.
*/
hasAlertStatus = true;
} else {
byte[] rawData = CoordinationService.getInstance().getNodeData(CoordinationService.CategoryNode.CASES, node);
if (rawData != null && rawData.length > 0) {
/*
* When node data exists, use the status
* stored in the node data.
*/
CaseNodeData caseNodeData = new CaseNodeData(rawData);
if (caseNodeData.getErrorsOccurred()) {
hasAlertStatus = true;
}
}
}
CaseMetadata caseMetadata = new CaseMetadata(Paths.get(autFilePath));
casesMap.put(caseMetadata, hasAlertStatus);
} catch (CaseMetadata.CaseMetadataException ex) {
LOGGER.log(Level.SEVERE, String.format("Error reading case metadata file '%s'.", autFilePath), ex);
} catch (InterruptedException | CaseNodeData.InvalidDataException ex) {
LOGGER.log(Level.SEVERE, String.format("Error reading case node data for '%s'.", node), ex);
}
}
}
}
return casesMap;
return caseList;
}
@Override

View File

@ -27,13 +27,13 @@
<Group type="103" groupAlignment="1" attributes="0">
<Component id="caseExplorerScrollPane" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="searchLabel" min="-2" pref="555" max="-2" attributes="0"/>
<EmptySpace pref="175" max="32767" attributes="0"/>
<Component id="bnOpen" min="-2" pref="80" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="searchLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="120" max="32767" attributes="0"/>
<Component id="bnOpenSingleUserCase" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="226" max="-2" attributes="0"/>
<Component id="bnOpen" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
<Component id="cancelButton" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
@ -52,7 +52,7 @@
<Component id="bnOpenSingleUserCase" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="searchLabel" alignment="3" max="32767" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -64,6 +64,15 @@
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="MultiUserCasesPanel.bnOpen.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[80, 23]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[80, 23]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[80, 23]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="bnOpenActionPerformed"/>
@ -74,6 +83,12 @@
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="MultiUserCasesPanel.bnOpenSingleUserCase.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[156, 23]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[156, 23]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="bnOpenSingleUserCaseActionPerformed"/>
@ -84,6 +99,15 @@
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="MultiUserCasesPanel.cancelButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[80, 23]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[80, 23]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[80, 23]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelButtonActionPerformed"/>

View File

@ -165,6 +165,9 @@ final class MultiUserCasesPanel extends JPanel{
org.openide.awt.Mnemonics.setLocalizedText(bnOpen, org.openide.util.NbBundle.getMessage(MultiUserCasesPanel.class, "MultiUserCasesPanel.bnOpen.text")); // NOI18N
bnOpen.setEnabled(false);
bnOpen.setMaximumSize(new java.awt.Dimension(80, 23));
bnOpen.setMinimumSize(new java.awt.Dimension(80, 23));
bnOpen.setPreferredSize(new java.awt.Dimension(80, 23));
bnOpen.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bnOpenActionPerformed(evt);
@ -172,6 +175,8 @@ final class MultiUserCasesPanel extends JPanel{
});
org.openide.awt.Mnemonics.setLocalizedText(bnOpenSingleUserCase, org.openide.util.NbBundle.getMessage(MultiUserCasesPanel.class, "MultiUserCasesPanel.bnOpenSingleUserCase.text")); // NOI18N
bnOpenSingleUserCase.setMinimumSize(new java.awt.Dimension(156, 23));
bnOpenSingleUserCase.setPreferredSize(new java.awt.Dimension(156, 23));
bnOpenSingleUserCase.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bnOpenSingleUserCaseActionPerformed(evt);
@ -179,6 +184,9 @@ final class MultiUserCasesPanel extends JPanel{
});
org.openide.awt.Mnemonics.setLocalizedText(cancelButton, org.openide.util.NbBundle.getMessage(MultiUserCasesPanel.class, "MultiUserCasesPanel.cancelButton.text")); // NOI18N
cancelButton.setMaximumSize(new java.awt.Dimension(80, 23));
cancelButton.setMinimumSize(new java.awt.Dimension(80, 23));
cancelButton.setPreferredSize(new java.awt.Dimension(80, 23));
cancelButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelButtonActionPerformed(evt);
@ -196,15 +204,18 @@ final class MultiUserCasesPanel extends JPanel{
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(caseExplorerScrollPane)
.addGroup(layout.createSequentialGroup()
.addComponent(searchLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 555, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 175, Short.MAX_VALUE)
.addComponent(bnOpen, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(searchLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 120, Short.MAX_VALUE)
.addComponent(bnOpenSingleUserCase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(226, 226, 226)
.addComponent(bnOpen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bnOpenSingleUserCase)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cancelButton)))
.addComponent(cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {bnOpen, cancelButton});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
@ -212,11 +223,11 @@ final class MultiUserCasesPanel extends JPanel{
.addComponent(caseExplorerScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 450, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cancelButton)
.addComponent(bnOpen)
.addComponent(bnOpenSingleUserCase)
.addComponent(cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bnOpen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bnOpenSingleUserCase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(searchLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents

View File

@ -25,8 +25,6 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import javax.swing.AbstractAction;
import javax.swing.Action;
@ -49,7 +47,6 @@ final class MultiUserNode extends AbstractNode {
@Messages({"CaseNode.column.name=Name",
"CaseNode.column.createdTime=Created Time",
"CaseNode.column.status=Status",
"CaseNode.column.metadataFilePath=Path"})
private static final Logger LOGGER = Logger.getLogger(MultiUserNode.class.getName());
private static final String LOG_FILE_NAME = "auto_ingest_log.txt";
@ -57,31 +54,30 @@ final class MultiUserNode extends AbstractNode {
/**
* Provides a root node with children which each represent a case.
*
* @param caseMap the map of cases and a boolean indicating if they have an
* alert
* @param caseList the list of CaseMetadata objects representing the cases
*/
MultiUserNode(Map<CaseMetadata, Boolean> caseMap) {
super(Children.create(new MultiUserNodeChildren(caseMap), true));
MultiUserNode(List<CaseMetadata> caseList) {
super(Children.create(new MultiUserNodeChildren(caseList), true));
}
static class MultiUserNodeChildren extends ChildFactory<Entry<CaseMetadata, Boolean>> {
static class MultiUserNodeChildren extends ChildFactory<CaseMetadata> {
private final Map<CaseMetadata, Boolean> caseMap;
private final List<CaseMetadata> caseList;
MultiUserNodeChildren(Map<CaseMetadata, Boolean> caseMap) {
this.caseMap = caseMap;
MultiUserNodeChildren(List<CaseMetadata> caseList) {
this.caseList = caseList;
}
@Override
protected boolean createKeys(List<Entry<CaseMetadata, Boolean>> list) {
if (caseMap != null && caseMap.size() > 0) {
list.addAll(caseMap.entrySet());
protected boolean createKeys(List<CaseMetadata> list) {
if (caseList != null && caseList.size() > 0) {
list.addAll(caseList);
}
return true;
}
@Override
protected Node createNodeForKey(Entry<CaseMetadata, Boolean> key) {
protected Node createNodeForKey(CaseMetadata key) {
return new MultiUserCaseNode(key);
}
@ -95,19 +91,17 @@ final class MultiUserNode extends AbstractNode {
private final String caseName;
private final String caseCreatedDate;
private final String caseMetadataFilePath;
private final boolean caseHasAlert;
private final Path caseLogFilePath;
MultiUserCaseNode(Entry<CaseMetadata, Boolean> multiUserCase) {
MultiUserCaseNode(CaseMetadata multiUserCase) {
super(Children.LEAF);
caseName = multiUserCase.getKey().getCaseDisplayName();
caseCreatedDate = multiUserCase.getKey().getCreatedDate();
caseHasAlert = multiUserCase.getValue();
caseName = multiUserCase.getCaseDisplayName();
caseCreatedDate = multiUserCase.getCreatedDate();
super.setName(caseName);
setName(caseName);
setDisplayName(caseName);
caseMetadataFilePath = multiUserCase.getKey().getFilePath().toString();
caseLogFilePath = Paths.get(multiUserCase.getKey().getCaseDirectory(), LOG_FILE_NAME);
caseMetadataFilePath = multiUserCase.getFilePath().toString();
caseLogFilePath = Paths.get(multiUserCase.getCaseDirectory(), LOG_FILE_NAME);
}
/**
@ -119,7 +113,6 @@ final class MultiUserNode extends AbstractNode {
return new OpenMultiUserCaseAction(caseMetadataFilePath);
}
@Messages({"MultiUserNode.AlertColumn.text=Alert"}) //text to display when there is an alert present
@Override
protected Sheet createSheet() {
Sheet s = super.createSheet();
@ -132,8 +125,6 @@ final class MultiUserNode extends AbstractNode {
caseName));
ss.put(new NodeProperty<>(Bundle.CaseNode_column_createdTime(), Bundle.CaseNode_column_createdTime(), Bundle.CaseNode_column_createdTime(),
caseCreatedDate));
ss.put(new NodeProperty<>(Bundle.CaseNode_column_status(), Bundle.CaseNode_column_status(), Bundle.CaseNode_column_status(),
(caseHasAlert == true ? Bundle.MultiUserNode_AlertColumn_text() : "")));
ss.put(new NodeProperty<>(Bundle.CaseNode_column_metadataFilePath(), Bundle.CaseNode_column_metadataFilePath(), Bundle.CaseNode_column_metadataFilePath(),
caseMetadataFilePath));
return s;

View File

@ -118,7 +118,7 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer
LOGGER.log(Level.INFO, "Mimetype not known for file: {0}", file.getName()); //NON-NLS
try {
FileTypeDetector fileTypeDetector = new FileTypeDetector();
mimeType = fileTypeDetector.detectMIMEType(file);
mimeType = fileTypeDetector.getMIMEType(file);
}catch (FileTypeDetector.FileTypeDetectorInitException ex) {
LOGGER.log(Level.SEVERE, "Failed to initialize FileTypeDetector.", ex); //NON-NLS
return;
@ -191,7 +191,7 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer
LOGGER.log(Level.INFO, "Mimetype not known for file: {0}", aFile.getName()); //NON-NLS
try {
FileTypeDetector fileTypeDetector = new FileTypeDetector();
mimeType = fileTypeDetector.detectMIMEType(aFile);
mimeType = fileTypeDetector.getMIMEType(aFile);
}catch (FileTypeDetector.FileTypeDetectorInitException ex) {
LOGGER.log(Level.SEVERE, "Failed to initialize FileTypeDetector.", ex); //NON-NLS
return false;
@ -215,7 +215,7 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer
LOGGER.log(Level.INFO, "Mimetype not known for file: {0}", file.getName()); //NON-NLS
try {
FileTypeDetector fileTypeDetector = new FileTypeDetector();
mimeType = fileTypeDetector.detectMIMEType(file);
mimeType = fileTypeDetector.getMIMEType(file);
}catch (FileTypeDetector.FileTypeDetectorInitException ex) {
LOGGER.log(Level.SEVERE, "Failed to initialize FileTypeDetector.", ex); //NON-NLS
return 0;

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2014-2017 Basis Technology Corp.
* Copyright 2014-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -67,6 +67,8 @@ public final class UserPreferences {
private static final String APP_NAME = "AppName";
public static final String SETTINGS_PROPERTIES = "AutoIngest";
private static final String MODE = "AutopsyMode"; // NON-NLS
private static final String MAX_NUM_OF_LOG_FILE = "MaximumNumberOfLogFiles";
private static final int LOG_FILE_NUM_INT = 10;
// Prevent instantiation.
private UserPreferences() {
@ -369,4 +371,26 @@ public final class UserPreferences {
preferences.put(APP_NAME, name);
}
/**
* get the maximum number of log files to save
* @return Number of log files
*/
public static int getLogFileCount() {
return preferences.getInt(MAX_NUM_OF_LOG_FILE, LOG_FILE_NUM_INT);
}
/**
* get the default number of log files to save
* @return LOG_FILE_COUNT
*/
public static int getDefaultLogFileCount() {
return LOG_FILE_NUM_INT;
}
/**
* Set the maximum number of log files to save
* @param count number of log files
*/
public static void setLogFileCount(int count) {
preferences.putInt(MAX_NUM_OF_LOG_FILE, count);
}
}

View File

@ -24,7 +24,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="0" pref="1010" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
@ -44,18 +44,26 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[671, 488]"/>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="logoPanel" max="32767" attributes="0"/>
<Component id="viewPanel" alignment="0" max="32767" attributes="0"/>
<Component id="runtimePanel" alignment="1" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="viewPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="runtimePanel" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -63,10 +71,11 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="viewPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="runtimePanel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="viewPanel" max="32767" attributes="0"/>
<Component id="runtimePanel" max="32767" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="logoPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -245,7 +254,7 @@
<Component id="viewsHideSlackCB" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="useLocalTimeRB" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="158" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
@ -436,28 +445,43 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="maxMemoryLabel" min="-2" pref="114" max="-2" attributes="0"/>
<Component id="totalMemoryLabel" pref="0" max="32767" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="systemMemoryTotal" max="32767" attributes="0"/>
<Component id="memField" pref="37" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="maxMemoryUnitsLabel" min="-2" pref="17" max="-2" attributes="0"/>
<Component id="maxMemoryUnitsLabel1" min="-2" pref="17" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="totalMemoryLabel" min="-2" pref="114" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="systemMemoryTotal" min="-2" pref="37" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="restartNecessaryWarning" pref="417" max="32767" attributes="0"/>
<Component id="memFieldValidationLabel" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="maxMemoryUnitsLabel1" min="-2" pref="17" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="restartNecessaryWarning" pref="333" max="32767" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="maxMemoryUnitsLabel" min="-2" pref="17" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="memFieldValidationLabel" min="-2" pref="263" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" attributes="0">
<Component id="maxMemoryLabel" min="-2" pref="114" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="memField" min="-2" pref="37" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="maxLogFileCount" min="-2" pref="114" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="logFileCount" min="-2" pref="37" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="logNumAlert" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -466,22 +490,29 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="totalMemoryLabel" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="maxMemoryUnitsLabel" alignment="3" min="-2" pref="20" max="-2" attributes="0"/>
<Component id="memField" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="memFieldValidationLabel" alignment="0" max="32767" attributes="0"/>
<Component id="maxMemoryLabel" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
<Component id="restartNecessaryWarning" alignment="3" min="-2" pref="20" max="-2" attributes="0"/>
<Component id="maxMemoryUnitsLabel1" alignment="3" min="-2" pref="20" max="-2" attributes="0"/>
</Group>
<Component id="totalMemoryLabel" alignment="0" max="32767" attributes="0"/>
<Component id="systemMemoryTotal" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="maxMemoryLabel" alignment="3" min="-2" pref="20" max="-2" attributes="0"/>
<Component id="memField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="maxMemoryUnitsLabel" alignment="3" min="-2" pref="20" max="-2" attributes="0"/>
</Group>
<Component id="memFieldValidationLabel" min="-2" pref="17" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="maxLogFileCount" alignment="3" min="-2" pref="19" max="-2" attributes="0"/>
<Component id="logFileCount" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="logNumAlert" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -545,6 +576,40 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="maxLogFileCount">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyOptionsPanel.maxLogFileCount.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="logFileCount">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="logFileCountKeyReleased"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="logNumAlert">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="logNumAlert" property="font" relativeSize="false" size="11"/>
</FontInfo>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyOptionsPanel.logNumAlert.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2017 Basis Technology Corp.
* Copyright 2011-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -73,7 +73,9 @@ import org.sleuthkit.autopsy.report.ReportBranding;
"AutopsyOptionsPanel.browseLogosButton.text=Browse",
"AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.invalidPath.text=Path is not valid.",
"AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.invalidImageSpecified.text=Invalid image file specified.",
"AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.pathNotSet.text=Agency logo path must be set."
"AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.pathNotSet.text=Agency logo path must be set.",
"AutopsyOptionsPanel.maxLogFileCount.text=Maximum Log Files:",
"AutopsyOptionsPanel.logNumAlert.invalidInput.text=A positive integer is required here."
})
final class AutopsyOptionsPanel extends javax.swing.JPanel {
@ -110,6 +112,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
textFieldListener = new TextFieldListener();
agencyLogoPathField.getDocument().addDocumentListener(textFieldListener);
logFileCount.setText(String.valueOf(UserPreferences.getLogFileCount()));
}
/**
@ -309,6 +312,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
specifyLogoRB.setSelected(!useDefault);
agencyLogoPathField.setEnabled(!useDefault);
browseLogosButton.setEnabled(!useDefault);
logFileCount.setText(String.valueOf(UserPreferences.getLogFileCount()));
try {
updateAgencyLogo(path);
} catch (IOException ex) {
@ -363,6 +367,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
UserPreferences.setHideSlackFilesInDataSourcesTree(dataSourcesHideSlackCB.isSelected());
UserPreferences.setHideSlackFilesInViewsTree(viewsHideSlackCB.isSelected());
UserPreferences.setDisplayTimesInLocalTime(useLocalTimeRB.isSelected());
UserPreferences.setLogFileCount(Integer.parseInt(logFileCount.getText()));
if (!agencyLogoPathField.getText().isEmpty()) {
File file = new File(agencyLogoPathField.getText());
if (file.exists()) {
@ -394,6 +399,9 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
if (!isMemFieldValid()) {
valid = false;
}
if (!isLogNumFieldValid()) {
valid = false;
}
return valid;
}
@ -476,6 +484,26 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
return true;
}
/**
* Check if the logFileCount field is valid.
*
* @return true if the logFileCount is valid false if it is not
*/
private boolean isLogNumFieldValid() {
String count = logFileCount.getText();
logNumAlert.setText("");
try {
int count_num = Integer.parseInt(count);
if (count_num < 1) {
logNumAlert.setText(Bundle.AutopsyOptionsPanel_logNumAlert_invalidInput_text());
return false;
}
} catch (NumberFormatException e) {
logNumAlert.setText(Bundle.AutopsyOptionsPanel_logNumAlert_invalidInput_text());
return false;
}
return true;
}
/**
* Listens for registered text fields that have changed and fires a
* PropertyChangeEvent accordingly.
@ -540,9 +568,14 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
memField = new javax.swing.JTextField();
memFieldValidationLabel = new javax.swing.JLabel();
maxMemoryUnitsLabel1 = new javax.swing.JLabel();
maxLogFileCount = new javax.swing.JLabel();
logFileCount = new javax.swing.JTextField();
logNumAlert = new javax.swing.JTextField();
jScrollPane1.setBorder(null);
jPanel1.setPreferredSize(new java.awt.Dimension(671, 488));
logoPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.logoPanel.border.title"))); // NOI18N
agencyLogoPathField.setText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.agencyLogoPathField.text")); // NOI18N
@ -712,7 +745,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
.addComponent(dataSourcesHideSlackCB)
.addComponent(viewsHideSlackCB)
.addComponent(useLocalTimeRB))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addContainerGap(158, Short.MAX_VALUE))))
.addGroup(viewPanelLayout.createSequentialGroup()
.addGroup(viewPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabelHideSlackFiles)
@ -774,68 +807,103 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
org.openide.awt.Mnemonics.setLocalizedText(maxMemoryUnitsLabel1, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.maxMemoryUnitsLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(maxLogFileCount, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.maxLogFileCount.text")); // NOI18N
logFileCount.setHorizontalAlignment(javax.swing.JTextField.TRAILING);
logFileCount.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
logFileCountKeyReleased(evt);
}
});
logNumAlert.setEditable(false);
logNumAlert.setFont(logNumAlert.getFont().deriveFont(logNumAlert.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
logNumAlert.setForeground(new java.awt.Color(255, 0, 0));
logNumAlert.setText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.logNumAlert.text")); // NOI18N
logNumAlert.setBorder(null);
javax.swing.GroupLayout runtimePanelLayout = new javax.swing.GroupLayout(runtimePanel);
runtimePanel.setLayout(runtimePanelLayout);
runtimePanelLayout.setHorizontalGroup(
runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(runtimePanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(maxMemoryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(totalMemoryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(runtimePanelLayout.createSequentialGroup()
.addComponent(totalMemoryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(systemMemoryTotal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(memField, javax.swing.GroupLayout.DEFAULT_SIZE, 37, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(systemMemoryTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(2, 2, 2)
.addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(runtimePanelLayout.createSequentialGroup()
.addComponent(maxMemoryUnitsLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(restartNecessaryWarning, javax.swing.GroupLayout.DEFAULT_SIZE, 333, Short.MAX_VALUE))
.addGroup(runtimePanelLayout.createSequentialGroup()
.addComponent(maxMemoryUnitsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(maxMemoryUnitsLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(memFieldValidationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))))
.addGroup(runtimePanelLayout.createSequentialGroup()
.addComponent(maxMemoryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(memField, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(runtimePanelLayout.createSequentialGroup()
.addComponent(maxLogFileCount, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(logFileCount, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(restartNecessaryWarning, javax.swing.GroupLayout.DEFAULT_SIZE, 417, Short.MAX_VALUE)
.addComponent(memFieldValidationLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(logNumAlert)))
.addContainerGap())
);
runtimePanelLayout.setVerticalGroup(
runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(runtimePanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(maxMemoryUnitsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(memField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(memFieldValidationLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(maxMemoryLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(totalMemoryLabel)
.addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(restartNecessaryWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(maxMemoryUnitsLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(totalMemoryLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(systemMemoryTotal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addComponent(systemMemoryTotal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(maxMemoryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(memField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(maxMemoryUnitsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(memFieldValidationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(maxLogFileCount, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(logFileCount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(logNumAlert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(logoPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(viewPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(runtimePanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(viewPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(runtimePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(viewPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(runtimePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(viewPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(runtimePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(logoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
@ -846,7 +914,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1010, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -854,38 +922,84 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
);
}// </editor-fold>//GEN-END:initComponents
private void useBestViewerRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useBestViewerRBActionPerformed
private void logFileCountKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_logFileCountKeyReleased
String count = logFileCount.getText();
if (count.equals(String.valueOf(UserPreferences.getDefaultLogFileCount()))) {
//if it is still the default value don't fire change
return;
}
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_useBestViewerRBActionPerformed
}//GEN-LAST:event_logFileCountKeyReleased
private void keepCurrentViewerRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keepCurrentViewerRBActionPerformed
private void memFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_memFieldKeyReleased
String memText = memField.getText();
if (memText.equals(initialMemValue)) {
//if it is still the initial value don't fire change
return;
}
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_keepCurrentViewerRBActionPerformed
private void dataSourcesHideKnownCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataSourcesHideKnownCBActionPerformed
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_dataSourcesHideKnownCBActionPerformed
private void viewsHideKnownCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewsHideKnownCBActionPerformed
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_viewsHideKnownCBActionPerformed
private void useLocalTimeRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useLocalTimeRBActionPerformed
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_useLocalTimeRBActionPerformed
}//GEN-LAST:event_memFieldKeyReleased
private void useGMTTimeRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useGMTTimeRBActionPerformed
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_useGMTTimeRBActionPerformed
private void dataSourcesHideSlackCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataSourcesHideSlackCBActionPerformed
private void useLocalTimeRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useLocalTimeRBActionPerformed
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_dataSourcesHideSlackCBActionPerformed
}//GEN-LAST:event_useLocalTimeRBActionPerformed
private void viewsHideSlackCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewsHideSlackCBActionPerformed
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_viewsHideSlackCBActionPerformed
private void dataSourcesHideSlackCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataSourcesHideSlackCBActionPerformed
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_dataSourcesHideSlackCBActionPerformed
private void viewsHideKnownCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewsHideKnownCBActionPerformed
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_viewsHideKnownCBActionPerformed
private void dataSourcesHideKnownCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataSourcesHideKnownCBActionPerformed
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_dataSourcesHideKnownCBActionPerformed
private void keepCurrentViewerRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keepCurrentViewerRBActionPerformed
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_keepCurrentViewerRBActionPerformed
private void useBestViewerRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useBestViewerRBActionPerformed
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_useBestViewerRBActionPerformed
private void specifyLogoRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_specifyLogoRBActionPerformed
agencyLogoPathField.setEnabled(true);
browseLogosButton.setEnabled(true);
try {
if (agencyLogoPathField.getText().isEmpty()) {
String path = ModuleSettings.getConfigSetting(ReportBranding.MODULE_NAME, ReportBranding.AGENCY_LOGO_PATH_PROP);
if (path != null && !path.isEmpty()) {
updateAgencyLogo(path);
}
}
} catch (IOException ex) {
LOGGER.log(Level.WARNING, "Error loading image from previously saved agency logo path.", ex);
}
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_specifyLogoRBActionPerformed
private void defaultLogoRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_defaultLogoRBActionPerformed
agencyLogoPathField.setEnabled(false);
browseLogosButton.setEnabled(false);
try {
updateAgencyLogo("");
} catch (IOException ex) {
// This should never happen since we're not reading from a file.
LOGGER.log(Level.SEVERE, "Unexpected error occurred while updating the agency logo.", ex);
}
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_defaultLogoRBActionPerformed
private void browseLogosButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseLogosButtonActionPerformed
String oldLogoPath = agencyLogoPathField.getText();
int returnState = fileChooser.showOpenDialog(this);
@ -909,43 +1023,6 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
}
}//GEN-LAST:event_browseLogosButtonActionPerformed
private void memFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_memFieldKeyReleased
String memText = memField.getText();
if (memText.equals(initialMemValue)) {
//if it is still the initial value don't fire change
return;
}
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_memFieldKeyReleased
private void defaultLogoRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_defaultLogoRBActionPerformed
agencyLogoPathField.setEnabled(false);
browseLogosButton.setEnabled(false);
try {
updateAgencyLogo("");
} catch (IOException ex) {
// This should never happen since we're not reading from a file.
LOGGER.log(Level.SEVERE, "Unexpected error occurred while updating the agency logo.", ex);
}
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_defaultLogoRBActionPerformed
private void specifyLogoRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_specifyLogoRBActionPerformed
agencyLogoPathField.setEnabled(true);
browseLogosButton.setEnabled(true);
try {
if (agencyLogoPathField.getText().isEmpty()) {
String path = ModuleSettings.getConfigSetting(ReportBranding.MODULE_NAME, ReportBranding.AGENCY_LOGO_PATH_PROP);
if (path != null && !path.isEmpty()) {
updateAgencyLogo(path);
}
}
} catch (IOException ex) {
LOGGER.log(Level.WARNING, "Error loading image from previously saved agency logo path.", ex);
}
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_specifyLogoRBActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField agencyLogoPathField;
private javax.swing.JLabel agencyLogoPathFieldValidationLabel;
@ -963,8 +1040,11 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JRadioButton keepCurrentViewerRB;
private javax.swing.JTextField logFileCount;
private javax.swing.JTextField logNumAlert;
private javax.swing.JPanel logoPanel;
private javax.swing.ButtonGroup logoSourceButtonGroup;
private javax.swing.JLabel maxLogFileCount;
private javax.swing.JLabel maxMemoryLabel;
private javax.swing.JLabel maxMemoryUnitsLabel;
private javax.swing.JLabel maxMemoryUnitsLabel1;

View File

@ -200,3 +200,4 @@ CriterionChooser.ascendingRadio.text=\u25b2 Ascending\n
CriterionChooser.removeButton.text=Remove
CriterionChooser.descendingRadio.text=\u25bc Descending
AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.text=
AutopsyOptionsPanel.logNumAlert.text=

View File

@ -151,7 +151,7 @@ public abstract class MediaViewVideoPanel extends JPanel implements FrameCapture
if (AUDIO_EXTENSIONS.contains("." + extension) || getExtensionsList().contains("." + extension)) {
SortedSet<String> mimeTypes = new TreeSet<>(getMimeTypes());
try {
String mimeType = new FileTypeDetector().detectMIMEType(file);
String mimeType = new FileTypeDetector().getMIMEType(file);
return mimeTypes.contains(mimeType);
} catch (FileTypeDetector.FileTypeDetectorInitException ex) {
logger.log(Level.WARNING, "Failed to look up mimetype for " + file.getName() + " using FileTypeDetector. Fallingback on AbstractFile.isMimeType", ex);

View File

@ -263,7 +263,7 @@ public class ImageUtils {
return true;
} else {
try {
String mimeType = getFileTypeDetector().detectMIMEType(file);
String mimeType = getFileTypeDetector().getMIMEType(file);
if (StringUtils.isNotBlank(mimeTypePrefix) && mimeType.startsWith(mimeTypePrefix)) {
return true;
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2012-2015 Basis Technology Corp.
* Copyright 2012-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -24,68 +24,36 @@ import java.util.logging.FileHandler;
import java.util.logging.Formatter;
import java.util.logging.Handler;
import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.LogRecord;
import org.sleuthkit.autopsy.core.UserPreferences;
/**
* Autopsy specialization of the Java Logger class with custom file handlers.
* Autopsy specialization of the Java Logger class with a custom file handler.
* Note that the custom loggers are not obtained from the global log manager.
*/
public final class Logger extends java.util.logging.Logger {
private static final String LOG_ENCODING = PlatformUtil.getLogFileEncoding();
private static final int LOG_SIZE = 0; // In bytes, zero is unlimited
private static final int LOG_FILE_COUNT = 10;
private static final String LOG_WITHOUT_STACK_TRACES = "autopsy.log"; //NON-NLS
private static final String LOG_WITH_STACK_TRACES = "autopsy_traces.log"; //NON-NLS
private static final String LOG_FILE_NAME = "autopsy.log"; //NON-NLS
private static final Map<String, Logger> namesToLoggers = new HashMap<>();
private static final Handler consoleHandler = new java.util.logging.ConsoleHandler();
private static FileHandler userFriendlyHandler = createFileHandlerWithoutTraces(PlatformUtil.getLogDirectory());
private static FileHandler developerFriendlyHandler = createFileHandlerWithTraces(PlatformUtil.getLogDirectory());
/**
* Creates a custom file handler with a custom message formatter that does
* not include stack traces.
*
* @param logDirectory The directory where the log files should reside.
*
* @return A custom file handler.
*/
private static FileHandler createFileHandlerWithoutTraces(String logDirectory) {
String logFilePath = Paths.get(logDirectory, LOG_WITHOUT_STACK_TRACES).toString();
try {
FileHandler fileHandler = new FileHandler(logFilePath, LOG_SIZE, LOG_FILE_COUNT);
fileHandler.setEncoding(LOG_ENCODING);
fileHandler.setFormatter(new Formatter() {
@Override
public String format(LogRecord record) {
return (new Date(record.getMillis())).toString() + " "
+ record.getSourceClassName() + " "
+ record.getSourceMethodName() + "\n"
+ record.getLevel() + ": "
+ this.formatMessage(record) + "\n";
}
});
return fileHandler;
} catch (IOException ex) {
throw new RuntimeException(String.format("Error initializing file handler for %s", logFilePath), ex); //NON-NLS
}
}
private static FileHandler logFileHandler = createFileHandlerWithTraces(PlatformUtil.getLogDirectory());
/**
* Creates a custom file handler with a custom message formatter that
* incldues stack traces.
* includes stack traces.
*
* @param logDirectory The directory where the log files should reside.
*
* @return A custom file handler.
*/
private static FileHandler createFileHandlerWithTraces(String logDirectory) {
String logFilePath = Paths.get(logDirectory, LOG_WITH_STACK_TRACES).toString();
String logFilePath = Paths.get(logDirectory, LOG_FILE_NAME).toString();
try {
FileHandler fileHandler = new FileHandler(logFilePath, LOG_SIZE, LOG_FILE_COUNT);
FileHandler fileHandler = new FileHandler(logFilePath, LOG_SIZE, UserPreferences.getLogFileCount());
fileHandler.setEncoding(LOG_ENCODING);
fileHandler.setFormatter(new Formatter() {
@Override
@ -120,7 +88,7 @@ public final class Logger extends java.util.logging.Logger {
*/
synchronized public static void setLogDirectory(String directoryPath) {
/*
* Create file handlers for the new directory and swap them into all of
* Create a file handler for the new directory and swap it into all of
* the existing loggers using thread-safe Logger methods. The new
* handlers are added before the old handlers so that no messages will
* be lost, but this makes it possible for log messages to be written
@ -128,25 +96,20 @@ public final class Logger extends java.util.logging.Logger {
* add/remove handler calls (currently, the base class handlers
* collection is a CopyOnWriteArrayList).
*/
FileHandler newUserFriendlyHandler = createFileHandlerWithoutTraces(directoryPath);
FileHandler newDeveloperFriendlyHandler = createFileHandlerWithTraces(directoryPath);
FileHandler newFileHandler = createFileHandlerWithTraces(directoryPath);
for (Logger logger : namesToLoggers.values()) {
logger.addHandler(newUserFriendlyHandler);
logger.addHandler(newDeveloperFriendlyHandler);
logger.removeHandler(userFriendlyHandler);
logger.removeHandler(userFriendlyHandler);
logger.addHandler(newFileHandler);
logger.removeHandler(logFileHandler);
}
/*
* Close the old file handlers and save references to the new handlers
* Close the old file handler and save reference to the new handler
* so they can be added to any new loggers. This swap is why this method
* and the two overloads of getLogger() are synchronized, serializing
* access to userFriendlyHandler and developerFriendlyHandler.
* access to logFileHandler.
*/
userFriendlyHandler.close();
userFriendlyHandler = newUserFriendlyHandler;
developerFriendlyHandler.close();
developerFriendlyHandler = newDeveloperFriendlyHandler;
logFileHandler.close();
logFileHandler = newFileHandler;
}
/**
@ -178,8 +141,7 @@ public final class Logger extends java.util.logging.Logger {
synchronized public static Logger getLogger(String name, String resourceBundleName) {
if (!namesToLoggers.containsKey(name)) {
Logger logger = new Logger(name, resourceBundleName);
logger.addHandler(userFriendlyHandler);
logger.addHandler(developerFriendlyHandler);
logger.addHandler(logFileHandler);
namesToLoggers.put(name, logger);
}
return namesToLoggers.get(name);

View File

@ -135,7 +135,7 @@ class MSOfficeEmbeddedContentExtractor {
* supported. Else it returns false.
*/
boolean isContentExtractionSupported(AbstractFile abstractFile) {
String abstractFileMimeType = fileTypeDetector.detectMIMEType(abstractFile);
String abstractFileMimeType = fileTypeDetector.getMIMEType(abstractFile);
for (SupportedExtractionFormats s : SupportedExtractionFormats.values()) {
if (s.toString().equals(abstractFileMimeType)) {
abstractFileExtractionFormat = s;

View File

@ -139,7 +139,7 @@ class SevenZipExtractor {
* supported. Else it returns false.
*/
boolean isSevenZipExtractionSupported(AbstractFile abstractFile) {
String abstractFileMimeType = fileTypeDetector.detectMIMEType(abstractFile);
String abstractFileMimeType = fileTypeDetector.getMIMEType(abstractFile);
for (SupportedArchiveExtractionFormats s : SupportedArchiveExtractionFormats.values()) {
if (s.toString().equals(abstractFileMimeType)) {
return true;

View File

@ -187,7 +187,7 @@ final class EncryptionDetectionFileIngestModule extends FileIngestModuleAdapter
/*
* Qualify the MIME type.
*/
String mimeType = fileTypeDetector.detectMIMEType(file);
String mimeType = fileTypeDetector.getMIMEType(file);
if (mimeType.equals("application/octet-stream")) {
possiblyEncrypted = true;
}

View File

@ -250,7 +250,7 @@ public final class ExifParserFileIngestModule implements FileIngestModule {
* @return true if to be processed
*/
private boolean parsableFormat(AbstractFile f) {
String mimeType = fileTypeDetector.detectMIMEType(f);
String mimeType = fileTypeDetector.getMIMEType(f);
return supportedMimeTypes.contains(mimeType);
}

View File

@ -169,7 +169,7 @@ public class FileExtMismatchIngestModule implements FileIngestModule {
if (settings.skipFilesWithNoExtension() && currActualExt.isEmpty()) {
return false;
}
String currActualSigType = detector.detectMIMEType(abstractFile);
String currActualSigType = detector.getMIMEType(abstractFile);
if (settings.getCheckType() != CHECK_TYPE.ALL) {
if (settings.getCheckType() == CHECK_TYPE.NO_TEXT_FILES) {
if (!currActualExt.isEmpty() && currActualSigType.equals("text/plain")) { //NON-NLS

View File

@ -171,7 +171,8 @@ public class FileTypeDetector {
}
/**
* Detects the MIME type of a file.
* Detects the MIME type of a file, then writes it the AbstractFile object
* representing the file and returns the detected type.
*
* @param file The file to test.
*
@ -180,7 +181,7 @@ public class FileTypeDetector {
*
*/
public String detectMIMEType(AbstractFile file) {
public String getMIMEType(AbstractFile file) {
/*
* Check to see if the file has already been typed.
*/
@ -252,6 +253,11 @@ public class FileTypeDetector {
}
}
/*
* Documented side effect: write the result to the AbstractFile object.
*/
file.setMIMEType(mimeType);
return mimeType;
}
@ -395,7 +401,7 @@ public class FileTypeDetector {
*/
@Deprecated
public String detectAndPostToBlackboard(AbstractFile file) throws TskCoreException {
String fileType = detectMIMEType(file);
String fileType = getMIMEType(file);
file.setMIMEType(fileType);
file.save();
return fileType;
@ -419,7 +425,7 @@ public class FileTypeDetector {
*/
@Deprecated
public String getFileType(AbstractFile file) throws TskCoreException {
String fileType = detectMIMEType(file);
String fileType = getMIMEType(file);
file.setMIMEType(fileType);
file.save();
return fileType;
@ -439,7 +445,7 @@ public class FileTypeDetector {
*/
@Deprecated
public String detect(AbstractFile file) throws TskCoreException {
String fileType = detectMIMEType(file);
String fileType = getMIMEType(file);
return fileType;
}

View File

@ -91,7 +91,7 @@ public class FileTypeIdIngestModule implements FileIngestModule {
*/
try {
long startTime = System.currentTimeMillis();
file.setMIMEType(fileTypeDetector.detectMIMEType(file));
fileTypeDetector.getMIMEType(file);
addToTotals(jobId, (System.currentTimeMillis() - startTime));
return ProcessResult.OK;
} catch (Exception e) {

View File

@ -220,7 +220,7 @@ public enum FileTypeUtils {
* mimetype could not be detected.
*/
static boolean hasDrawableMIMEType(AbstractFile file) throws FileTypeDetector.FileTypeDetectorInitException {
String mimeType = getFileTypeDetector().detectMIMEType(file).toLowerCase();
String mimeType = getFileTypeDetector().getMIMEType(file).toLowerCase();
return isDrawableMimeType(mimeType) || (mimeType.equals("audio/x-aiff") && "tiff".equalsIgnoreCase(file.getNameExtension()));
}
@ -235,7 +235,7 @@ public enum FileTypeUtils {
*/
public static boolean hasVideoMIMEType(AbstractFile file) {
try {
String mimeType = getFileTypeDetector().detectMIMEType(file).toLowerCase();
String mimeType = getFileTypeDetector().getMIMEType(file).toLowerCase();
return mimeType.startsWith("video/") || videoMimeTypes.contains(mimeType);
} catch (FileTypeDetector.FileTypeDetectorInitException ex) {
LOGGER.log(Level.SEVERE, "Error determining MIME type of " + getContentPathSafe(file), ex);

View File

@ -511,7 +511,7 @@ public final class KeywordSearchIngestModule implements FileIngestModule {
if (context.fileIngestIsCancelled()) {
return;
}
String fileType = fileTypeDetector.detectMIMEType(aFile);
String fileType = fileTypeDetector.getMIMEType(aFile);
// we skip archive formats that are opened by the archive module.
// @@@ We could have a check here to see if the archive module was enabled though...

View File

@ -1,5 +1,5 @@
#Updated by build script
#Fri, 05 Jan 2018 12:14:19 -0500
#Tue, 23 Jan 2018 11:28:07 -0500
LBL_splash_window_title=Starting Autopsy
SPLASH_HEIGHT=314
SPLASH_WIDTH=538

View File

@ -1,4 +1,4 @@
#Updated by build script
#Fri, 05 Jan 2018 12:14:19 -0500
#Tue, 23 Jan 2018 11:28:07 -0500
CTL_MainWindow_Title=Autopsy 4.5.0
CTL_MainWindow_Title_No_Project=Autopsy 4.5.0