mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
2229: Part 3: Use getOpenCase() instead of getCurrentCase() in casemodule.
This commit is contained in:
parent
9feb88822b
commit
3cebe82f40
@ -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");
|
||||
@ -58,10 +58,15 @@ final class AddImageWizardSelectDspVisual extends JPanel {
|
||||
initComponents();
|
||||
selectedDsp = lastDspUsed;
|
||||
//if the last selected DSP was the Local Disk DSP and it would be disabled then we want to select a different DSP
|
||||
if ((Case.getCurrentCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) && selectedDsp.equals(LocalDiskDSProcessor.getType())) {
|
||||
selectedDsp = ImageDSProcessor.getType();
|
||||
try {
|
||||
if ((Case.getOpenCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) && selectedDsp.equals(LocalDiskDSProcessor.getType())) {
|
||||
selectedDsp = ImageDSProcessor.getType();
|
||||
}
|
||||
createDataSourceProcessorButtons();
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
logger.log(Level.SEVERE, "Exception while getting open case.", ex);
|
||||
}
|
||||
createDataSourceProcessorButtons();
|
||||
|
||||
//add actionlistner to listen for change
|
||||
}
|
||||
|
||||
@ -96,7 +101,7 @@ final class AddImageWizardSelectDspVisual extends JPanel {
|
||||
* Create the a button for each DataSourceProcessor that should exist as an
|
||||
* option.
|
||||
*/
|
||||
private void createDataSourceProcessorButtons() {
|
||||
private void createDataSourceProcessorButtons() throws NoCurrentCaseException {
|
||||
//Listener for button selection
|
||||
ActionListener cbActionListener = new ActionListener() {
|
||||
@Override
|
||||
@ -126,7 +131,7 @@ final class AddImageWizardSelectDspVisual extends JPanel {
|
||||
//Add the button
|
||||
JToggleButton dspButton = createDspButton(dspType);
|
||||
dspButton.addActionListener(cbActionListener);
|
||||
if ((Case.getCurrentCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) && dspType.equals(LocalDiskDSProcessor.getType())){
|
||||
if ((Case.getOpenCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) && dspType.equals(LocalDiskDSProcessor.getType())){
|
||||
dspButton.setEnabled(false); //disable the button for local disk DSP when this is a multi user case
|
||||
dspButton.setSelected(false);
|
||||
shouldAddMultiUserWarning = true;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2013-2016 Basis Technology Corp.
|
||||
* Copyright 2013-2018 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -87,10 +87,10 @@ class AddLocalFilesTask implements Runnable {
|
||||
List<String> errors = new ArrayList<>();
|
||||
try {
|
||||
progress.setIndeterminate(true);
|
||||
FileManager fileManager = Case.getCurrentCase().getServices().getFileManager();
|
||||
FileManager fileManager = Case.getOpenCase().getServices().getFileManager();
|
||||
LocalFilesDataSource newDataSource = fileManager.addLocalFilesDataSource(deviceId, rootVirtualDirectoryName, "", localFilePaths, new ProgressUpdater());
|
||||
newDataSources.add(newDataSource);
|
||||
} catch (TskDataException | TskCoreException ex) {
|
||||
} catch (TskDataException | TskCoreException | NoCurrentCaseException ex) {
|
||||
errors.add(ex.getMessage());
|
||||
LOGGER.log(Level.SEVERE, String.format("Failed to add datasource: %s", ex.getMessage()), ex);
|
||||
} finally {
|
||||
|
@ -264,7 +264,7 @@ public class ImageDSProcessor implements DataSourceProcessor, AutoIngestDataSour
|
||||
|
||||
try {
|
||||
// verify that the image has a file system that TSK can process
|
||||
Case currentCase = Case.getCurrentCase();
|
||||
Case currentCase = Case.getOpenCase();
|
||||
if (!DataSourceUtils.imageHasFileSystem(dataSourcePath)) {
|
||||
// image does not have a file system that TSK can process
|
||||
return 0;
|
||||
|
@ -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");
|
||||
@ -42,7 +42,9 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
||||
import org.sleuthkit.autopsy.imagewriter.ImageWriterSettings;
|
||||
|
||||
@NbBundle.Messages({"LocalDiskPanel.refreshTablebutton.text=Refresh Local Disks"
|
||||
@NbBundle.Messages({"LocalDiskPanel.refreshTablebutton.text=Refresh Local Disks",
|
||||
"LocalDiskPanel.listener.getOpenCase.errTitle=No open case availabe",
|
||||
"LocalDiskPanel.listener.getOpenCase.errMsg=LocalDiskPanel listener couldn't get the open case."
|
||||
})
|
||||
/**
|
||||
* ImageTypePanel for adding a local disk or partition such as PhysicalDrive0 or
|
||||
@ -74,9 +76,14 @@ final class LocalDiskPanel extends JPanel {
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
if (diskTable.getSelectedRow() >= 0 && diskTable.getSelectedRow() < disks.size()) {
|
||||
enableNext = true;
|
||||
setPotentialImageWriterPath(disks.get(diskTable.getSelectedRow()));
|
||||
try {
|
||||
setPotentialImageWriterPath(disks.get(diskTable.getSelectedRow()));
|
||||
firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true);
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
logger.log(Level.SEVERE, "Exception while getting open case.", e); //NON-NLS
|
||||
MessageNotifyUtil.Notify.show(Bundle.LocalDiskPanel_listener_getOpenCase_errTitle(),
|
||||
Bundle.LocalDiskPanel_listener_getOpenCase_errMsg(),
|
||||
MessageNotifyUtil.MessageType.ERROR);
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, "LocalDiskPanel listener threw exception", e); //NON-NLS
|
||||
MessageNotifyUtil.Notify.show(NbBundle.getMessage(this.getClass(), "LocalDiskPanel.moduleErr"),
|
||||
@ -375,11 +382,11 @@ final class LocalDiskPanel extends JPanel {
|
||||
return noFatOrphansCheckbox.isSelected();
|
||||
}
|
||||
|
||||
private static String getDefaultImageWriterFolder() {
|
||||
return Paths.get(Case.getCurrentCase().getModuleDirectory(), "Image Writer").toString();
|
||||
private static String getDefaultImageWriterFolder() throws NoCurrentCaseException {
|
||||
return Paths.get(Case.getOpenCase().getModuleDirectory(), "Image Writer").toString();
|
||||
}
|
||||
|
||||
private void setPotentialImageWriterPath(LocalDisk disk) {
|
||||
private void setPotentialImageWriterPath(LocalDisk disk) throws NoCurrentCaseException {
|
||||
|
||||
File subDirectory = Paths.get(getDefaultImageWriterFolder()).toFile();
|
||||
if (!subDirectory.exists()) {
|
||||
|
@ -31,6 +31,7 @@ import javax.swing.JPanel;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.openide.modules.InstalledFileLocator;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.openide.util.lookup.ServiceProvider;
|
||||
@ -166,6 +167,9 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat
|
||||
errors.add(ex.getMessage());
|
||||
callback.done(DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS, errors, new ArrayList<>());
|
||||
return;
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
logger.log(Level.WARNING, "Exception while getting open case.", ex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -184,7 +188,7 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat
|
||||
* @throws
|
||||
* org.sleuthkit.autopsy.casemodule.LocalFilesDSProcessor.L01Exception
|
||||
*/
|
||||
private List<String> extractLogicalEvidenceFileContents(final List<String> logicalEvidenceFilePaths) throws L01Exception {
|
||||
private List<String> extractLogicalEvidenceFileContents(final List<String> logicalEvidenceFilePaths) throws L01Exception, NoCurrentCaseException {
|
||||
final List<String> extractedPaths = new ArrayList<>();
|
||||
Path ewfexportPath;
|
||||
ewfexportPath = locateEwfexportExecutable();
|
||||
@ -195,7 +199,7 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat
|
||||
command.add("-f");
|
||||
command.add("files");
|
||||
command.add("-t");
|
||||
File l01Dir = new File(Case.getCurrentCase().getModuleDirectory(), L01_EXTRACTION_DIR); //WJS-TODO change to getOpenCase() when that method exists
|
||||
File l01Dir = new File(Case.getOpenCase().getModuleDirectory(), L01_EXTRACTION_DIR); //WJS-TODO change to getOpenCase() when that method exists
|
||||
if (!l01Dir.exists()) {
|
||||
l01Dir.mkdirs();
|
||||
}
|
||||
@ -354,6 +358,9 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat
|
||||
logger.log(Level.WARNING, "File extension was .l01 but contents of logical evidence file were unable to be extracted", ex);
|
||||
//contents of l01 could not be extracted don't add data source or run ingest
|
||||
return 0;
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
logger.log(Level.WARNING, "Exception while getting open case.", ex);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
@ -91,9 +91,9 @@ final class NewCaseWizardAction extends CallableSystemAction {
|
||||
if (EamDb.isEnabled()) { //if the eam is enabled we need to save the case organization information now
|
||||
EamDb dbManager = EamDb.getInstance();
|
||||
if (dbManager != null) {
|
||||
CorrelationCase cRCase = dbManager.getCase(Case.getCurrentCase());
|
||||
CorrelationCase cRCase = dbManager.getCase(Case.getOpenCase());
|
||||
if (cRCase == null) {
|
||||
cRCase = dbManager.newCase(Case.getCurrentCase());
|
||||
cRCase = dbManager.newCase(Case.getOpenCase());
|
||||
}
|
||||
if (!organizationName.isEmpty()) {
|
||||
for (EamOrganization org : dbManager.getOrganizations()) {
|
||||
|
@ -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");
|
||||
@ -374,8 +374,8 @@ final class RecentCases extends CallableSystemAction implements Presenter.Menu {
|
||||
int i = 0;
|
||||
String currentCaseName = null;
|
||||
try {
|
||||
currentCaseName = Case.getCurrentCase().getDisplayName();
|
||||
} catch (IllegalStateException ex) {
|
||||
currentCaseName = Case.getOpenCase().getDisplayName();
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
// in case there is no current case.
|
||||
}
|
||||
|
||||
@ -407,8 +407,8 @@ final class RecentCases extends CallableSystemAction implements Presenter.Menu {
|
||||
String[] casePaths = new String[LENGTH];
|
||||
String currentCasePath = null;
|
||||
try {
|
||||
currentCasePath = Case.getCurrentCase().getMetadata().getFilePath().toString();
|
||||
} catch (IllegalStateException ex) {
|
||||
currentCasePath = Case.getOpenCase().getMetadata().getFilePath().toString();
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
/*
|
||||
* There may be no current case.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user