Merge remote-tracking branch 'upstream/develop' into 3779-addDSFilterToFileSearchByattributes

This commit is contained in:
U-BASIS\zhaohui 2018-05-08 17:16:17 -04:00
commit 76f26b90da
236 changed files with 2038 additions and 705 deletions

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
OpenIDE-Module: org.sleuthkit.autopsy.core/10
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/core/Bundle.properties
OpenIDE-Module-Layer: org/sleuthkit/autopsy/core/layer.xml
OpenIDE-Module-Implementation-Version: 22
OpenIDE-Module-Implementation-Version: 23
OpenIDE-Module-Requires: org.openide.windows.WindowManager
AutoUpdate-Show-In-Client: true
AutoUpdate-Essential-Module: true

View File

@ -19,6 +19,9 @@ file.reference.sevenzipjbinding.jar=release/modules/ext/sevenzipjbinding.jar
file.reference.sqlite-jdbc-3.8.11.jar=release/modules/ext/sqlite-jdbc-3.8.11.jar
file.reference.StixLib.jar=release/modules/ext/StixLib.jar
file.reference.sleuthkit-postgresql-4.6.1.jar=release/modules/ext/sleuthkit-postgresql-4.6.1.jar
file.reference.bcprov-jdk15on-1.54.jar=release/modules/ext/bcprov-jdk15on-1.54.jar
file.reference.jackcess-2.1.8.jar=release/modules/ext/jackcess-2.1.8.jar
file.reference.jackcess-encrypt-2.1.2.jar=release/modules/ext/jackcess-encrypt-2.1.2.jar
file.reference.jempbox-1.8.13.jar=release/modules/ext/jempbox-1.8.13.jar
file.reference.javax.ws.rs-api-2.0.1.jar=release/modules/ext/javax.ws.rs-api-2.0.1.jar
file.reference.cxf-core-3.0.16.jar=release/modules/ext/cxf-core-3.0.16.jar
@ -44,5 +47,5 @@ nbm.homepage=http://www.sleuthkit.org/
nbm.module.author=Brian Carrier
nbm.needs.restart=true
source.reference.curator-recipes-2.8.0.jar=release/modules/ext/curator-recipes-2.8.0-sources.jar
spec.version.base=10.10
spec.version.base=10.11

View File

@ -411,6 +411,18 @@
<runtime-relative-path>ext/curator-client-2.8.0.jar</runtime-relative-path>
<binary-origin>release/modules/ext/curator-client-2.8.0.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/bcprov-jdk15on-1.54.jar</runtime-relative-path>
<binary-origin>release/modules/ext/bcprov-jdk15on-1.54.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/jackcess-2.1.8.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jackcess-2.1.8.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/jackcess-encrypt-2.1.2.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jackcess-encrypt-2.1.2.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/jempbox-1.8.13.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jempbox-1.8.13.jar</binary-origin>

View File

@ -84,7 +84,7 @@ public class AddBlackboardArtifactTagAction extends AddTagAction {
new Thread(() -> {
for (BlackboardArtifact artifact : selectedArtifacts) {
try {
Case.getOpenCase().getServices().getTagsManager().addBlackboardArtifactTag(artifact, tagName, comment);
Case.getCurrentCaseThrows().getServices().getTagsManager().addBlackboardArtifactTag(artifact, tagName, comment);
} catch (TskCoreException | NoCurrentCaseException ex) {
Logger.getLogger(AddBlackboardArtifactTagAction.class.getName()).log(Level.SEVERE, "Error tagging result", ex); //NON-NLS
SwingUtilities.invokeLater(() -> {

View File

@ -45,7 +45,7 @@ public class AddBookmarkTagAction extends AbstractAction {
@Override
public void actionPerformed(ActionEvent e) {
try {
Map<String, TagName> tagNamesMap = Case.getOpenCase().getServices().getTagsManager().getDisplayNamesToTagNamesMap();
Map<String, TagName> tagNamesMap = Case.getCurrentCaseThrows().getServices().getTagsManager().getDisplayNamesToTagNamesMap();
TagName bookmarkTagName = tagNamesMap.get(BOOKMARK);
/*

View File

@ -140,7 +140,7 @@ public class AddContentTagAction extends AddTagAction {
}
}
Case.getOpenCase().getServices().getTagsManager().addContentTag(file, tagName, comment);
Case.getCurrentCaseThrows().getServices().getTagsManager().addContentTag(file, tagName, comment);
} catch (TskCoreException | NoCurrentCaseException ex) {
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error tagging result", ex); //NON-NLS
AbstractFile fileCopy = file;

View File

@ -93,7 +93,7 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup {
// Get the current set of tag names.
Map<String, TagName> tagNamesMap = null;
try {
TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager();
TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager();
tagNamesMap = new TreeMap<>(tagsManager.getDisplayNamesToTagNamesMap());
} catch (TskCoreException | NoCurrentCaseException ex) {
Logger.getLogger(TagsManager.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS
@ -170,7 +170,7 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup {
private void getAndAddTag(String tagDisplayName, TagName tagName, String comment) {
Case openCase;
try {
openCase = Case.getOpenCase();
openCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
Logger.getLogger(AddTagAction.class.getName()).log(Level.SEVERE, "Exception while getting open case.", ex); // NON-NLS
return;

View File

@ -73,7 +73,7 @@ public class DeleteBlackboardArtifactTagAction extends AbstractAction {
new Thread(() -> {
for (BlackboardArtifactTag tag : selectedTags) {
try {
Case.getOpenCase().getServices().getTagsManager().deleteBlackboardArtifactTag(tag);
Case.getCurrentCaseThrows().getServices().getTagsManager().deleteBlackboardArtifactTag(tag);
} catch (TskCoreException | NoCurrentCaseException ex) {
Logger.getLogger(DeleteBlackboardArtifactTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex); //NON-NLS
SwingUtilities.invokeLater(() -> {

View File

@ -72,7 +72,7 @@ public class DeleteContentTagAction extends AbstractAction {
new Thread(() -> {
for (ContentTag tag : selectedTags) {
try {
Case.getOpenCase().getServices().getTagsManager().deleteContentTag(tag);
Case.getCurrentCaseThrows().getServices().getTagsManager().deleteContentTag(tag);
} catch (TskCoreException | NoCurrentCaseException ex) {
Logger.getLogger(DeleteContentTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex); //NON-NLS
SwingUtilities.invokeLater(() -> {

View File

@ -98,7 +98,7 @@ public class DeleteFileBlackboardArtifactTagAction extends AbstractAction implem
protected Void doInBackground() throws Exception {
TagsManager tagsManager;
try {
tagsManager = Case.getOpenCase().getServices().getTagsManager();
tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager();
} catch (NoCurrentCaseException ex) {
logger.log(Level.SEVERE, "Error untagging artifact. No open case found.", ex); //NON-NLS
Platform.runLater(()
@ -155,7 +155,7 @@ public class DeleteFileBlackboardArtifactTagAction extends AbstractAction implem
Map<String, TagName> tagNamesMap = null;
try {
// Get the current set of tag names.
TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager();
TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager();
tagNamesMap = new TreeMap<>(tagsManager.getDisplayNamesToTagNamesMap());
} catch (TskCoreException | NoCurrentCaseException ex) {
@ -168,7 +168,7 @@ public class DeleteFileBlackboardArtifactTagAction extends AbstractAction implem
if (null != tagNamesMap && !tagNamesMap.isEmpty()) {
try {
List<BlackboardArtifactTag> existingTagsList
= Case.getOpenCase().getServices().getTagsManager()
= Case.getCurrentCaseThrows().getServices().getTagsManager()
.getBlackboardArtifactTagsByArtifact(artifact);
for (Map.Entry<String, TagName> entry : tagNamesMap.entrySet()) {

View File

@ -98,7 +98,7 @@ public class DeleteFileContentTagAction extends AbstractAction implements Presen
protected Void doInBackground() throws Exception {
TagsManager tagsManager;
try {
tagsManager = Case.getOpenCase().getServices().getTagsManager();
tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager();
} catch (NoCurrentCaseException ex) {
logger.log(Level.SEVERE, "Error untagging file. No open case found.", ex); //NON-NLS
Platform.runLater(() ->
@ -152,7 +152,7 @@ public class DeleteFileContentTagAction extends AbstractAction implements Presen
Map<String, TagName> tagNamesMap = null;
try {
// Get the current set of tag names.
TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager();
TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager();
tagNamesMap = new TreeMap<>(tagsManager.getDisplayNamesToTagNamesMap());
} catch (TskCoreException | NoCurrentCaseException ex) {
@ -165,7 +165,7 @@ public class DeleteFileContentTagAction extends AbstractAction implements Presen
if (null != tagNamesMap && !tagNamesMap.isEmpty()) {
try {
List<ContentTag> existingTagsList =
Case.getOpenCase().getServices().getTagsManager()
Case.getCurrentCaseThrows().getServices().getTagsManager()
.getContentTagsByContent(file);
for (Map.Entry<String, TagName> entry : tagNamesMap.entrySet()) {

View File

@ -139,7 +139,7 @@ public class GetTagNameAndCommentDialog extends JDialog {
// Tag name DTOs may be null (user tag names that have not been used do
// not exist in the database).
try {
TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager();
TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager();
tagNamesSet.addAll(tagsManager.getAllTagNames());
} catch (TskCoreException | NoCurrentCaseException ex) {

View File

@ -110,7 +110,7 @@ public class GetTagNameDialog extends JDialog {
// Get the current set of tag names and hash them for a speedy lookup in
// case the user chooses an existing tag name from the tag names table.
try {
TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager();
TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager();
tagNamesMap.putAll(tagsManager.getDisplayNamesToTagNamesMap());
} catch (TskCoreException | NoCurrentCaseException ex) {
Logger.getLogger(GetTagNameDialog.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS
@ -348,7 +348,7 @@ public class GetTagNameDialog extends JDialog {
if (tagName == null) {
try {
tagName = Case.getOpenCase().getServices().getTagsManager().addTagName(tagDisplayName, userTagDescription, TagName.HTML_COLOR.NONE, status);
tagName = Case.getCurrentCaseThrows().getServices().getTagsManager().addTagName(tagDisplayName, userTagDescription, TagName.HTML_COLOR.NONE, status);
dispose();
} catch (TskCoreException | NoCurrentCaseException ex) {
Logger.getLogger(AddTagAction.class.getName()).log(Level.SEVERE, "Error adding " + tagDisplayName + " tag name", ex); //NON-NLS
@ -361,7 +361,7 @@ public class GetTagNameDialog extends JDialog {
tagName = null;
} catch (TagsManager.TagNameAlreadyExistsException ex) {
try {
tagName = Case.getOpenCase().getServices().getTagsManager().getDisplayNamesToTagNamesMap().get(tagDisplayName);
tagName = Case.getCurrentCaseThrows().getServices().getTagsManager().getDisplayNamesToTagNamesMap().get(tagDisplayName);
} catch (TskCoreException | NoCurrentCaseException ex1) {
Logger.getLogger(AddTagAction.class.getName()).log(Level.SEVERE, tagDisplayName + " exists in database but an error occurred in retrieving it.", ex1); //NON-NLS
JOptionPane.showMessageDialog(this,

View File

@ -58,7 +58,7 @@ public final class OpenLogFolderAction implements ActionListener {
/*
* Open the log directory for the case.
*/
Case currentCase = Case.getOpenCase();
Case currentCase = Case.getCurrentCaseThrows();
logDir = new File(currentCase.getLogDirectoryPath());
} catch (NoCurrentCaseException ex) {
/*

View File

@ -57,7 +57,7 @@ public final class OpenOutputFolderAction extends CallableSystemAction {
public void performAction() {
File outputDir;
try {
Case currentCase = Case.getOpenCase();
Case currentCase = Case.getCurrentCaseThrows();
outputDir = new File(currentCase.getOutputDirectory());
if (outputDir.exists()) {
try {

View File

@ -109,7 +109,7 @@ class AddImageTask implements Runnable {
public void run() {
Case currentCase;
try {
currentCase = Case.getOpenCase();
currentCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
logger.log(Level.SEVERE, "Exception while getting open case.", ex);
return;

View File

@ -345,7 +345,7 @@ class AddImageWizardAddingProgressPanel extends ShortcutWizardDescriptorPanel {
new Thread(() -> {
try {
Case.getOpenCase().notifyAddingDataSource(dataSourceId);
Case.getCurrentCaseThrows().notifyAddingDataSource(dataSourceId);
} catch (NoCurrentCaseException ex) {
Logger.getLogger(AddImageWizardAddingProgressVisual.class.getName()).log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS
}
@ -417,9 +417,9 @@ class AddImageWizardAddingProgressPanel extends ShortcutWizardDescriptorPanel {
new Thread(() -> {
try {
if (!contents.isEmpty()) {
Case.getOpenCase().notifyDataSourceAdded(contents.get(0), dataSourceId);
Case.getCurrentCaseThrows().notifyDataSourceAdded(contents.get(0), dataSourceId);
} else {
Case.getOpenCase().notifyFailedAddingDataSource(dataSourceId);
Case.getCurrentCaseThrows().notifyFailedAddingDataSource(dataSourceId);
}
} catch (NoCurrentCaseException ex) {
Logger.getLogger(AddImageWizardAddingProgressVisual.class.getName()).log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS

View File

@ -59,7 +59,7 @@ final class AddImageWizardSelectDspVisual extends JPanel {
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
try {
if ((Case.getOpenCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) && selectedDsp.equals(LocalDiskDSProcessor.getType())) {
if ((Case.getCurrentCaseThrows().getCaseType() == Case.CaseType.MULTI_USER_CASE) && selectedDsp.equals(LocalDiskDSProcessor.getType())) {
selectedDsp = ImageDSProcessor.getType();
}
createDataSourceProcessorButtons();
@ -131,7 +131,7 @@ final class AddImageWizardSelectDspVisual extends JPanel {
//Add the button
JToggleButton dspButton = createDspButton(dspType);
dspButton.addActionListener(cbActionListener);
if ((Case.getOpenCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) && dspType.equals(LocalDiskDSProcessor.getType())){
if ((Case.getCurrentCaseThrows().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;

View File

@ -87,7 +87,7 @@ class AddLocalFilesTask implements Runnable {
List<String> errors = new ArrayList<>();
try {
progress.setIndeterminate(true);
FileManager fileManager = Case.getOpenCase().getServices().getFileManager();
FileManager fileManager = Case.getCurrentCaseThrows().getServices().getFileManager();
LocalFilesDataSource newDataSource = fileManager.addLocalFilesDataSource(deviceId, rootVirtualDirectoryName, "", localFilePaths, new ProgressUpdater());
newDataSources.add(newDataSource);
} catch (TskDataException | TskCoreException | NoCurrentCaseException ex) {

View File

@ -584,37 +584,41 @@ public class Case {
}
/**
* Deprecated. Use getOpenCase() instead.
*
* Gets the current case, if there is one, at the time of the call.
* Gets the current case. This method should only be called by clients that
* can be sure a case is currently open. Some examples of suitable clients
* are data source processors, ingest modules, and report modules.
*
* @return The current case.
*
* @throws IllegalStateException if there is no current case.
*
* @deprecated. Use getOpenCase() instead.
*/
@Deprecated
*/
public static Case getCurrentCase() {
/*
* Throwing an unchecked exception is a bad idea here.
*
*/
try {
return getOpenCase();
return getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
/*
* Throw a runtime exception, since this is a programming error.
*/
throw new IllegalStateException(NbBundle.getMessage(Case.class, "Case.getCurCase.exception.noneOpen"), ex);
}
}
/**
* Gets the current open case, if there is one, at the time of the call.
* Gets the current case, if there is one, or throws an exception if there
* is no current case. This method should only be called by methods known to
* run in threads where it is possible that another thread has closed the
* current case. The exception provides some protection from the
* consequences of the race condition between the calling thread and a case
* closing thread, but it is not fool-proof. Background threads calling this
* method should put all operations in an exception firewall with a try and
* catch-all block to handle the possibility of bad timing.
*
* @return The open case.
* TODO (JIRA-3825): Introduce a reference counting scheme for this get case
* method.
*
* @throws NoCurrentCaseException if there is no open case.
* @return The current case.
*
* @throws NoCurrentCaseException if there is no current case.
*/
public static Case getOpenCase() throws NoCurrentCaseException {
public static Case getCurrentCaseThrows() throws NoCurrentCaseException {
Case openCase = currentCase;
if (openCase == null) {
throw new NoCurrentCaseException(NbBundle.getMessage(Case.class, "Case.getCurCase.exception.noneOpen"));
@ -1568,7 +1572,7 @@ public class Case {
String normalizedLocalPath;
try {
if (localPath.toLowerCase().contains("http:")) {
normalizedLocalPath = localPath;
normalizedLocalPath = localPath;
} else {
normalizedLocalPath = Paths.get(localPath).normalize().toString();
}

View File

@ -66,7 +66,7 @@ final class CaseDeleteAction extends CallableSystemAction {
"# {0} - exception message", "Case.deleteCaseFailureMessageBox.message=Error deleting case: {0}",})
public void actionPerformed(ActionEvent e) {
try {
Case currentCase = Case.getOpenCase();
Case currentCase = Case.getCurrentCaseThrows();
String caseName = currentCase.getName();
String caseDirectory = currentCase.getCaseDirectory();

View File

@ -54,7 +54,7 @@ class CaseInformationPanel extends javax.swing.JPanel {
})
private void customizeComponents() {
try {
propertiesPanel = new CasePropertiesPanel(Case.getOpenCase());
propertiesPanel = new CasePropertiesPanel(Case.getCurrentCaseThrows());
} catch (NoCurrentCaseException ex) {
Logger.getLogger(CaseInformationPanel.class.getName()).log(Level.INFO, "Exception while getting open case.", ex);
}

View File

@ -50,7 +50,7 @@ final class CasePropertiesPanel extends javax.swing.JPanel {
void updateCaseInfo() {
try {
theCase = Case.getOpenCase();
theCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex);
return;

View File

@ -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.getOpenCase();
Case currentCase = Case.getCurrentCaseThrows();
if (!DataSourceUtils.imageHasFileSystem(dataSourcePath)) {
// image does not have a file system that TSK can process
return 0;

View File

@ -319,7 +319,7 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
// Display warning if there is one (but don't disable "next" button)
try {
if (false == PathValidator.isValid(path, Case.getOpenCase().getCaseType())) {
if (false == PathValidator.isValid(path, Case.getCurrentCaseThrows().getCaseType())) {
pathErrorLabel.setVisible(true);
pathErrorLabel.setText(Bundle.ImageFilePanel_pathValidation_dataSourceOnCDriveError());
}

View File

@ -75,7 +75,7 @@ public final class IngestJobInfoPanel extends javax.swing.JPanel {
private void refresh() {
try {
SleuthkitCase skCase = Case.getOpenCase().getSleuthkitCase();
SleuthkitCase skCase = Case.getCurrentCaseThrows().getSleuthkitCase();
List<IngestJobInfo> ingestJobs = skCase.getIngestJobs();
this.ingestJobs = ingestJobs;
this.repaint();
@ -115,7 +115,7 @@ public final class IngestJobInfoPanel extends javax.swing.JPanel {
IngestJobInfo currIngestJob = ingestJobs.get(rowIndex);
if (columnIndex == 0) {
try {
SleuthkitCase skCase = Case.getOpenCase().getSleuthkitCase();
SleuthkitCase skCase = Case.getCurrentCaseThrows().getSleuthkitCase();
return skCase.getContentById(currIngestJob.getObjectId()).getName();
} catch (TskCoreException | NoCurrentCaseException ex) {
logger.log(Level.SEVERE, "Failed to get content from db", ex);

View File

@ -382,7 +382,7 @@ final class LocalDiskPanel extends JPanel {
}
private static String getDefaultImageWriterFolder() throws NoCurrentCaseException {
return Paths.get(Case.getOpenCase().getModuleDirectory(), "Image Writer").toString();
return Paths.get(Case.getCurrentCaseThrows().getModuleDirectory(), "Image Writer").toString();
}
private void setPotentialImageWriterPath(LocalDisk disk) throws NoCurrentCaseException {

View File

@ -197,7 +197,7 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat
command.add("-f");
command.add("files");
command.add("-t");
File l01Dir = new File(Case.getOpenCase().getModuleDirectory(), L01_EXTRACTION_DIR); //WJS-TODO change to getOpenCase() when that method exists
File l01Dir = new File(Case.getCurrentCaseThrows().getModuleDirectory(), L01_EXTRACTION_DIR); //WJS-TODO change to getOpenCase() when that method exists
if (!l01Dir.exists()) {
l01Dir.mkdirs();
}

View File

@ -283,7 +283,7 @@ final class LocalFilesPanel extends javax.swing.JPanel {
errorLabel.setVisible(false);
try {
final Case.CaseType currentCaseType = Case.getOpenCase().getCaseType();
final Case.CaseType currentCaseType = Case.getCurrentCaseThrows().getCaseType();
for (String currentPath : pathsList) {
if (!PathValidator.isValid(currentPath, currentCaseType)) {

View File

@ -191,7 +191,7 @@ final class LogicalEvidenceFilePanel extends javax.swing.JPanel implements Docum
}
// display warning if there is one (but don't disable "next" button)
try {
if (!PathValidator.isValid(path, Case.getOpenCase().getCaseType())) {
if (!PathValidator.isValid(path, Case.getCurrentCaseThrows().getCaseType())) {
errorLabel.setVisible(true);
errorLabel.setText(Bundle.LogicalEvidenceFilePanel_pathValidation_dataSourceOnCDriveError());
return false;

View File

@ -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.getOpenCase());
CorrelationCase cRCase = dbManager.getCase(Case.getCurrentCaseThrows());
if (cRCase == null) {
cRCase = dbManager.newCase(Case.getOpenCase());
cRCase = dbManager.newCase(Case.getCurrentCaseThrows());
}
if (!organizationName.isEmpty()) {
for (EamOrganization org : dbManager.getOrganizations()) {

View File

@ -64,7 +64,7 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel {
if (editCurrentCase) {
Case openCase;
try {
openCase = Case.getOpenCase();
openCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex);
return;
@ -94,7 +94,7 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel {
private void setUpOrganizationData() {
if (EamDb.isEnabled()) {
try {
Case currentCase = Case.getOpenCase();
Case currentCase = Case.getCurrentCaseThrows();
if (currentCase != null) {
EamDb dbManager = EamDb.getInstance();
selectedOrg = dbManager.getCase(currentCase).getOrg();
@ -567,7 +567,7 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel {
private void updateCaseDetails() throws NoCurrentCaseException {
if (caseDisplayNameTextField.isVisible()) {
try {
Case.getOpenCase().updateCaseDetails(new CaseDetails(
Case.getCurrentCaseThrows().updateCaseDetails(new CaseDetails(
caseDisplayNameTextField.getText(), caseNumberTextField.getText(),
examinerTextField.getText(), tfExaminerPhoneText.getText(),
tfExaminerEmailText.getText(), taNotesText.getText()));
@ -586,7 +586,7 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel {
if (EamDb.isEnabled()) {
try {
EamDb dbManager = EamDb.getInstance();
CorrelationCase correlationCase = dbManager.getCase(Case.getOpenCase());
CorrelationCase correlationCase = dbManager.getCase(Case.getCurrentCaseThrows());
if (caseDisplayNameTextField.isVisible()) {
correlationCase.setDisplayName(caseDisplayNameTextField.getText());
}

View File

@ -374,7 +374,7 @@ final class RecentCases extends CallableSystemAction implements Presenter.Menu {
int i = 0;
String currentCaseName = null;
try {
currentCaseName = Case.getOpenCase().getDisplayName();
currentCaseName = Case.getCurrentCaseThrows().getDisplayName();
} catch (NoCurrentCaseException ex) {
// in case there is no current case.
}
@ -407,7 +407,7 @@ final class RecentCases extends CallableSystemAction implements Presenter.Menu {
String[] casePaths = new String[LENGTH];
String currentCasePath = null;
try {
currentCasePath = Case.getOpenCase().getMetadata().getFilePath().toString();
currentCasePath = Case.getCurrentCaseThrows().getMetadata().getFilePath().toString();
} catch (NoCurrentCaseException ex) {
/*
* There may be no current case.

View File

@ -47,6 +47,6 @@ public class BlackBoardArtifactTagAddedEvent extends TagAddedEvent<BlackboardArt
*/
@Override
BlackboardArtifactTag getTagByID() throws NoCurrentCaseException, TskCoreException {
return Case.getOpenCase().getServices().getTagsManager().getBlackboardArtifactTagByTagID(getTagID());
return Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagByTagID(getTagID());
}
}

View File

@ -46,6 +46,6 @@ public class ContentTagAddedEvent extends TagAddedEvent<ContentTag> implements S
* @throws TskCoreException
*/
ContentTag getTagByID() throws NoCurrentCaseException, TskCoreException {
return Case.getOpenCase().getServices().getTagsManager().getContentTagByTagID(getTagID());
return Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagByTagID(getTagID());
}
}

View File

@ -79,7 +79,7 @@ public final class DataSourceAddedEvent extends AutopsyEvent implements Serializ
}
try {
long id = (Long) super.getNewValue();
dataSource = Case.getOpenCase().getSleuthkitCase().getContentById(id);
dataSource = Case.getCurrentCaseThrows().getSleuthkitCase().getContentById(id);
return dataSource;
} catch (NoCurrentCaseException | TskCoreException ex) {
logger.log(Level.SEVERE, "Error doing lazy load for remote event", ex); //NON-NLS

View File

@ -70,7 +70,7 @@ public final class ReportAddedEvent extends AutopsyEvent implements Serializable
}
try {
long id = (Long) super.getNewValue();
List<Report> reports = Case.getOpenCase().getSleuthkitCase().getAllReports();
List<Report> reports = Case.getCurrentCaseThrows().getSleuthkitCase().getAllReports();
for (Report thisReport : reports) {
if (thisReport.getId() == id) {
report = thisReport;

View File

@ -1,14 +1,14 @@
/*
* Sleuth Kit Data Model
* Autopsy Forensic Browser
*
* Copyright 2011-2016 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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -65,7 +65,7 @@ public final class Blackboard implements Closeable {
throw new BlackboardException("Keyword search service not found");
}
try {
searchService.indexArtifact(artifact);
searchService.index(artifact);
} catch (TskCoreException ex) {
throw new BlackboardException("Error indexing artifact", ex);
}

View File

@ -297,7 +297,7 @@ final class TagNameDefinition implements Comparable<TagNameDefinition> {
}
setting.append(tagName.toSettingsFormat());
try {
SleuthkitCase caseDb = Case.getOpenCase().getSleuthkitCase();
SleuthkitCase caseDb = Case.getCurrentCaseThrows().getSleuthkitCase();
tagName.saveToCase(caseDb);
} catch (NoCurrentCaseException ex) {
LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex);

View File

@ -425,7 +425,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
for (String modifiedTagDisplayName : updatedStatusTags) {
//if user closes their case after options have been changed but before application of them is complete don't notify
try {
Case.getOpenCase().notifyTagDefinitionChanged(modifiedTagDisplayName);
Case.getCurrentCaseThrows().notifyTagDefinitionChanged(modifiedTagDisplayName);
} catch (NoCurrentCaseException ex) {
Logger.getLogger(TagOptionsPanel.class.getName()).log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS
}

View File

@ -99,7 +99,7 @@ public class TagsManager implements Closeable {
tagDisplayNames.add(tagType.getDisplayName());
});
try {
TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager();
TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager();
for (TagName tagName : tagsManager.getAllTagNames()) {
tagDisplayNames.add(tagName.getDisplayName());
}
@ -340,7 +340,7 @@ public class TagsManager implements Closeable {
ContentTag tag;
tag = caseDb.addContentTag(content, tagName, comment, beginByteOffset, endByteOffset);
try {
Case.getOpenCase().notifyContentTagAdded(tag);
Case.getCurrentCaseThrows().notifyContentTagAdded(tag);
} catch (NoCurrentCaseException ex) {
throw new TskCoreException("Added a tag to a closed case", ex);
}
@ -358,7 +358,7 @@ public class TagsManager implements Closeable {
public void deleteContentTag(ContentTag tag) throws TskCoreException {
caseDb.deleteContentTag(tag);
try {
Case.getOpenCase().notifyContentTagDeleted(tag);
Case.getCurrentCaseThrows().notifyContentTagDeleted(tag);
} catch (NoCurrentCaseException ex) {
throw new TskCoreException("Deleted a tag from a closed case", ex);
}
@ -470,7 +470,7 @@ public class TagsManager implements Closeable {
public BlackboardArtifactTag addBlackboardArtifactTag(BlackboardArtifact artifact, TagName tagName, String comment) throws TskCoreException {
BlackboardArtifactTag tag = caseDb.addBlackboardArtifactTag(artifact, tagName, comment);
try {
Case.getOpenCase().notifyBlackBoardArtifactTagAdded(tag);
Case.getCurrentCaseThrows().notifyBlackBoardArtifactTagAdded(tag);
} catch (NoCurrentCaseException ex) {
throw new TskCoreException("Added a tag to a closed case", ex);
}
@ -488,7 +488,7 @@ public class TagsManager implements Closeable {
public void deleteBlackboardArtifactTag(BlackboardArtifactTag tag) throws TskCoreException {
caseDb.deleteBlackboardArtifactTag(tag);
try {
Case.getOpenCase().notifyBlackBoardArtifactTagDeleted(tag);
Case.getCurrentCaseThrows().notifyBlackBoardArtifactTagDeleted(tag);
} catch (NoCurrentCaseException ex) {
throw new TskCoreException("Deleted a tag from a closed case", ex);
}

View File

@ -169,7 +169,7 @@ public class DataContentViewerOtherCases extends javax.swing.JPanel implements D
private void showCaseDetails(int selectedRowViewIdx) {
Case openCase;
try {
openCase = Case.getOpenCase();
openCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
JOptionPane.showConfirmDialog(showCaseDetailsMenuItem,
Bundle.DataContentViewerOtherCases_noOpenCase_errMsg(),
@ -225,7 +225,7 @@ public class DataContentViewerOtherCases extends javax.swing.JPanel implements D
if (0 != otherCasesTable.getSelectedRowCount()) {
Calendar now = Calendar.getInstance();
String fileName = String.format("%1$tY%1$tm%1$te%1$tI%1$tM%1$tS_other_data_sources.csv", now);
CSVFileChooser.setCurrentDirectory(new File(Case.getOpenCase().getExportDirectory()));
CSVFileChooser.setCurrentDirectory(new File(Case.getCurrentCaseThrows().getExportDirectory()));
CSVFileChooser.setSelectedFile(new File(fileName));
CSVFileChooser.setFileFilter(new FileNameExtensionFilter("csv file", "csv"));
@ -434,7 +434,7 @@ public class DataContentViewerOtherCases extends javax.swing.JPanel implements D
private Collection<CorrelationAttributeInstance> getCorrelatedInstances(CorrelationAttribute corAttr, String dataSourceName, String deviceId) {
// @@@ Check exception
try {
String caseUUID = Case.getOpenCase().getName();
String caseUUID = Case.getCurrentCaseThrows().getName();
EamDb dbManager = EamDb.getInstance();
Collection<CorrelationAttributeInstance> artifactInstances = dbManager.getArtifactInstancesByTypeValue(corAttr.getCorrelationType(), corAttr.getCorrelationValue()).stream()
.filter(artifactInstance -> !artifactInstance.getCorrelationCase().getCaseUUID().equals(caseUUID)
@ -491,7 +491,7 @@ public class DataContentViewerOtherCases extends javax.swing.JPanel implements D
if (af != null) {
Content dataSource = af.getDataSource();
dataSourceName = dataSource.getName();
deviceId = Case.getOpenCase().getSleuthkitCase().getDataSource(dataSource.getId()).getDeviceId();
deviceId = Case.getCurrentCaseThrows().getSleuthkitCase().getDataSource(dataSource.getId()).getDeviceId();
}
} catch (TskException | NoCurrentCaseException ex) {
// do nothing.

View File

@ -74,7 +74,7 @@ public class CorrelationDataSource implements Serializable {
public static CorrelationDataSource fromTSKDataSource(CorrelationCase correlationCase, Content dataSource) throws EamDbException {
Case curCase;
try {
curCase = Case.getOpenCase();
curCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
throw new EamDbException("Autopsy case is closed");
}

View File

@ -90,7 +90,7 @@ public class EamArtifactUtil {
// if they asked for it, add the instance details associated with this occurance.
if (!eamArtifacts.isEmpty() && addInstanceDetails) {
try {
Case currentCase = Case.getOpenCase();
Case currentCase = Case.getCurrentCaseThrows();
AbstractFile bbSourceFile = currentCase.getSleuthkitCase().getAbstractFileById(bbArtifact.getObjectID());
if (null == bbSourceFile) {
//@@@ Log this
@ -98,9 +98,9 @@ public class EamArtifactUtil {
}
// make an instance for the BB source file
CorrelationCase correlationCase = EamDb.getInstance().getCase(Case.getOpenCase());
CorrelationCase correlationCase = EamDb.getInstance().getCase(Case.getCurrentCaseThrows());
if (null == correlationCase) {
correlationCase = EamDb.getInstance().newCase(Case.getOpenCase());
correlationCase = EamDb.getInstance().newCase(Case.getCurrentCaseThrows());
}
CorrelationAttributeInstance eamInstance = new CorrelationAttributeInstance(
correlationCase,
@ -146,7 +146,7 @@ public class EamArtifactUtil {
// Get the associated artifact
BlackboardAttribute attribute = bbArtifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT));
if (attribute != null) {
BlackboardArtifact associatedArtifact = Case.getOpenCase().getSleuthkitCase().getBlackboardArtifact(attribute.getValueLong());
BlackboardArtifact associatedArtifact = Case.getCurrentCaseThrows().getSleuthkitCase().getBlackboardArtifact(attribute.getValueLong());
return EamArtifactUtil.getCorrelationAttributeFromBlackboardArtifact(correlationType, associatedArtifact);
}
@ -254,9 +254,9 @@ public class EamArtifactUtil {
try {
CorrelationAttribute.Type filesType = EamDb.getInstance().getCorrelationTypeById(CorrelationAttribute.FILES_TYPE_ID);
eamArtifact = new CorrelationAttribute(filesType, af.getMd5Hash());
CorrelationCase correlationCase = EamDb.getInstance().getCase(Case.getOpenCase());
CorrelationCase correlationCase = EamDb.getInstance().getCase(Case.getCurrentCaseThrows());
if (null == correlationCase) {
correlationCase = EamDb.getInstance().newCase(Case.getOpenCase());
correlationCase = EamDb.getInstance().newCase(Case.getCurrentCaseThrows());
}
CorrelationAttributeInstance cei = new CorrelationAttributeInstance(
correlationCase,

View File

@ -163,8 +163,8 @@ final class CaseEventListener implements PropertyChangeListener {
try {
// Get the remaining tags on the content object
Content content = Case.getOpenCase().getSleuthkitCase().getContentById(contentID);
TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager();
Content content = Case.getCurrentCaseThrows().getSleuthkitCase().getContentById(contentID);
TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager();
List<ContentTag> tags = tagsManager.getContentTagsByContent(content);
if (tags.stream()
@ -244,7 +244,7 @@ final class CaseEventListener implements PropertyChangeListener {
} else { //BLACKBOARD_ARTIFACT_TAG_DELETED
Case openCase;
try {
openCase = Case.getOpenCase();
openCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex);
return;
@ -327,10 +327,10 @@ final class CaseEventListener implements PropertyChangeListener {
* that are tagged with the given tag name.
*/
try {
TagName tagName = Case.getOpenCase().getServices().getTagsManager().getDisplayNamesToTagNamesMap().get(modifiedTagName);
TagName tagName = Case.getCurrentCaseThrows().getServices().getTagsManager().getDisplayNamesToTagNamesMap().get(modifiedTagName);
//First update the artifacts
//Get all BlackboardArtifactTags with this tag name
List<BlackboardArtifactTag> artifactTags = Case.getOpenCase().getSleuthkitCase().getBlackboardArtifactTagsByTagName(tagName);
List<BlackboardArtifactTag> artifactTags = Case.getCurrentCaseThrows().getSleuthkitCase().getBlackboardArtifactTagsByTagName(tagName);
for (BlackboardArtifactTag bbTag : artifactTags) {
//start with assumption that none of the other tags applied to this Correlation Attribute will prevent it's status from being changed
boolean hasTagWithConflictingKnownStatus = false;
@ -346,7 +346,7 @@ final class CaseEventListener implements PropertyChangeListener {
}
//Get the BlackboardArtifact which this BlackboardArtifactTag has been applied to.
BlackboardArtifact bbArtifact = bbTag.getArtifact();
TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager();
TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager();
List<BlackboardArtifactTag> tags = tagsManager.getBlackboardArtifactTagsByArtifact(bbArtifact);
//get all tags which are on this blackboard artifact
for (BlackboardArtifactTag t : tags) {
@ -374,7 +374,7 @@ final class CaseEventListener implements PropertyChangeListener {
}
// Next update the files
List<ContentTag> fileTags = Case.getOpenCase().getSleuthkitCase().getContentTagsByTagName(tagName);
List<ContentTag> fileTags = Case.getCurrentCaseThrows().getSleuthkitCase().getContentTagsByTagName(tagName);
//Get all ContentTags with this tag name
for (ContentTag contentTag : fileTags) {
//start with assumption that none of the other tags applied to this ContentTag will prevent it's status from being changed
@ -384,7 +384,7 @@ final class CaseEventListener implements PropertyChangeListener {
// the status of the file in the central repository
if (tagName.getKnownStatus() == TskData.FileKnown.UNKNOWN) {
Content content = contentTag.getContent();
TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager();
TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager();
List<ContentTag> tags = tagsManager.getContentTagsByContent(content);
//get all tags which are on this file
for (ContentTag t : tags) {
@ -436,7 +436,7 @@ final class CaseEventListener implements PropertyChangeListener {
}
Case openCase;
try {
openCase = Case.getOpenCase();
openCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex);
return;

View File

@ -163,7 +163,7 @@ public class IngestEventsListener {
tifArtifact.addAttributes(attributes);
try {
// index the artifact for keyword search
Blackboard blackboard = Case.getOpenCase().getServices().getBlackboard();
Blackboard blackboard = Case.getCurrentCaseThrows().getServices().getBlackboard();
blackboard.indexArtifact(tifArtifact);
} catch (Blackboard.BlackboardException | NoCurrentCaseException ex) {
LOGGER.log(Level.SEVERE, "Unable to index blackboard artifact " + tifArtifact.getArtifactID(), ex); //NON-NLS

View File

@ -94,7 +94,7 @@ final class IngestModule implements FileIngestModule {
}
try {
blackboard = Case.getOpenCase().getServices().getBlackboard();
blackboard = Case.getCurrentCaseThrows().getServices().getBlackboard();
} catch (NoCurrentCaseException ex) {
logger.log(Level.SEVERE, "Exception while getting open case.", ex);
return ProcessResult.ERROR;
@ -233,7 +233,7 @@ final class IngestModule implements FileIngestModule {
}
Case autopsyCase;
try {
autopsyCase = Case.getOpenCase();
autopsyCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
logger.log(Level.SEVERE, "Exception while getting open case.", ex);
throw new IngestModuleException("Exception while getting open case.", ex);

View File

@ -170,7 +170,7 @@ abstract class CommonFilesMetadataBuilder {
Map<String, Md5Metadata> commonFiles = new HashMap<>();
SleuthkitCase sleuthkitCase = Case.getOpenCase().getSleuthkitCase();
SleuthkitCase sleuthkitCase = Case.getCurrentCaseThrows().getSleuthkitCase();
String selectStatement = this.buildSqlSelectStatement();
try (
@ -225,7 +225,7 @@ abstract class CommonFilesMetadataBuilder {
StringBuilder mimeTypeFilter = new StringBuilder(mimeTypesToFilterOn.size());
if (!mimeTypesToFilterOn.isEmpty()) {
for (String mimeType : mimeTypesToFilterOn) {
mimeTypeFilter.append('"').append(mimeType).append("\",");
mimeTypeFilter.append("'").append(mimeType).append("',");
}
mimeTypeString = mimeTypeFilter.toString().substring(0, mimeTypeFilter.length() - 1);
mimeTypeString = String.format(filterByMimeTypesWhereClause, new Object[]{mimeTypeString});

View File

@ -166,7 +166,7 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
Map<Long, String> dataSouceMap = new HashMap<>();
Case currentCase = Case.getOpenCase();
Case currentCase = Case.getCurrentCaseThrows();
SleuthkitCase tskDb = currentCase.getSleuthkitCase();
loadLogicalSources(tskDb, dataSouceMap);

View File

@ -104,7 +104,7 @@ final class AccountDeviceInstanceKey {
private static String getDataSourceName(AccountDeviceInstance accountDeviceInstance) {
try {
SleuthkitCase db = Case.getOpenCase().getSleuthkitCase();
SleuthkitCase db = Case.getCurrentCaseThrows().getSleuthkitCase();
for (DataSource dataSource : db.getDataSources()) {
if (dataSource.getDeviceId().equals(accountDeviceInstance.getDeviceId())) {
return db.getContentById(dataSource.getId()).getName();

View File

@ -121,7 +121,7 @@ public final class AccountsBrowser extends JPanel implements ExplorerManager.Pro
@Subscribe
public void handleFilterEvent(CVTEvents.FilterChangeEvent filterChangeEvent) {
try {
final CommunicationsManager commsManager = Case.getOpenCase().getSleuthkitCase().getCommunicationsManager();
final CommunicationsManager commsManager = Case.getCurrentCaseThrows().getSleuthkitCase().getCommunicationsManager();
accountsTableEM.setRootContext(new AbstractNode(Children.create(new AccountDeviceInstanceNodeFactory(commsManager, filterChangeEvent.getNewFilter()), true)));
} catch (TskCoreException ex) {
logger.log(Level.SEVERE, "There was an error getting the CommunicationsManager for the current case.", ex);

View File

@ -209,7 +209,7 @@ final public class FiltersPanel extends JPanel {
//TODO: something like this commented code could be used to show only
//the account types that are found:
//final CommunicationsManager communicationsManager = Case.getOpenCase().getSleuthkitCase().getCommunicationsManager();
//final CommunicationsManager communicationsManager = Case.getCurrentOpenCase().getSleuthkitCase().getCommunicationsManager();
//List<Account.Type> accountTypesInUse = communicationsManager.getAccountTypesInUse();
//accountTypesInUSe.forEach(...)
Account.Type.PREDEFINED_ACCOUNT_TYPES.forEach(type -> {
@ -240,7 +240,7 @@ final public class FiltersPanel extends JPanel {
*/
private void updateDeviceFilter(boolean initialState) {
try {
final SleuthkitCase sleuthkitCase = Case.getOpenCase().getSleuthkitCase();
final SleuthkitCase sleuthkitCase = Case.getCurrentCaseThrows().getSleuthkitCase();
for (DataSource dataSource : sleuthkitCase.getDataSources()) {
String dsName = sleuthkitCase.getContentById(dataSource.getId()).getName();

View File

@ -295,7 +295,7 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider
windowAncestor = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, this);
try {
commsManager = Case.getOpenCase().getSleuthkitCase().getCommunicationsManager();
commsManager = Case.getCurrentCaseThrows().getSleuthkitCase().getCommunicationsManager();
} catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Error getting CommunicationsManager for the current case.", ex);
} catch (NoCurrentCaseException ex) {

View File

@ -33,7 +33,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
* Custom Cell renderer to display a SQLite column cell as readable Epoch date/time
*
*/
public class EpochTimeCellRenderer extends DefaultTableCellRenderer {
class EpochTimeCellRenderer extends DefaultTableCellRenderer {
private static final long serialVersionUID = 1L;
private static final Logger LOGGER = Logger.getLogger(FileViewer.class.getName());

View File

@ -139,7 +139,7 @@ public class FXVideoPanel extends MediaViewVideoPanel {
final File tempFile;
try {
tempFile = VideoUtils.getTempVideoFile(currentFile);
tempFile = VideoUtils.getVideoFileInTempDir(currentFile);
} catch (NoCurrentCaseException ex) {
logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS
return;

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.corecomponentinterfaces;
package org.sleuthkit.autopsy.contentviewers;
import java.awt.Component;
import java.util.List;
@ -26,7 +26,7 @@ import org.sleuthkit.datamodel.AbstractFile;
* Defines an interface for application specific content viewer
*
*/
public interface FileTypeViewer {
interface FileTypeViewer {
/**
* Returns list of MIME types supported by this viewer
@ -45,6 +45,11 @@ public interface FileTypeViewer {
/**
* Clears the data in the panel
*
* IMPORTANT IF MAKING THIS PUBLIC: I (RC) am not sure that this method
* belongs in this interface. If we are not going to use setFile(null) as a
* reset method as in DataContentViewer and DataResultViewer, then this is
* fine. Otherwise, it is ambiguous.
*/
void resetComponent();
}

View File

@ -31,7 +31,6 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.autopsy.corecomponentinterfaces.FileTypeViewer;
/**
* Generic Application content viewer

View File

@ -198,7 +198,7 @@ public class GstVideoPanel extends MediaViewVideoPanel {
java.io.File ioFile;
try {
ioFile = VideoUtils.getTempVideoFile(file);
ioFile = VideoUtils.getVideoFileInTempDir(file);
} catch (NoCurrentCaseException ex) {
logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS
infoLabel.setText(Bundle.GstVideoPanel_noOpenCase_errMsg());
@ -552,7 +552,7 @@ public class GstVideoPanel extends MediaViewVideoPanel {
} else if (state.equals(State.READY)) {
final File tempVideoFile;
try {
tempVideoFile = VideoUtils.getTempVideoFile(currentFile);
tempVideoFile = VideoUtils.getVideoFileInTempDir(currentFile);
} catch (NoCurrentCaseException ex) {
logger.log(Level.WARNING, "Exception while getting open case."); //NON-NLS
infoLabel.setText(MEDIA_PLAYER_ERROR_STRING);

View File

@ -24,14 +24,13 @@ import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import org.sleuthkit.autopsy.corecomponentinterfaces.FileTypeViewer;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.AbstractFile;
/**
* Media content viewer for videos, sounds and images.
*/
public class MediaFileViewer extends javax.swing.JPanel implements FileTypeViewer {
class MediaFileViewer extends javax.swing.JPanel implements FileTypeViewer {
private static final Logger LOGGER = Logger.getLogger(MediaFileViewer.class.getName());
private AbstractFile lastFile;

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");
@ -47,7 +47,6 @@ import org.controlsfx.control.MaskerPane;
import org.openide.util.NbBundle;
import org.python.google.common.collect.Lists;
import org.sleuthkit.autopsy.casemodule.Case;
//import org.sleuthkit.autopsy.corecomponents.Bundle;
import org.sleuthkit.autopsy.coreutils.ImageUtils;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.FileNode;
@ -61,7 +60,7 @@ import org.sleuthkit.datamodel.AbstractFile;
@NbBundle.Messages({"MediaViewImagePanel.externalViewerButton.text=Open in External Viewer",
"MediaViewImagePanel.errorLabel.text=Could not load file into Media View.",
"MediaViewImagePanel.errorLabel.OOMText=Could not load file into Media View: insufficent memory."})
public class MediaViewImagePanel extends JPanel implements MediaFileViewer.MediaViewPanel {
class MediaViewImagePanel extends JPanel implements MediaFileViewer.MediaViewPanel {
private static final Image EXTERNAL = new Image(MediaViewImagePanel.class.getResource("/org/sleuthkit/autopsy/images/external.png").toExternalForm());

View File

@ -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,7 +35,7 @@ import org.sleuthkit.datamodel.AbstractFile;
* Video viewer part of the Media View layered pane. Uses different engines
* depending on platform.
*/
public abstract class MediaViewVideoPanel extends JPanel implements FrameCapture, MediaFileViewer.MediaViewPanel {
abstract class MediaViewVideoPanel extends JPanel implements FrameCapture, MediaFileViewer.MediaViewPanel {
private static final Set<String> AUDIO_EXTENSIONS = new TreeSet<>(Arrays.asList(".mp3", ".wav", ".wma")); //NON-NLS

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2017-18 Basis Technology Corp.
* Copyright 2017-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -33,7 +33,8 @@ import org.sleuthkit.autopsy.datamodel.NodeProperty;
/**
* Factory class to create nodes for Plist table view
*/
public class PListRowFactory extends ChildFactory<Integer> {
class PListRowFactory extends ChildFactory<Integer> {
private final List<PropKeyValue> rows;

View File

@ -58,13 +58,12 @@ import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.TskCoreException;
import org.xml.sax.SAXException;
import org.sleuthkit.autopsy.corecomponentinterfaces.FileTypeViewer;
/**
* PListViewer - a file viewer for binary plist files.
*
*/
public class PListViewer extends javax.swing.JPanel implements FileTypeViewer, ExplorerManager.Provider {
class PListViewer extends javax.swing.JPanel implements FileTypeViewer, ExplorerManager.Provider {
private static final long serialVersionUID = 1L;
private static final String[] MIMETYPES = new String[]{"application/x-bplist"};
@ -192,7 +191,7 @@ public class PListViewer extends javax.swing.JPanel implements FileTypeViewer, E
Case openCase;
try {
openCase = Case.getOpenCase();
openCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
JOptionPane.showMessageDialog(this,
"Failed to export plist file.",

View File

@ -34,7 +34,8 @@ import org.sleuthkit.autopsy.datamodel.NodeProperty;
/**
* Factory class to generate nodes for SQLite table rows
*/
public class SQLiteTableRowFactory extends ChildFactory<Integer> {
class SQLiteTableRowFactory extends ChildFactory<Integer> {
private final List<Map<String, Object>> rows;
private final List<Action> colActions;

View File

@ -50,13 +50,12 @@ import org.sleuthkit.autopsy.datamodel.ContentUtils;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.autopsy.corecomponentinterfaces.FileTypeViewer;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
/**
* A file content viewer for SQLite database files.
*/
public class SQLiteViewer extends javax.swing.JPanel implements FileTypeViewer {
class SQLiteViewer extends javax.swing.JPanel implements FileTypeViewer {
private static final long serialVersionUID = 1L;
public static final String[] SUPPORTED_MIMETYPES = new String[]{"application/x-sqlite3"};
@ -320,7 +319,7 @@ public class SQLiteViewer extends javax.swing.JPanel implements FileTypeViewer {
// Copy the file to temp folder
String tmpDBPathName;
try {
tmpDBPathName = Case.getOpenCase().getTempDirectory() + File.separator + sqliteDbFile.getName();
tmpDBPathName = Case.getCurrentCaseThrows().getTempDirectory() + File.separator + sqliteDbFile.getName();
} catch (NoCurrentCaseException ex) {
logger.log(Level.SEVERE, "Current case has been closed", ex); //NON-NLS
MessageNotifyUtil.Message.error(Bundle.SQLiteViewer_errorMessage_noCurrentCase());
@ -373,7 +372,7 @@ public class SQLiteViewer extends javax.swing.JPanel implements FileTypeViewer {
* @param metaFileName name of meta file to look for
*/
private void findAndCopySQLiteMetaFile(AbstractFile sqliteFile, String metaFileName) throws NoCurrentCaseException, TskCoreException, IOException {
Case openCase = Case.getOpenCase();
Case openCase = Case.getCurrentCaseThrows();
SleuthkitCase sleuthkitCase = openCase.getSleuthkitCase();
Services services = new Services(sleuthkitCase);
FileManager fileManager = services.getFileManager();

View File

@ -26,7 +26,7 @@ LBL_Description=<div style=\"font-size: 12pt; font-family: Verdana, 'Verdana CE'
Format_OperatingSystem_Value={0} version {1} running on {2}
LBL_Copyright=<div style\="font-size\: 12pt; font-family\: Verdana, 'Verdana CE', Arial, 'Arial CE', 'Lucida Grande CE', lucida, 'Helvetica CE', sans-serif; ">Autopsy&trade; is a digital forensics platform based on The Sleuth Kit&trade; and other tools. <br><ul><li>General Information: <a style\="color\: \#1E2A60;" href\="http\://www.sleuthkit.org">http\://www.sleuthkit.org</a>.</li><li>Training: <a style\="color\: \#1E2A60;" href\="http://www.basistech.com/autopsy-training">http://www.basistech.com/autopsy-training</a></li><li>Commercial Support: <a style\="color\: \#1E2A60;" href\="http://www.basistech.com/digital-forensics/autopsy/support/">http://www.basistech.com/digital-forensics/autopsy/support/</a></li></ul>Copyright &copy; 2003-2018. </div>
URL_ON_IMG=http://www.sleuthkit.org/
URL_ON_HELP=http://sleuthkit.org/autopsy/docs/user-docs/4.6.0/
URL_ON_HELP=http://sleuthkit.org/autopsy/docs/user-docs/4.7.0/
FILE_FOR_LOCAL_HELP=file:///
INDEX_FOR_LOCAL_HELP=/docs/index.html
LBL_Close=Close

View File

@ -184,7 +184,7 @@ public final class DataContentTopComponent extends TopComponent implements DataC
*/
Case openCase;
try {
openCase = Case.getOpenCase();
openCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
return true;
}

View File

@ -496,7 +496,28 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
}
/**
* Closes this reult view panel. Intended to be called by the parent top
* Indicates whether or not this panel can be closed at the time of the
* call.
*
* @return True or false.
*/
public boolean canClose() {
/*
* If this is the "main" panel, only allow it to be closed when no case
* is open or no there are no data sources in the current case.
*/
Case openCase;
try {
openCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
return true;
}
return (!this.isMain) || openCase.hasData() == false;
}
/**
* Closes down the component. Intended to be called by the parent top
>>>>>>> custom-release-may-2018
* component when it is closed.
*/
void close() {
@ -548,7 +569,7 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
* single node.
*/
Node[] selectedNodes = explorerManager.getSelectedNodes();
if (1 == selectedNodes.length) {
if (selectedNodes.length == 1) {
contentView.setNode(selectedNodes[0]);
} else {
contentView.setNode(null);

View File

@ -375,7 +375,7 @@ public final class DataResultTopComponent extends TopComponent implements DataRe
public boolean canClose() {
Case openCase;
try {
openCase = Case.getOpenCase();
openCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException unused) {
return true;
}

View File

@ -121,7 +121,7 @@ public class Installer extends ModuleInstall {
});
}
public static void setUIFont (javax.swing.plaf.FontUIResource f){
private static void setUIFont (javax.swing.plaf.FontUIResource f){
java.util.Enumeration<Object> keys = UIManager.getDefaults().keys();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();

View File

@ -132,8 +132,7 @@ public class ImageUtils {
} catch (UnsatisfiedLinkError e) {
openCVLoadedTemp = false;
LOGGER.log(Level.SEVERE, "OpenCV Native code library failed to load", e); //NON-NLS
//TODO: show warning bubble
MessageNotifyUtil.Notify.show("Open CV", "OpenCV native library failed to load, see log for more details", MessageNotifyUtil.MessageType.WARNING);
}
OPEN_CV_LOADED = openCVLoadedTemp;
@ -385,7 +384,7 @@ public class ImageUtils {
private static File getCachedThumbnailLocation(long fileID) {
return cacheFileMap.computeIfAbsent(fileID, id -> {
try {
String cacheDirectory = Case.getOpenCase().getCacheDirectory();
String cacheDirectory = Case.getCurrentCaseThrows().getCacheDirectory();
return Paths.get(cacheDirectory, "thumbnails", fileID + ".png").toFile(); //NON-NLS
} catch (NoCurrentCaseException e) {
LOGGER.log(Level.WARNING, "Could not get cached thumbnail location. No case is open."); //NON-NLS

View File

@ -45,8 +45,8 @@ import org.sleuthkit.datamodel.AbstractFile;
*/
public class VideoUtils {
private static final List<String> SUPPORTED_VIDEO_EXTENSIONS =
Arrays.asList("mov", "m4v", "flv", "mp4", "3gp", "avi", "mpg", //NON-NLS
private static final List<String> SUPPORTED_VIDEO_EXTENSIONS
= Arrays.asList("mov", "m4v", "flv", "mp4", "3gp", "avi", "mpg", //NON-NLS
"mpeg", "asf", "divx", "rm", "moov", "wmv", "vob", "dat", //NON-NLS
"m1v", "m2v", "m4v", "mkv", "mpe", "yop", "vqa", "xmv", //NON-NLS
"mve", "wtv", "webm", "vivo", "vc1", "seq", "thp", "san", //NON-NLS
@ -91,8 +91,17 @@ public class VideoUtils {
private VideoUtils() {
}
public static File getTempVideoFile(AbstractFile file) throws NoCurrentCaseException {
return Paths.get(Case.getOpenCase().getTempDirectory(), "videos", file.getId() + "." + file.getNameExtension()).toFile(); //NON-NLS
/**
* Gets a File object in the temp directory of the current case for the
* given AbstractFile object.
*
* @param file The AbstractFile object
*
* @return The File object
*
*/
public static File getVideoFileInTempDir(AbstractFile file) throws NoCurrentCaseException {
return Paths.get(Case.getCurrentCaseThrows().getTempDirectory(), "videos", file.getId() + "." + file.getNameExtension()).toFile(); //NON-NLS
}
public static boolean isVideoThumbnailSupported(AbstractFile file) {
@ -104,7 +113,7 @@ public class VideoUtils {
static BufferedImage generateVideoThumbnail(AbstractFile file, int iconSize) {
java.io.File tempFile;
try {
tempFile = getTempVideoFile(file);
tempFile = getVideoFileInTempDir(file);
} catch (NoCurrentCaseException ex) {
LOGGER.log(Level.WARNING, "Exception while getting open case.", ex); //NON-NLS
return null;
@ -189,4 +198,25 @@ public class VideoUtils {
}
return bufferedImage == null ? null : ScalrWrapper.resizeFast(bufferedImage, iconSize);
}
/**
* Gets a File object in the temp directory of the current case for the
* given AbstractFile object.
*
* @param file The AbstractFile object
*
* @return The File object
*
* @deprecated Call getVideoFileInTempDir instead.
*/
@Deprecated
public static File getTempVideoFile(AbstractFile file) {
try {
return getVideoFileInTempDir(file);
} catch (NoCurrentCaseException ex) {
// Mimic the old behavior.
throw new IllegalStateException(ex);
}
}
}

View File

@ -264,7 +264,7 @@ public abstract class AbstractAbstractFileNode<T extends AbstractFile> extends A
protected void addTagProperty(Sheet.Set sheetSet) {
List<ContentTag> tags = new ArrayList<>();
try {
tags.addAll(Case.getOpenCase().getServices().getTagsManager().getContentTagsByContent(content));
tags.addAll(Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsByContent(content));
} catch (TskCoreException | NoCurrentCaseException ex) {
logger.log(Level.SEVERE, "Failed to get tags for content " + content.getName(), ex);
}

View File

@ -120,7 +120,7 @@ public abstract class AbstractContentNode<T extends Content> extends ContentNode
+ " AND type = " + TskData.ObjectType.ABSTRACTFILE.getObjectType() + ") AS OBJECT_IDS"; //NON-NLS;
try (SleuthkitCase.CaseDbQuery dbQuery = Case.getOpenCase().getSleuthkitCase().executeQuery(query)) {
try (SleuthkitCase.CaseDbQuery dbQuery = Case.getCurrentCaseThrows().getSleuthkitCase().executeQuery(query)) {
ResultSet resultSet = dbQuery.getResultSet();
if(resultSet.next()){
return (0 < resultSet.getInt("count"));

View File

@ -266,7 +266,7 @@ public class BlackboardArtifactNode extends AbstractContentNode<BlackboardArtifa
try {
for (BlackboardAttribute attribute : artifact.getAttributes()) {
if (attribute.getAttributeType().getTypeID() == ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT.getTypeID()) {
BlackboardArtifact associatedArtifact = Case.getOpenCase().getSleuthkitCase().getBlackboardArtifact(attribute.getValueLong());
BlackboardArtifact associatedArtifact = Case.getCurrentCaseThrows().getSleuthkitCase().getBlackboardArtifact(attribute.getValueLong());
if (associatedArtifact != null) {
if (artifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID()) {
artifact.getDisplayName();
@ -332,7 +332,7 @@ public class BlackboardArtifactNode extends AbstractContentNode<BlackboardArtifa
try {
BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT));
if (attribute != null) {
BlackboardArtifact associatedArtifact = Case.getOpenCase().getSleuthkitCase().getBlackboardArtifact(attribute.getValueLong());
BlackboardArtifact associatedArtifact = Case.getCurrentCaseThrows().getSleuthkitCase().getBlackboardArtifact(attribute.getValueLong());
sheetSet.put(new NodeProperty<>(NbBundle.getMessage(BlackboardArtifactNode.class, "BlackboardArtifactNode.createSheet.artifactType.name"),
NbBundle.getMessage(BlackboardArtifactNode.class, "BlackboardArtifactNode.createSheet.artifactType.displayName"),
NO_DESCR,
@ -461,7 +461,7 @@ public class BlackboardArtifactNode extends AbstractContentNode<BlackboardArtifa
* to their sheets.
*
* @param sheetSet the modifiable Sheet.Set returned by
* Sheet.get(Sheet.PROPERTIES)
* Sheet.get(Sheet.PROPERTIES)
*/
@NbBundle.Messages({
"BlackboardArtifactNode.createSheet.tags.displayName=Tags"})
@ -469,8 +469,8 @@ public class BlackboardArtifactNode extends AbstractContentNode<BlackboardArtifa
// add properties for tags
List<Tag> tags = new ArrayList<>();
try {
tags.addAll(Case.getOpenCase().getServices().getTagsManager().getBlackboardArtifactTagsByArtifact(artifact));
tags.addAll(Case.getOpenCase().getServices().getTagsManager().getContentTagsByContent(associated));
tags.addAll(Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsByArtifact(artifact));
tags.addAll(Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsByContent(associated));
} catch (TskCoreException | NoCurrentCaseException ex) {
LOGGER.log(Level.SEVERE, "Failed to get tags for artifact " + artifact.getDisplayName(), ex);
}

View File

@ -103,7 +103,7 @@ public class DataSourcesNode extends DisplayableItemNode {
private void reloadKeys() {
try {
currentKeys = Case.getOpenCase().getDataSources();
currentKeys = Case.getCurrentCaseThrows().getDataSources();
setKeys(currentKeys);
} catch (TskCoreException | NoCurrentCaseException ex) {
logger.log(Level.SEVERE, "Error getting data sources: {0}", ex.getMessage()); // NON-NLS

View File

@ -207,7 +207,7 @@ public class DeletedContent implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
// new file was added
// @@@ COULD CHECK If the new file is deleted before notifying...
update();
@ -226,7 +226,7 @@ public class DeletedContent implements AutopsyVisitableItem {
* received for a case that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
update();
} catch (NoCurrentCaseException notUsed) {
/**

View File

@ -241,7 +241,7 @@ public class EmailExtracted implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
/**
* Even with the check above, it is still possible that
* the case will be closed in a different thread before
@ -266,7 +266,7 @@ public class EmailExtracted implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
emailResults.update();
} catch (NoCurrentCaseException notUsed) {
/**

View File

@ -211,7 +211,7 @@ public class ExtractedContent implements AutopsyVisitableItem {
* may be received for a case that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
/**
* Due to some unresolved issues with how cases are closed,
* it is possible for the event to have a null oldValue if
@ -234,7 +234,7 @@ public class ExtractedContent implements AutopsyVisitableItem {
* may be received for a case that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
refresh(true);
} catch (NoCurrentCaseException notUsed) {
/**
@ -402,7 +402,7 @@ public class ExtractedContent implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
/**
* Even with the check above, it is still possible that
* the case will be closed in a different thread before
@ -427,7 +427,7 @@ public class ExtractedContent implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
refresh(true);
} catch (NoCurrentCaseException notUsed) {
/**

View File

@ -202,7 +202,7 @@ public class FileSize implements AutopsyVisitableItem {
try {
// new file was added
// @@@ could check the size here and only fire off updates if we know the file meets the min size criteria
Case.getOpenCase();
Case.getCurrentCaseThrows();
update();
} catch (NoCurrentCaseException notUsed) {
/**
@ -219,7 +219,7 @@ public class FileSize implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
update();
} catch (NoCurrentCaseException notUsed) {
/**

View File

@ -94,7 +94,7 @@ public final class FileTypesByExtension implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
typesRoot.updateShowCounts();
update();
} catch (NoCurrentCaseException notUsed) {

View File

@ -164,7 +164,7 @@ public final class FileTypesByMimeType extends Observable implements AutopsyVisi
* already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
typesRoot.updateShowCounts();
populateHashMap();
} catch (NoCurrentCaseException notUsed) {

View File

@ -209,7 +209,7 @@ public class HashsetHits implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
/**
* Due to some unresolved issues with how cases are
* closed, it is possible for the event to have a null
@ -233,7 +233,7 @@ public class HashsetHits implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
hashsetResults.update();
} catch (NoCurrentCaseException notUsed) {
/**

View File

@ -171,7 +171,7 @@ public class ImageNode extends AbstractContentNode<Image> {
Bundle.ImageNode_createSheet_timezone_desc(),
this.content.getTimeZone()));
try (CaseDbQuery query = Case.getOpenCase().getSleuthkitCase().executeQuery("SELECT device_id FROM data_source_info WHERE obj_id = " + this.content.getId());) {
try (CaseDbQuery query = Case.getCurrentCaseThrows().getSleuthkitCase().executeQuery("SELECT device_id FROM data_source_info WHERE obj_id = " + this.content.getId());) {
ResultSet deviceIdSet = query.getResultSet();
if (deviceIdSet.next()) {
sheetSet.put(new NodeProperty<>(Bundle.ImageNode_createSheet_deviceId_name(),

View File

@ -200,7 +200,7 @@ public class InterestingHits implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
/**
* Even with the check above, it is still possible that
* the case will be closed in a different thread before
@ -226,7 +226,7 @@ public class InterestingHits implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
interestingResults.update();
} catch (NoCurrentCaseException notUsed) {
/**

View File

@ -412,7 +412,7 @@ public class KeywordHits implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
/**
* Even with the check above, it is still possible that
* the case will be closed in a different thread before
@ -435,7 +435,7 @@ public class KeywordHits implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
keywordResults.update();
} catch (NoCurrentCaseException notUsed) {
// Case is closed, do nothing.

View File

@ -139,7 +139,7 @@ public class Md5Node extends DisplayableItemNode {
@Override
protected Node createNodeForKey(FileInstanceMetadata file) {
try {
Case currentCase = Case.getOpenCase();
Case currentCase = Case.getCurrentCaseThrows();
SleuthkitCase tskDb = currentCase.getSleuthkitCase();
AbstractFile abstractFile = tskDb.findAllFilesWhere(String.format("obj_id in (%s)", file.getObjectId())).get(0);

View File

@ -115,7 +115,7 @@ public final class Reports implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
ReportNodeFactory.this.refresh(true);
} catch (NoCurrentCaseException notUsed) {
/**
@ -129,7 +129,7 @@ public final class Reports implements AutopsyVisitableItem {
@Override
protected boolean createKeys(List<Report> keys) {
try {
keys.addAll(Case.getOpenCase().getAllReports());
keys.addAll(Case.getCurrentCaseThrows().getAllReports());
} catch (TskCoreException | NoCurrentCaseException ex) {
Logger.getLogger(Reports.ReportNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get reports", ex); //NON-NLS
}
@ -266,7 +266,7 @@ public final class Reports implements AutopsyVisitableItem {
NbBundle.getMessage(Reports.class, "DeleteReportAction.actionPerformed.showConfirmDialog.title"),
JOptionPane.YES_NO_OPTION)) {
try {
Case.getOpenCase().deleteReports(selectedReportsCollection);
Case.getCurrentCaseThrows().deleteReports(selectedReportsCollection);
} catch (TskCoreException | NoCurrentCaseException ex) {
Logger.getLogger(DeleteReportAction.class.getName()).log(Level.SEVERE, "Error deleting reports", ex); // NON-NLS
MessageNotifyUtil.Message.error(Bundle.DeleteReportAction_showConfirmDialog_errorMsg());

View File

@ -142,7 +142,7 @@ public class Tags implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
refresh(true);
tagResults.update();
} catch (NoCurrentCaseException notUsed) {
@ -159,7 +159,7 @@ public class Tags implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
refresh(true);
tagResults.update();
} catch (NoCurrentCaseException notUsed) {
@ -196,7 +196,7 @@ public class Tags implements AutopsyVisitableItem {
@Override
protected boolean createKeys(List<TagName> keys) {
try {
List<TagName> tagNamesInUse = Case.getOpenCase().getServices().getTagsManager().getTagNamesInUse();
List<TagName> tagNamesInUse = Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUse();
Collections.sort(tagNamesInUse);
keys.addAll(tagNamesInUse);
} catch (TskCoreException | NoCurrentCaseException ex) {
@ -243,7 +243,7 @@ public class Tags implements AutopsyVisitableItem {
private void updateDisplayName() {
long tagsCount = 0;
try {
TagsManager tm = Case.getOpenCase().getServices().getTagsManager();
TagsManager tm = Case.getCurrentCaseThrows().getServices().getTagsManager();
tagsCount = tm.getContentTagsCountByTagName(tagName);
tagsCount += tm.getBlackboardArtifactTagsCountByTagName(tagName);
} catch (TskCoreException | NoCurrentCaseException ex) {
@ -348,7 +348,7 @@ public class Tags implements AutopsyVisitableItem {
private void updateDisplayName() {
long tagsCount = 0;
try {
tagsCount = Case.getOpenCase().getServices().getTagsManager().getContentTagsCountByTagName(tagName);
tagsCount = Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsCountByTagName(tagName);
} catch (TskCoreException | NoCurrentCaseException ex) {
Logger.getLogger(ContentTagTypeNode.class.getName()).log(Level.SEVERE, "Failed to get content tags count for " + tagName.getDisplayName() + " tag name", ex); //NON-NLS
}
@ -403,7 +403,7 @@ public class Tags implements AutopsyVisitableItem {
protected boolean createKeys(List<ContentTag> keys) {
// Use the content tags bearing the specified tag name as the keys.
try {
keys.addAll(Case.getOpenCase().getServices().getTagsManager().getContentTagsByTagName(tagName));
keys.addAll(Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsByTagName(tagName));
} catch (TskCoreException | NoCurrentCaseException ex) {
Logger.getLogger(ContentTagNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS
}
@ -447,7 +447,7 @@ public class Tags implements AutopsyVisitableItem {
private void updateDisplayName() {
long tagsCount = 0;
try {
tagsCount = Case.getOpenCase().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagName(tagName);
tagsCount = Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagName(tagName);
} catch (TskCoreException | NoCurrentCaseException ex) {
Logger.getLogger(BlackboardArtifactTagTypeNode.class.getName()).log(Level.SEVERE, "Failed to get blackboard artifact tags count for " + tagName.getDisplayName() + " tag name", ex); //NON-NLS
}
@ -502,7 +502,7 @@ public class Tags implements AutopsyVisitableItem {
protected boolean createKeys(List<BlackboardArtifactTag> keys) {
try {
// Use the blackboard artifact tags bearing the specified tag name as the keys.
keys.addAll(Case.getOpenCase().getServices().getTagsManager().getBlackboardArtifactTagsByTagName(tagName));
keys.addAll(Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsByTagName(tagName));
} catch (TskCoreException | NoCurrentCaseException ex) {
Logger.getLogger(BlackboardArtifactTagNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS
}

View File

@ -106,7 +106,7 @@ public class VirtualDirectoryNode extends SpecialDirectoryNode {
Bundle.VirtualDirectoryNode_createSheet_size_displayName(),
Bundle.VirtualDirectoryNode_createSheet_size_desc(),
this.content.getSize()));
try (SleuthkitCase.CaseDbQuery query = Case.getOpenCase().getSleuthkitCase().executeQuery("SELECT time_zone FROM data_source_info WHERE obj_id = " + this.content.getId())) {
try (SleuthkitCase.CaseDbQuery query = Case.getCurrentCaseThrows().getSleuthkitCase().executeQuery("SELECT time_zone FROM data_source_info WHERE obj_id = " + this.content.getId())) {
ResultSet timeZoneSet = query.getResultSet();
if (timeZoneSet.next()) {
sheetSet.put(new NodeProperty<>(Bundle.VirtualDirectoryNode_createSheet_timezone_name(),
@ -117,7 +117,7 @@ public class VirtualDirectoryNode extends SpecialDirectoryNode {
} catch (SQLException | TskCoreException | NoCurrentCaseException ex) {
logger.log(Level.SEVERE, "Failed to get time zone for the following image: " + this.content.getId(), ex);
}
try (SleuthkitCase.CaseDbQuery query = Case.getOpenCase().getSleuthkitCase().executeQuery("SELECT device_id FROM data_source_info WHERE obj_id = " + this.content.getId());) {
try (SleuthkitCase.CaseDbQuery query = Case.getCurrentCaseThrows().getSleuthkitCase().executeQuery("SELECT device_id FROM data_source_info WHERE obj_id = " + this.content.getId());) {
ResultSet deviceIdSet = query.getResultSet();
if (deviceIdSet.next()) {
sheetSet.put(new NodeProperty<>(Bundle.VirtualDirectoryNode_createSheet_deviceId_name(),

View File

@ -238,7 +238,7 @@ final public class Accounts implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
/**
* Even with the check above, it is still possible that
* the case will be closed in a different thread before
@ -262,7 +262,7 @@ final public class Accounts implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
refresh(true);
} catch (NoCurrentCaseException notUsed) {
// Case is closed, do nothing.
@ -364,7 +364,7 @@ final public class Accounts implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
/**
* Even with the check above, it is still possible that
* the case will be closed in a different thread before
@ -388,7 +388,7 @@ final public class Accounts implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
refresh(true);
} catch (NoCurrentCaseException notUsed) {
@ -515,7 +515,7 @@ final public class Accounts implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
/**
* Even with the check above, it is still possible that
* the case will be closed in a different thread before
@ -539,7 +539,7 @@ final public class Accounts implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
refresh(true);
} catch (NoCurrentCaseException notUsed) {
@ -651,7 +651,7 @@ final public class Accounts implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
/**
* Even with the check above, it is still possible that
* the case will be closed in a different thread before
@ -675,7 +675,7 @@ final public class Accounts implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
refresh(true);
} catch (NoCurrentCaseException notUsed) {
@ -864,7 +864,7 @@ final public class Accounts implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
/**
* Even with the check above, it is still possible that
* the case will be closed in a different thread before
@ -888,7 +888,7 @@ final public class Accounts implements AutopsyVisitableItem {
* that is already closed.
*/
try {
Case.getOpenCase();
Case.getCurrentCaseThrows();
refresh(true);
} catch (NoCurrentCaseException notUsed) { //NOPMD empy catch clause

View File

@ -127,7 +127,7 @@ final class AddRawImageTask implements Runnable {
private void addImageToCase(List<Content> dataSources, List<String> errorMessages) {
SleuthkitCase caseDatabase;
try {
caseDatabase = Case.getOpenCase().getSleuthkitCase();
caseDatabase = Case.getCurrentCaseThrows().getSleuthkitCase();
} catch (NoCurrentCaseException ex) {
errorMessages.add(Bundle.AddRawImageTask_noOpenCase_errMsg());
logger.log(Level.SEVERE, Bundle.AddRawImageTask_noOpenCase_errMsg(), ex);

View File

@ -301,7 +301,7 @@ final class RawDSInputPanel extends JPanel implements DocumentListener {
"RawDSInputPanel.noOpenCase.errMsg=Exception while getting open case."})
private void warnIfPathIsInvalid(String path) {
try {
if (!PathValidator.isValid(path, Case.getOpenCase().getCaseType())) {
if (!PathValidator.isValid(path, Case.getCurrentCaseThrows().getCaseType())) {
errorLabel.setVisible(true);
errorLabel.setText(Bundle.RawDSInputPanel_error_text());
}

View File

@ -299,7 +299,7 @@ public class PerformancePanel extends javax.swing.JDialog {
Case curCase;
try {
curCase = Case.getOpenCase();
curCase = Case.getCurrentCaseThrows();
} 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.getOpenCase();
curCase = Case.getCurrentCaseThrows();
} 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.getOpenCase();
curCase = Case.getCurrentCaseThrows();
} catch (Exception e) {
setDbLabel(NbBundle.getMessage(this.getClass(), "PerformancePanel.label.caseNotOpen.text"));
return;

View File

@ -364,7 +364,7 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
Case currentCase = null;
try {
currentCase = Case.getOpenCase();
currentCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
// No open case.
}
@ -526,7 +526,7 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
* sources.
*/
try {
Case openCase = Case.getOpenCase();
Case openCase = Case.getCurrentCaseThrows();
return openCase.hasData() == false;
} catch (NoCurrentCaseException ex) {
return true;
@ -619,7 +619,7 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
* already closed.
*/
try {
Case currentCase = Case.getOpenCase();
Case currentCase = Case.getCurrentCaseThrows();
// We only need to trigger openCoreWindows() when the
// first data source is added.
if (currentCase.getDataSources().size() == 1) {

View File

@ -89,7 +89,7 @@ public class ExternalViewerAction extends AbstractAction {
// Get the temp folder path of the case
Case openCase;
try {
openCase = Case.getOpenCase();
openCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
logger.log(Level.WARNING, "Exception while getting open case.", ex); //NON-NLS
return;

View File

@ -101,7 +101,7 @@ public final class ExtractAction extends AbstractAction {
private void extractFile(ActionEvent e, AbstractFile selectedFile) {
Case openCase;
try {
openCase = Case.getOpenCase();
openCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
JOptionPane.showMessageDialog((Component) e.getSource(), Bundle.ExtractAction_noOpenCase_errMsg());
logger.log(Level.INFO, "Exception while getting open case.", ex); //NON-NLS
@ -127,7 +127,7 @@ public final class ExtractAction extends AbstractAction {
private void extractFiles(ActionEvent e, Collection<? extends AbstractFile> selectedFiles) {
Case openCase;
try {
openCase = Case.getOpenCase();
openCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
JOptionPane.showMessageDialog((Component) e.getSource(), Bundle.ExtractAction_noOpenCase_errMsg());
logger.log(Level.INFO, "Exception while getting open case.", ex); //NON-NLS

View File

@ -121,7 +121,7 @@ final class ExtractUnallocAction extends AbstractAction {
}
Case openCase;
try {
openCase = Case.getOpenCase();
openCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
MessageNotifyUtil.Message.info(Bundle.ExtractAction_noOpenCase_errMsg());
return;
@ -611,7 +611,7 @@ final class ExtractUnallocAction extends AbstractAction {
this.imageId = img.getId();
this.imageName = img.getName();
this.fileName = this.imageName + "-Unalloc-" + this.imageId + "-" + 0 + ".dat"; //NON-NLS
this.fileInstance = new File(Case.getOpenCase().getExportDirectory() + File.separator + this.fileName);
this.fileInstance = new File(Case.getCurrentCaseThrows().getExportDirectory() + File.separator + this.fileName);
this.sizeInBytes = calcSizeInBytes();
}
@ -633,7 +633,7 @@ final class ExtractUnallocAction extends AbstractAction {
this.imageId = 0;
}
this.fileName = this.imageName + "-Unalloc-" + this.imageId + "-" + volumeId + ".dat"; //NON-NLS
this.fileInstance = new File(Case.getOpenCase().getExportDirectory() + File.separator + this.fileName);
this.fileInstance = new File(Case.getCurrentCaseThrows().getExportDirectory() + File.separator + this.fileName);
this.layoutFiles = getUnallocFiles(volume);
Collections.sort(layoutFiles, new SortObjId());
this.sizeInBytes = calcSizeInBytes();

View File

@ -49,7 +49,7 @@ class ViewSourceArtifactAction extends AbstractAction {
try {
for (BlackboardAttribute attribute : artifact.getAttributes()) {
if (attribute.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT.getTypeID()) {
BlackboardArtifact associatedArtifact = Case.getOpenCase().getSleuthkitCase().getBlackboardArtifact(attribute.getValueLong());
BlackboardArtifact associatedArtifact = Case.getCurrentCaseThrows().getSleuthkitCase().getBlackboardArtifact(attribute.getValueLong());
if (associatedArtifact != null) {
dirTree.viewArtifact(associatedArtifact);
break;

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