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

This commit is contained in:
William Schaefer 2017-09-11 11:36:03 -04:00
commit b87cc6e8b3
2557 changed files with 3601 additions and 2775 deletions

0
.gitattributes vendored Normal file → Executable file
View File

0
.gitignore vendored Normal file → Executable file
View File

0
API-CHANGES.txt Normal file → Executable file
View File

0
BUILDING.txt Normal file → Executable file
View File

0
BootstrapIvy.xml Normal file → Executable file
View File

0
CentralRepository/Central Repository User Guide.pdf Normal file → Executable file
View File

0
CentralRepository/ivy.xml Normal file → Executable file
View File

0
CentralRepository/ivysettings.xml Normal file → Executable file
View File

0
Core/autopsy-updates.xml Normal file → Executable file
View File

0
Core/build.xml Normal file → Executable file
View File

0
Core/ivy.xml Normal file → Executable file
View File

0
Core/ivysettings.xml Normal file → Executable file
View File

0
Core/manifest.mf Normal file → Executable file
View File

0
Core/nbproject/build-impl.xml Normal file → Executable file
View File

0
Core/nbproject/platform.properties Normal file → Executable file
View File

0
Core/nbproject/project.properties Normal file → Executable file
View File

0
Core/nbproject/project.xml Normal file → Executable file
View File

0
Core/nbproject/suite.properties Normal file → Executable file
View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

@ -20,12 +20,14 @@ package org.sleuthkit.autopsy.casemodule;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.autopsy.casemodule.services.FileManager;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.LocalFilesDataSource;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskDataException;
@ -37,6 +39,7 @@ import org.sleuthkit.datamodel.TskDataException;
*/
class AddLocalFilesTask implements Runnable {
private static final Logger LOGGER = Logger.getLogger(AddLocalFilesTask.class.getName());
private final String deviceId;
private final String rootVirtualDirectoryName;
private final List<String> localFilePaths;
@ -89,6 +92,7 @@ class AddLocalFilesTask implements Runnable {
newDataSources.add(newDataSource.getRootDirectory());
} catch (TskDataException | TskCoreException ex) {
errors.add(ex.getMessage());
LOGGER.log(Level.SEVERE, String.format("Failed to add datasource: %s", ex.getMessage()), ex);
} finally {
DataSourceProcessorCallback.DataSourceProcessorResult result;
if (!errors.isEmpty()) {

View File

@ -138,15 +138,8 @@ IntervalErrorReport.TotalIssues=total issue(s)
IntervalErrorReport.ErrorText=Database Connection Error
CasePropertiesAction.window.title=Case Properties
CueBannerPanel.title.text=Open Recent Case
GeneralFilter.rawImageDesc.text=Raw Images (*.img, *.dd, *.001, *.aa, *.raw, *.bin)
GeneralFilter.encaseImageDesc.text=Encase Images (*.e01)
GeneralFilter.virtualMachineImageDesc.text=Virtual Machines (*.vmdk, *.vhd)
GeneralFilter.executableDesc.text=Executables (*.exe)
ImageDSProcessor.dsType.text=Disk Image or VM File
GeneralFilter.graphicImageDesc.text=Images (*.png, *.jpg, *.jpeg, *.gif, *.bmp)
ImageDSProcessor.allDesc.text=All Supported Types
ImageFilePanel.moduleErr=Module Error
ImageFilePanel.moduleErr.msg=A module caused an error listening to ImageFilePanel updates. See log to determine which module. Some data could be incomplete.
LocalDiskDSProcessor.dsType.text=Local Disk
LocalDiskPanel.localDiskModel.loading.msg=Loading local disks...
LocalDiskPanel.localDiskModel.nodrives.msg=No Accessible Drives
@ -197,7 +190,6 @@ UpdateRecentCases.menuItem.clearRecentCases.text=Clear Recent Cases
UpdateRecentCases.menuItem.empty=-Empty-
AddImageWizardIngestConfigPanel.CANCEL_BUTTON.text=Cancel
ImageFilePanel.errorLabel.text=Error Label
DataSourceOnCDriveError.text=Warning\: Path to multi-user data source is on "C\:" drive
NewCaseVisualPanel1.CaseFolderOnCDriveError.text=Warning: Path to multi-user case folder is on \"C:\" drive
LocalFilesPanel.errorLabel.text=Error Label
CollaborationMonitor.addingDataSourceStatus.msg={0} adding data source

View File

View File

32
Core/src/org/sleuthkit/autopsy/casemodule/Case.java Normal file → Executable file
View File

@ -377,7 +377,9 @@ public class Case {
*
* @param eventNames The events the subscriber is interested in.
* @param subscriber The subscriber (PropertyChangeListener) to add.
* @deprecated Use addEventTypeSubscriber instead.
*/
@Deprecated
public static void addEventSubscriber(Set<String> eventNames, PropertyChangeListener subscriber) {
eventPublisher.addSubscriber(eventNames, subscriber);
}
@ -385,9 +387,23 @@ public class Case {
/**
* Adds a subscriber to specific case events.
*
* @param eventName The event the subscriber is interested in.
* @param eventTypes The events the subscriber is interested in.
* @param subscriber The subscriber (PropertyChangeListener) to add.
*/
public static void addEventTypeSubscriber(Set<Events> eventTypes, PropertyChangeListener subscriber) {
eventTypes.forEach((Events event) -> {
eventPublisher.addSubscriber(event.toString(), subscriber);
});
}
/**
* Adds a subscriber to specific case events.
*
* @param eventName The event the subscriber is interested in.
* @param subscriber The subscriber (PropertyChangeListener) to add.
* @deprecated Use addEventTypeSubscriber instead.
*/
@Deprecated
public static void addEventSubscriber(String eventName, PropertyChangeListener subscriber) {
eventPublisher.addSubscriber(eventName, subscriber);
}
@ -412,6 +428,18 @@ public class Case {
eventPublisher.removeSubscriber(eventNames, subscriber);
}
/**
* Removes a subscriber to specific case events.
*
* @param eventTypes The events the subscriber is no longer interested in.
* @param subscriber The subscriber (PropertyChangeListener) to remove.
*/
public static void removeEventTypeSubscriber(Set<Events> eventTypes, PropertyChangeListener subscriber) {
eventTypes.forEach((Events event) -> {
eventPublisher.removeSubscriber(event.toString(), subscriber);
});
}
/**
* Checks if a case display name is valid, i.e., does not include any
* characters that cannot be used in file names.
@ -1101,7 +1129,7 @@ public class Case {
}
/**
* Gets the immutable case name.
* Gets the unique and immutable case name.
*
* @return The case name.
*/

View File

View File

View File

@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.casemodule;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.util.EnumSet;
import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
import javax.swing.Action;
@ -49,7 +50,7 @@ final class CaseDeleteAction extends CallableSystemAction {
CaseDeleteAction() {
putValue(Action.NAME, NbBundle.getMessage(CaseDeleteAction.class, "CTL_CaseDeleteAction"));
this.setEnabled(false);
Case.addEventSubscriber(Case.Events.CURRENT_CASE.toString(), (PropertyChangeEvent evt) -> {
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.CURRENT_CASE), (PropertyChangeEvent evt) -> {
setEnabled(null != evt.getNewValue() && UserPreferences.getMode() != UserPreferences.SelectedMode.REVIEW);
});
}

View File

View File

View File

View File

View File

@ -22,6 +22,7 @@ import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.util.EnumSet;
import javax.swing.Action;
import javax.swing.JDialog;
import javax.swing.SwingUtilities;
@ -42,7 +43,7 @@ final class CasePropertiesAction extends CallableSystemAction {
CasePropertiesAction() {
putValue(Action.NAME, NbBundle.getMessage(CasePropertiesAction.class, "CTL_CasePropertiesAction"));
this.setEnabled(false);
Case.addEventSubscriber(Case.Events.CURRENT_CASE.toString(), (PropertyChangeEvent evt) -> {
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.CURRENT_CASE), (PropertyChangeEvent evt) -> {
setEnabled(null != evt.getNewValue());
});
}

View File

View File

View File

@ -24,9 +24,8 @@ import java.beans.PropertyChangeListener;
import java.io.Serializable;
import java.time.Duration;
import java.time.Instant;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@ -57,7 +56,8 @@ final class CollaborationMonitor {
private static final String EVENT_CHANNEL_NAME = "%s-Collaboration-Monitor-Events"; //NON-NLS
private static final String COLLABORATION_MONITOR_EVENT = "COLLABORATION_MONITOR_EVENT"; //NON-NLS
private static final Set<String> CASE_EVENTS_OF_INTEREST = new HashSet<>(Arrays.asList(new String[]{Case.Events.ADDING_DATA_SOURCE.toString(), Case.Events.DATA_SOURCE_ADDED.toString(), Case.Events.ADDING_DATA_SOURCE_FAILED.toString()}));
private static final Set<Case.Events> CASE_EVENTS_OF_INTEREST = EnumSet.of(Case.Events.ADDING_DATA_SOURCE,
Case.Events.DATA_SOURCE_ADDED, Case.Events.ADDING_DATA_SOURCE_FAILED);
private static final int NUMBER_OF_PERIODIC_TASK_THREADS = 2;
private static final String PERIODIC_TASK_THREAD_NAME = "collab-monitor-periodic-tasks-%d"; //NON-NLS
private static final long HEARTBEAT_INTERVAL_MINUTES = 1;
@ -113,7 +113,7 @@ final class CollaborationMonitor {
*/
localTasksManager = new LocalTasksManager();
IngestManager.getInstance().addIngestJobEventListener(localTasksManager);
Case.addEventSubscriber(CASE_EVENTS_OF_INTEREST, localTasksManager);
Case.addEventTypeSubscriber(CASE_EVENTS_OF_INTEREST, localTasksManager);
/**
* Start periodic tasks that:
@ -141,7 +141,7 @@ final class CollaborationMonitor {
}
}
Case.removeEventSubscriber(CASE_EVENTS_OF_INTEREST, localTasksManager);
Case.removeEventTypeSubscriber(CASE_EVENTS_OF_INTEREST, localTasksManager);
IngestManager.getInstance().removeIngestJobEventListener(localTasksManager);
if (null != eventPublisher) {

View File

View File

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2017 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -18,12 +18,11 @@
*/
package org.sleuthkit.autopsy.casemodule;
import org.openide.util.NbBundle;
import java.io.File;
import java.util.List;
import java.util.Arrays;
import java.util.List;
import javax.swing.filechooser.FileFilter;
import org.openide.util.NbBundle;
/**
* FileFilter helper class. Matches files based on extension
@ -31,25 +30,28 @@ import javax.swing.filechooser.FileFilter;
public class GeneralFilter extends FileFilter {
// Extensions & Descriptions for commonly used filters
public static final List<String> RAW_IMAGE_EXTS = Arrays.asList(new String[]{".img", ".dd", ".001", ".aa", ".raw", ".bin"}); //NON-NLS
public static final String RAW_IMAGE_DESC = NbBundle.getMessage(GeneralFilter.class, "GeneralFilter.rawImageDesc.text");
public static final List<String> RAW_IMAGE_EXTS = Arrays.asList(".img", ".dd", ".001", ".aa", ".raw", ".bin"); //NON-NLS
@NbBundle.Messages("GeneralFilter.rawImageDesc.text=Raw Images (*.img, *.dd, *.001, *.aa, *.raw, *.bin)")
public static final String RAW_IMAGE_DESC = Bundle.GeneralFilter_rawImageDesc_text();
public static final List<String> ENCASE_IMAGE_EXTS = Arrays.asList(new String[]{".e01"}); //NON-NLS
public static final String ENCASE_IMAGE_DESC = NbBundle.getMessage(GeneralFilter.class,
"GeneralFilter.encaseImageDesc.text");
public static final List<String> ENCASE_IMAGE_EXTS = Arrays.asList(".e01"); //NON-NLS
@NbBundle.Messages("GeneralFilter.encaseImageDesc.text=Encase Images (*.e01)")
public static final String ENCASE_IMAGE_DESC = Bundle.GeneralFilter_encaseImageDesc_text();
public static final List<String> VIRTUAL_MACHINE_EXTS = Arrays.asList(new String[]{".vmdk", ".vhd"}); //NON-NLS
public static final String VIRTUAL_MACHINE_DESC = NbBundle.getMessage(GeneralFilter.class,
"GeneralFilter.virtualMachineImageDesc.text");
public static final List<String> VIRTUAL_MACHINE_EXTS = Arrays.asList(".vmdk", ".vhd"); //NON-NLS
@NbBundle.Messages("GeneralFilter.virtualMachineImageDesc.text=Virtual Machines (*.vmdk, *.vhd)")
public static final String VIRTUAL_MACHINE_DESC = Bundle.GeneralFilter_virtualMachineImageDesc_text();
public static final List<String> EXECUTABLE_EXTS = Arrays.asList(new String[]{".exe"}); //NON-NLS
public static final String EXECUTABLE_DESC = NbBundle.getMessage(GeneralFilter.class, "GeneralFilter.executableDesc.text");
public static final List<String> EXECUTABLE_EXTS = Arrays.asList(".exe"); //NON-NLS
@NbBundle.Messages("GeneralFilter.executableDesc.text=Executables (*.exe)")
public static final String EXECUTABLE_DESC = Bundle.GeneralFilter_executableDesc_text();
public static final List<String> GRAPHIC_IMAGE_EXTS = Arrays.asList(new String[]{".png", ".jpeg", ".jpg", ".gif", ".bmp"}); //NON-NLS
public static final String GRAPHIC_IMG_DECR = NbBundle.getMessage(GeneralFilter.class, "GeneralFilter.graphicImageDesc.text");
public static final List<String> GRAPHIC_IMAGE_EXTS = Arrays.asList(".png", ".jpeg", ".jpg", ".gif", ".bmp"); //NON-NLS
@NbBundle.Messages("GeneralFilter.graphicImageDesc.text=Images (*.png, *.jpg, *.jpeg, *.gif, *.bmp)")
public static final String GRAPHIC_IMG_DECR = Bundle.GeneralFilter_graphicImageDesc_text();
private List<String> extensions;
private String desc;
private final List<String> extensions;
private final String desc;
public GeneralFilter(List<String> ext, String desc) {
super();
@ -69,15 +71,8 @@ public class GeneralFilter extends FileFilter {
if (f.isDirectory()) {
return true;
} else {
Boolean result = false;
String name = f.getName().toLowerCase();
for (String ext : extensions) {
if (name.endsWith(ext)) {
result = result || true;
}
}
return result;
return extensions.stream().anyMatch(name::endsWith);
}
}
@ -90,5 +85,4 @@ public class GeneralFilter extends FileFilter {
public String getDescription() {
return desc;
}
}

View File

View File

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2016 Basis Technology Corp.
* Copyright 2011-2017 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -23,88 +23,92 @@ import java.util.Calendar;
import java.util.List;
import java.util.SimpleTimeZone;
import java.util.TimeZone;
import java.util.logging.Level;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.JPanel;
import javax.swing.filechooser.FileFilter;
import org.apache.commons.lang3.StringUtils;
import org.openide.util.NbBundle;
import static org.sleuthkit.autopsy.casemodule.Bundle.*;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.DriveUtils;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.PathValidator;
/**
* ImageTypePanel for adding an image file such as .img, .E0x, .00x, etc.
* Panel for adding an image file such as .img, .E0x, .00x, etc. Allows the user
* to select a file as well as choose the timezone and whether to ignore orphan
* files in FAT32.
*/
public class ImageFilePanel extends JPanel implements DocumentListener {
private final String PROP_LASTIMAGE_PATH = "LBL_LastImage_PATH"; //NON-NLS
private static final Logger logger = Logger.getLogger(ImageFilePanel.class.getName());
private final JFileChooser fc = new JFileChooser();
private static final String PROP_LASTIMAGE_PATH = "LBL_LastImage_PATH"; //NON-NLS
// Externally supplied name is used to store settings
private final JFileChooser fileChooser = new JFileChooser();
/**
* Externally supplied name is used to store settings
*/
private final String contextName;
/**
* Creates new form ImageFilePanel
*
* @param context a string context name used to read/store last
* used settings
* @param fileChooserFilters a list of filters to be used with the
* FileChooser
* @param context A string context name used to read/store last
* used settings.
* @param fileChooserFilters A list of filters to be used with the
* FileChooser.
*/
private ImageFilePanel(String context, List<FileFilter> fileChooserFilters) {
this.contextName = context;
initComponents();
fc.setDragEnabled(false);
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.setMultiSelectionEnabled(false);
// Populate the drop down list of time zones
for (String id : SimpleTimeZone.getAvailableIDs()) {
timeZoneComboBox.addItem(timeZoneToString(TimeZone.getTimeZone(id)));
}
// set the selected timezone to the current timezone
timeZoneComboBox.setSelectedItem(timeZoneToString(Calendar.getInstance().getTimeZone()));
errorLabel.setVisible(false);
boolean firstFilter = true;
for (FileFilter filter : fileChooserFilters) {
if (firstFilter) { // set the first on the list as the default selection
fc.setFileFilter(filter);
firstFilter = false;
} else {
fc.addChoosableFileFilter(filter);
}
fileChooser.setDragEnabled(false);
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.setMultiSelectionEnabled(false);
fileChooserFilters.forEach(fileChooser::addChoosableFileFilter);
if (fileChooserFilters.isEmpty() == false) {
fileChooser.setFileFilter(fileChooserFilters.get(0));
}
this.contextName = context;
}
/**
* Creates and returns an instance of a ImageFilePanel.
*
* @param context A string context name used to read/store last
* used settings.
* @param fileChooserFilters A list of filters to be used with the
* FileChooser.
*
* @return instance of the ImageFilePanel
*/
public static synchronized ImageFilePanel createInstance(String context, List<FileFilter> fileChooserFilters) {
ImageFilePanel instance = new ImageFilePanel(context, fileChooserFilters);
instance.postInit();
instance.createTimeZoneList();
// post-constructor initialization of listener support without leaking references of uninitialized objects
instance.pathTextField.getDocument().addDocumentListener(instance);
return instance;
}
//post-constructor initialization to properly initialize listener support
//without leaking references of uninitialized objects
private void postInit() {
pathTextField.getDocument().addDocumentListener(this);
}
/**
* 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
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
@ -187,29 +191,35 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
@SuppressWarnings("deprecation")
@NbBundle.Messages({"ImageFilePanel.000.confirmationMessage=The selected file"
+ " has extenson .001 but there is a .000 file in the sequence of raw images."
+ "\nShould the .000 file be used as the start, instead of the selected .001 file?\n"})
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
String oldText = pathTextField.getText();
String oldText = getContentPaths();
// set the current directory of the FileChooser if the ImagePath Field is valid
File currentDir = new File(oldText);
if (currentDir.exists()) {
fc.setCurrentDirectory(currentDir);
fileChooser.setCurrentDirectory(currentDir);
}
int retval = fc.showOpenDialog(this);
if (retval == JFileChooser.APPROVE_OPTION) {
String path = fc.getSelectedFile().getPath();
pathTextField.setText(path);
if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
String path = fileChooser.getSelectedFile().getPath();
if (path.endsWith(".001")) {
String zeroX3_path = StringUtils.removeEnd(path, ".001") + ".000";
if (new File(zeroX3_path).exists()) {
int showConfirmDialog = JOptionPane.showConfirmDialog(this,
Bundle.ImageFilePanel_000_confirmationMessage(),
"Choose .001 file?", JOptionPane.YES_NO_OPTION);
if (showConfirmDialog == JOptionPane.YES_OPTION) {
path = zeroX3_path;
}
}
}
setContentPath(path);
}
try {
firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.FOCUS_NEXT.toString(), false, true);
} catch (Exception e) {
logger.log(Level.SEVERE, "ImageFilePanel listener threw exception", e); //NON-NLS
MessageNotifyUtil.Notify.show(NbBundle.getMessage(this.getClass(), "ImageFilePanel.moduleErr"),
NbBundle.getMessage(this.getClass(), "ImageFilePanel.moduleErr.msg"),
MessageNotifyUtil.MessageType.ERROR);
}
updateHelper();
}//GEN-LAST:event_browseButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
@ -234,6 +244,7 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
/**
* Set the path of the image file.
*
* @param s path of the image file
*/
public void setContentPath(String s) {
@ -242,7 +253,7 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
public String getTimeZone() {
String tz = timeZoneComboBox.getSelectedItem().toString();
return tz.substring(tz.indexOf(")") + 2).trim();
return tz.substring(tz.indexOf(')') + 2).trim();
}
public boolean getNoFatOrphans() {
@ -259,34 +270,23 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
*
* @return true if a proper image has been selected, false otherwise
*/
@NbBundle.Messages("DataSourceOnCDriveError.text=Warning: Path to multi-user data source is on \"C:\" drive")
public boolean validatePanel() {
errorLabel.setVisible(false);
String path = getContentPaths();
if (path == null || path.isEmpty()) {
if (StringUtils.isBlank(path)) {
return false;
}
// display warning if there is one (but don't disable "next" button)
warnIfPathIsInvalid(path);
boolean isExist = new File(path).isFile();
boolean isPhysicalDrive = DriveUtils.isPhysicalDrive(path);
boolean isPartition = DriveUtils.isPartition(path);
return (isExist || isPhysicalDrive || isPartition);
}
/**
* Validates path to selected data source and displays warning if it is
* invalid.
*
* @param path Absolute path to the selected data source
*/
private void warnIfPathIsInvalid(String path) {
if (!PathValidator.isValid(path, Case.getCurrentCase().getCaseType())) {
if (false == PathValidator.isValid(path, Case.getCurrentCase().getCaseType())) {
errorLabel.setVisible(true);
errorLabel.setText(NbBundle.getMessage(this.getClass(), "DataSourceOnCDriveError.text"));
errorLabel.setText(Bundle.DataSourceOnCDriveError_text());
}
return new File(path).isFile()
|| DriveUtils.isPhysicalDrive(path)
|| DriveUtils.isPartition(path);
}
public void storeSettings() {
@ -299,47 +299,39 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
public void readSettings() {
String lastImagePath = ModuleSettings.getConfigSetting(contextName, PROP_LASTIMAGE_PATH);
if (null != lastImagePath) {
if (!lastImagePath.isEmpty()) {
pathTextField.setText(lastImagePath);
}
if (StringUtils.isNotBlank(lastImagePath)) {
setContentPath(lastImagePath);
}
}
/**
* Creates the drop down list for the time zones and then makes the local
* machine time zone to be selected.
* Get a string representation of a TimeZone for use in the drop down list.
*
* @param zone The TimeZone to make a string for
*
* @return A string representation of a TimeZone for use in the drop down
* list.
*/
public void createTimeZoneList() {
// load and add all timezone
String[] ids = SimpleTimeZone.getAvailableIDs();
for (String id : ids) {
TimeZone zone = TimeZone.getTimeZone(id);
int offset = zone.getRawOffset() / 1000;
int hour = offset / 3600;
int minutes = (offset % 3600) / 60;
String item = String.format("(GMT%+d:%02d) %s", hour, minutes, id); //NON-NLS
static private String timeZoneToString(TimeZone zone) {
int offset = zone.getRawOffset() / 1000;
int hour = offset / 3600;
int minutes = (offset % 3600) / 60;
return String.format("(GMT%+d:%02d) %s", hour, minutes, zone.getID()); //NON-NLS
}
/*
* DateFormat dfm = new SimpleDateFormat("z");
* dfm.setTimeZone(zone); boolean hasDaylight =
* zone.useDaylightTime(); String first = dfm.format(new Date(2010,
* 1, 1)); String second = dfm.format(new Date(2011, 6, 6)); int mid
* = hour * -1; String result = first + Integer.toString(mid);
* if(hasDaylight){ result = result + second; }
* timeZoneComboBox.addItem(item + " (" + result + ")");
*/
timeZoneComboBox.addItem(item);
}
// get the current timezone
TimeZone thisTimeZone = Calendar.getInstance().getTimeZone();
int thisOffset = thisTimeZone.getRawOffset() / 1000;
int thisHour = thisOffset / 3600;
int thisMinutes = (thisOffset % 3600) / 60;
String formatted = String.format("(GMT%+d:%02d) %s", thisHour, thisMinutes, thisTimeZone.getID()); //NON-NLS
@Override
public void insertUpdate(DocumentEvent e) {
updateHelper();
}
// set the selected timezone
timeZoneComboBox.setSelectedItem(formatted);
@Override
public void removeUpdate(DocumentEvent e) {
updateHelper();
}
@Override
public void changedUpdate(DocumentEvent e) {
updateHelper();
}
/**
@ -347,43 +339,16 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
* it's DocumentEventListener. Each update function fires a property change
* to be caught by the parent panel.
*
* @param e the event, which is ignored
*/
@Override
public void insertUpdate(DocumentEvent e) {
@NbBundle.Messages({"ImageFilePanel.moduleErr=Module Error",
"ImageFilePanel.moduleErr.msg=A module caused an error listening to ImageFilePanel updates."
+ " See log to determine which module. Some data could be incomplete.\n"})
private void updateHelper() {
try {
firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true);
} catch (Exception ee) {
logger.log(Level.SEVERE, "ImageFilePanel listener threw exception", ee); //NON-NLS
MessageNotifyUtil.Notify.show(NbBundle.getMessage(this.getClass(), "ImageFilePanel.moduleErr"),
NbBundle.getMessage(this.getClass(), "ImageFilePanel.moduleErr.msg"),
MessageNotifyUtil.MessageType.ERROR);
}
}
@Override
public void removeUpdate(DocumentEvent e) {
try {
firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true);
} catch (Exception ee) {
logger.log(Level.SEVERE, "ImageFilePanel listener threw exception", ee); //NON-NLS
MessageNotifyUtil.Notify.show(NbBundle.getMessage(this.getClass(), "ImageFilePanel.moduleErr"),
NbBundle.getMessage(this.getClass(), "ImageFilePanel.moduleErr.msg"),
MessageNotifyUtil.MessageType.ERROR);
}
}
@Override
public void changedUpdate(DocumentEvent e) {
try {
firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true);
} catch (Exception ee) {
logger.log(Level.SEVERE, "ImageFilePanel listener threw exception", ee); //NON-NLS
MessageNotifyUtil.Notify.show(NbBundle.getMessage(this.getClass(), "ImageFilePanel.moduleErr"),
NbBundle.getMessage(this.getClass(), "ImageFilePanel.moduleErr.msg"),
MessageNotifyUtil.MessageType.ERROR);
} catch (Exception e) {
logger.log(Level.SEVERE, "ImageFilePanel listener threw exception", e); //NON-NLS
MessageNotifyUtil.Notify.error(ImageFilePanel_moduleErr(), ImageFilePanel_moduleErr_msg());
}
}

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

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