mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
Merge pull request #3513 from zhhl/2229-Part21UsegetOpenCaseInsteadOfgetCurrentCase
2229 Part 21 use getOpenCase() instead of getCurrentCase()
This commit is contained in:
commit
24a9675330
@ -75,12 +75,12 @@ public final class IngestJobInfoPanel extends javax.swing.JPanel {
|
||||
}
|
||||
|
||||
private void refresh() {
|
||||
SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase();
|
||||
try {
|
||||
SleuthkitCase skCase = Case.getOpenCase().getSleuthkitCase();
|
||||
List<IngestJobInfo> ingestJobs = skCase.getIngestJobs();
|
||||
this.ingestJobs = ingestJobs;
|
||||
this.repaint();
|
||||
} catch (TskCoreException ex) {
|
||||
} catch (TskCoreException | NoCurrentCaseException ex) {
|
||||
logger.log(Level.SEVERE, "Failed to load ingest jobs.", ex);
|
||||
JOptionPane.showMessageDialog(this, Bundle.IngestJobInfoPanel_loadIngestJob_error_text(), Bundle.IngestJobInfoPanel_loadIngestJob_error_title(), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
@ -114,11 +114,11 @@ public final class IngestJobInfoPanel extends javax.swing.JPanel {
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
IngestJobInfo currIngestJob = ingestJobs.get(rowIndex);
|
||||
SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase();
|
||||
if (columnIndex == 0) {
|
||||
try {
|
||||
SleuthkitCase skCase = Case.getOpenCase().getSleuthkitCase();
|
||||
return skCase.getContentById(currIngestJob.getObjectId()).getName();
|
||||
} catch (TskCoreException ex) {
|
||||
} catch (TskCoreException | NoCurrentCaseException ex) {
|
||||
logger.log(Level.SEVERE, "Failed to get content from db", ex);
|
||||
return "";
|
||||
}
|
||||
|
@ -543,7 +543,8 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel {
|
||||
|
||||
@Messages({
|
||||
"OptionalCasePropertiesPanel.errorDialog.emptyCaseNameMessage=No case name entered.",
|
||||
"OptionalCasePropertiesPanel.errorDialog.invalidCaseNameMessage=Case names cannot include the following symbols: \\, /, :, *, ?, \", <, >, |"
|
||||
"OptionalCasePropertiesPanel.errorDialog.invalidCaseNameMessage=Case names cannot include the following symbols: \\, /, :, *, ?, \", <, >, |",
|
||||
"OptionalCasePropertiesPanel.errorDialog.noOpenCase.errMsg=Exception while getting open case."
|
||||
})
|
||||
void saveUpdatedCaseDetails() {
|
||||
if (caseDisplayNameTextField.getText().trim().isEmpty()) {
|
||||
@ -554,14 +555,19 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel {
|
||||
MessageNotifyUtil.Message.error(Bundle.OptionalCasePropertiesPanel_errorDialog_invalidCaseNameMessage());
|
||||
return;
|
||||
}
|
||||
updateCaseDetails();
|
||||
try {
|
||||
updateCaseDetails();
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
MessageNotifyUtil.Message.error(Bundle.OptionalCasePropertiesPanel_errorDialog_noOpenCase_errMsg());
|
||||
return;
|
||||
}
|
||||
updateCorrelationCase();
|
||||
}
|
||||
|
||||
private void updateCaseDetails() {
|
||||
private void updateCaseDetails() throws NoCurrentCaseException {
|
||||
if (caseDisplayNameTextField.isVisible()) {
|
||||
try {
|
||||
Case.getCurrentCase().updateCaseDetails(new CaseDetails(
|
||||
Case.getOpenCase().updateCaseDetails(new CaseDetails(
|
||||
caseDisplayNameTextField.getText(), caseNumberTextField.getText(),
|
||||
examinerTextField.getText(), tfExaminerPhoneText.getText(),
|
||||
tfExaminerEmailText.getText(), taNotesText.getText()));
|
||||
@ -580,7 +586,7 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel {
|
||||
if (EamDb.isEnabled()) {
|
||||
try {
|
||||
EamDb dbManager = EamDb.getInstance();
|
||||
CorrelationCase correlationCase = dbManager.getCase(Case.getCurrentCase());
|
||||
CorrelationCase correlationCase = dbManager.getCase(Case.getOpenCase());
|
||||
if (caseDisplayNameTextField.isVisible()) {
|
||||
correlationCase.setDisplayName(caseDisplayNameTextField.getText());
|
||||
}
|
||||
@ -592,7 +598,9 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel {
|
||||
correlationCase.setNotes(taNotesText.getText());
|
||||
dbManager.updateCase(correlationCase);
|
||||
} catch (EamDbException ex) {
|
||||
LOGGER.log(Level.SEVERE, "Error connecting to central repository database", ex); // NON-NLS
|
||||
LOGGER.log(Level.SEVERE, "Error connecting to central repository database", ex); // NON-NLS
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex); // NON-NLS
|
||||
} finally {
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-2016 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");
|
||||
@ -28,6 +28,7 @@ import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
|
||||
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
|
||||
import org.sleuthkit.autopsy.coreutils.PathValidator;
|
||||
@ -296,12 +297,18 @@ final class RawDSInputPanel extends JPanel implements DocumentListener {
|
||||
*
|
||||
* @param path Absolute path to the selected data source
|
||||
*/
|
||||
@Messages({"RawDSInputPanel.error.text=Path to multi-user data source is on \"C:\" drive"})
|
||||
@Messages({"RawDSInputPanel.error.text=Path to multi-user data source is on \"C:\" drive",
|
||||
"RawDSInputPanel.noOpenCase.errMsg=Exception while getting open case."})
|
||||
private void warnIfPathIsInvalid(String path) {
|
||||
if (!PathValidator.isValid(path, Case.getCurrentCase().getCaseType())) {
|
||||
try {
|
||||
if (!PathValidator.isValid(path, Case.getOpenCase().getCaseType())) {
|
||||
errorLabel.setVisible(true);
|
||||
errorLabel.setText(Bundle.RawDSInputPanel_error_text());
|
||||
}
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
errorLabel.setVisible(true);
|
||||
errorLabel.setText(Bundle.RawDSInputPanel_noOpenCase_errMsg());
|
||||
}
|
||||
}
|
||||
|
||||
void storeSettings() {
|
||||
|
@ -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");
|
||||
@ -43,6 +43,7 @@ import javax.swing.border.EmptyBorder;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
|
||||
/**
|
||||
* Filters file date properties (modified/created/etc.. times)
|
||||
@ -140,7 +141,7 @@ class DateSearchFilter extends AbstractFileSearchFilter<DateSearchPanel> {
|
||||
|
||||
try {
|
||||
// get the latest case
|
||||
Case currentCase = Case.getCurrentCase(); // get the most updated case
|
||||
Case currentCase = Case.getOpenCase(); // get the most updated case
|
||||
|
||||
Set<TimeZone> caseTimeZones = currentCase.getTimeZones();
|
||||
Iterator<TimeZone> iterator = caseTimeZones.iterator();
|
||||
@ -167,7 +168,7 @@ class DateSearchFilter extends AbstractFileSearchFilter<DateSearchPanel> {
|
||||
String item = String.format("(GMT%+d:%02d) %s", hour, minutes, id); //NON-NLS
|
||||
timeZones.add(item);
|
||||
}
|
||||
} catch (IllegalStateException ex) {
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
// No current case.
|
||||
}
|
||||
|
||||
@ -281,9 +282,9 @@ class DateSearchFilter extends AbstractFileSearchFilter<DateSearchPanel> {
|
||||
* that is already closed.
|
||||
*/
|
||||
try {
|
||||
Case.getCurrentCase();
|
||||
Case.getOpenCase();
|
||||
SwingUtilities.invokeLater(DateSearchFilter.this::updateTimeZoneList);
|
||||
} catch (IllegalStateException notUsed) {
|
||||
} catch (NoCurrentCaseException notUsed) {
|
||||
/**
|
||||
* Case is closed, do nothing.
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-2015 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");
|
||||
@ -40,6 +40,7 @@ import java.util.logging.Level;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.casemodule.services.Blackboard;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||
@ -102,8 +103,12 @@ public final class ExifParserFileIngestModule implements FileIngestModule {
|
||||
|
||||
@Override
|
||||
public ProcessResult process(AbstractFile content) {
|
||||
blackboard = Case.getCurrentCase().getServices().getBlackboard();
|
||||
|
||||
try {
|
||||
blackboard = Case.getOpenCase().getServices().getBlackboard();
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
logger.log(Level.INFO, "Exception while getting open case.", ex); //NON-NLS
|
||||
return ProcessResult.ERROR;
|
||||
}
|
||||
//skip unalloc
|
||||
if ((content.getType().equals(TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)
|
||||
|| (content.getType().equals(TSK_DB_FILES_TYPE_ENUM.SLACK)))) {
|
||||
|
@ -39,6 +39,7 @@ import java.util.logging.Level;
|
||||
import org.openide.modules.InstalledFileLocator;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.coreutils.ExecUtil;
|
||||
import org.sleuthkit.autopsy.coreutils.FileUtil;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
@ -409,7 +410,12 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule {
|
||||
* @throws org.sleuthkit.autopsy.ingest.IngestModule.IngestModuleException
|
||||
*/
|
||||
synchronized Path createModuleOutputDirectoryForCase() throws IngestModule.IngestModuleException {
|
||||
Path path = Paths.get(Case.getCurrentCase().getModuleDirectory(), PhotoRecCarverIngestModuleFactory.getModuleName());
|
||||
Path path;
|
||||
try {
|
||||
path = Paths.get(Case.getOpenCase().getModuleDirectory(), PhotoRecCarverIngestModuleFactory.getModuleName());
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
throw new IngestModule.IngestModuleException(Bundle.cannotCreateOutputDir_message(ex.getLocalizedMessage()), ex);
|
||||
}
|
||||
try {
|
||||
Files.createDirectory(path);
|
||||
if (UNCPathUtilities.isUNC(path)) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2013 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");
|
||||
@ -35,6 +35,7 @@ import java.util.regex.Matcher;
|
||||
import org.mitre.cybox.objects.WindowsRegistryKey;
|
||||
import org.mitre.cybox.common_2.ConditionTypeEnum;
|
||||
import com.williballenthin.rejistry.*;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -345,7 +346,12 @@ class EvalRegistryObj extends EvaluatableObject {
|
||||
List<RegistryFileInfo> regFilesLocal = new ArrayList<RegistryFileInfo>();
|
||||
|
||||
// Make the temp directory
|
||||
String tmpDir = Case.getCurrentCase().getTempDirectory() + File.separator + "STIX"; //NON-NLS
|
||||
String tmpDir;
|
||||
try {
|
||||
tmpDir = Case.getOpenCase().getTempDirectory() + File.separator + "STIX"; //NON-NLS
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
throw new TskCoreException(ex.getLocalizedMessage());
|
||||
}
|
||||
File dir = new File(tmpDir);
|
||||
if (dir.exists() == false) {
|
||||
dir.mkdirs();
|
||||
@ -377,9 +383,15 @@ class EvalRegistryObj extends EvaluatableObject {
|
||||
*/
|
||||
private static List<AbstractFile> findRegistryFiles() throws TskCoreException {
|
||||
List<AbstractFile> registryFiles = new ArrayList<AbstractFile>();
|
||||
org.sleuthkit.autopsy.casemodule.services.FileManager fileManager = Case.getCurrentCase().getServices().getFileManager();
|
||||
Case openCase;
|
||||
try {
|
||||
openCase = Case.getOpenCase();
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
throw new TskCoreException(ex.getLocalizedMessage());
|
||||
}
|
||||
org.sleuthkit.autopsy.casemodule.services.FileManager fileManager = openCase.getServices().getFileManager();
|
||||
|
||||
for (Content ds : Case.getCurrentCase().getDataSources()) {
|
||||
for (Content ds : openCase.getDataSources()) {
|
||||
|
||||
// find the user-specific ntuser-dat files
|
||||
registryFiles.addAll(fileManager.findFiles(ds, "ntuser.dat")); //NON-NLS
|
||||
|
Loading…
x
Reference in New Issue
Block a user