mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Merge pull request #3499 from zhhl/2229-Part10UsegetOpenCaseInsteadOfgetCurrentCase
2229 Part 10 use getOpenCase() instead of getCurrentCase()
This commit is contained in:
commit
7c0f398ac6
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2015 Basis Technology Corp.
|
||||
* Copyright 2015-2018 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -22,6 +22,7 @@ import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.events.AutopsyEvent;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
@ -78,9 +79,9 @@ public final class DataSourceAddedEvent extends AutopsyEvent implements Serializ
|
||||
}
|
||||
try {
|
||||
long id = (Long) super.getNewValue();
|
||||
dataSource = Case.getCurrentCase().getSleuthkitCase().getContentById(id);
|
||||
dataSource = Case.getOpenCase().getSleuthkitCase().getContentById(id);
|
||||
return dataSource;
|
||||
} catch (IllegalStateException | TskCoreException ex) {
|
||||
} catch (NoCurrentCaseException | TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, "Error doing lazy load for remote event", ex); //NON-NLS
|
||||
return null;
|
||||
}
|
||||
|
@ -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 org.openide.util.Lookup;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.lookup.Lookups;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import static org.sleuthkit.autopsy.datamodel.Bundle.*;
|
||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||
@ -411,7 +412,7 @@ public class KeywordHits implements AutopsyVisitableItem {
|
||||
* that is already closed.
|
||||
*/
|
||||
try {
|
||||
Case.getCurrentCase();
|
||||
Case.getOpenCase();
|
||||
/**
|
||||
* Even with the check above, it is still possible that
|
||||
* the case will be closed in a different thread before
|
||||
@ -422,7 +423,7 @@ public class KeywordHits implements AutopsyVisitableItem {
|
||||
if (null != eventData && eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
|
||||
keywordResults.update();
|
||||
}
|
||||
} catch (IllegalStateException notUsed) {
|
||||
} catch (NoCurrentCaseException notUsed) {
|
||||
// Case is closed, do nothing.
|
||||
}
|
||||
} else if (eventType.equals(IngestManager.IngestJobEvent.COMPLETED.toString())
|
||||
@ -434,9 +435,9 @@ public class KeywordHits implements AutopsyVisitableItem {
|
||||
* that is already closed.
|
||||
*/
|
||||
try {
|
||||
Case.getCurrentCase();
|
||||
Case.getOpenCase();
|
||||
keywordResults.update();
|
||||
} catch (IllegalStateException notUsed) {
|
||||
} catch (NoCurrentCaseException notUsed) {
|
||||
// Case is closed, do nothing.
|
||||
}
|
||||
} else if (eventType.equals(Case.Events.CURRENT_CASE.toString())
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2014 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");
|
||||
@ -299,7 +299,7 @@ public class PerformancePanel extends javax.swing.JDialog {
|
||||
|
||||
Case curCase;
|
||||
try {
|
||||
curCase = Case.getCurrentCase();
|
||||
curCase = Case.getOpenCase();
|
||||
} catch (Exception e) {
|
||||
setImgLabel(NbBundle.getMessage(this.getClass(), "PerformancePanel.label.caseNotOpen.text"));
|
||||
setStatusMsg("");
|
||||
@ -380,7 +380,7 @@ public class PerformancePanel extends javax.swing.JDialog {
|
||||
|
||||
Case curCase;
|
||||
try {
|
||||
curCase = Case.getCurrentCase();
|
||||
curCase = Case.getOpenCase();
|
||||
} catch (Exception e) {
|
||||
setFileReadLabel(
|
||||
NbBundle.getMessage(this.getClass(), "PerformancePanel.label.caseNotOpen.text"));
|
||||
@ -472,7 +472,7 @@ public class PerformancePanel extends javax.swing.JDialog {
|
||||
|
||||
Case curCase;
|
||||
try {
|
||||
curCase = Case.getCurrentCase();
|
||||
curCase = Case.getOpenCase();
|
||||
} catch (Exception e) {
|
||||
setDbLabel(NbBundle.getMessage(this.getClass(), "PerformancePanel.label.caseNotOpen.text"));
|
||||
return;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011 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");
|
||||
@ -27,6 +27,7 @@ import org.openide.util.Lookup;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.windows.TopComponent;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContent;
|
||||
import org.sleuthkit.autopsy.corecomponents.DataContentTopComponent;
|
||||
|
||||
@ -51,9 +52,9 @@ class DataContentDynamicMenu extends JMenuItem implements DynamicMenuContent {
|
||||
defaultItem.addActionListener(new OpenTopComponentAction(contentWin));
|
||||
|
||||
try {
|
||||
Case currentCase = Case.getCurrentCase();
|
||||
Case currentCase = Case.getOpenCase();
|
||||
defaultItem.setEnabled(currentCase.hasData());
|
||||
} catch (IllegalStateException ex) {
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
defaultItem.setEnabled(false); // disable the menu when no case is opened
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011 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");
|
||||
@ -25,6 +25,7 @@ import org.openide.awt.DynamicMenuContent;
|
||||
import org.openide.util.Lookup;
|
||||
import org.openide.windows.TopComponent;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.corecomponentinterfaces.DataExplorer;
|
||||
|
||||
/**
|
||||
@ -54,9 +55,9 @@ class DataExplorerDynamicMenu extends JMenuItem implements DynamicMenuContent {
|
||||
item.addActionListener(new OpenTopComponentAction(explorerWin));
|
||||
|
||||
try {
|
||||
Case currentCase = Case.getCurrentCase();
|
||||
Case currentCase = Case.getOpenCase();
|
||||
item.setEnabled(currentCase.hasData());
|
||||
} catch (IllegalStateException ex) {
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
item.setEnabled(false); // disable the menu when no case is opened
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,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;
|
||||
@ -65,9 +66,16 @@ class TextMessageAnalyzer {
|
||||
* @param context The ingest job context.
|
||||
*/
|
||||
void findTexts(IngestJobContext context) {
|
||||
blackboard = Case.getCurrentCase().getServices().getBlackboard();
|
||||
Case openCase;
|
||||
try {
|
||||
SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase();
|
||||
openCase = Case.getOpenCase();
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS
|
||||
return;
|
||||
}
|
||||
blackboard = openCase.getServices().getBlackboard();
|
||||
try {
|
||||
SleuthkitCase skCase = openCase.getSleuthkitCase();
|
||||
absFiles = skCase.findAllFilesWhere("name ='mmssms.db'"); //NON-NLS //get exact file name
|
||||
if (absFiles.isEmpty()) {
|
||||
return;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2014-2016 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,7 @@ import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import static org.sleuthkit.autopsy.casemodule.Case.Events.CURRENT_CASE;
|
||||
import static org.sleuthkit.autopsy.casemodule.Case.Events.DATA_SOURCE_ADDED;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.casemodule.events.BlackBoardArtifactTagAddedEvent;
|
||||
import org.sleuthkit.autopsy.casemodule.events.BlackBoardArtifactTagDeletedEvent;
|
||||
import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent;
|
||||
@ -949,8 +950,8 @@ public class TimeLineController {
|
||||
* already closed.
|
||||
*/
|
||||
try {
|
||||
Case.getCurrentCase();
|
||||
} catch (IllegalStateException notUsed) {
|
||||
Case.getOpenCase();
|
||||
} catch (NoCurrentCaseException notUsed) {
|
||||
// Case is closed, do nothing.
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user