diff --git a/Core/nbproject/project.xml b/Core/nbproject/project.xml index bfcd75f7ba..36270dd889 100644 --- a/Core/nbproject/project.xml +++ b/Core/nbproject/project.xml @@ -6,6 +6,15 @@ org.sleuthkit.autopsy.core + + org.jdesktop.beansbinding + + + + 1 + 1.27.1.121 + + org.netbeans.api.progress @@ -286,7 +295,6 @@ - net.sf.sevenzipjbinding net.sf.sevenzipjbinding.impl diff --git a/Core/src/org/sleuthkit/autopsy/actions/AddBlackboardArtifactTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/AddBlackboardArtifactTagAction.java index 02d7a48664..47bd201ec1 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/AddBlackboardArtifactTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/AddBlackboardArtifactTagAction.java @@ -27,6 +27,7 @@ import org.openide.util.NbBundle; import org.openide.util.Utilities; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.TagName; @@ -83,8 +84,8 @@ public class AddBlackboardArtifactTagAction extends AddTagAction { new Thread(() -> { for (BlackboardArtifact artifact : selectedArtifacts) { try { - Case.getCurrentCase().getServices().getTagsManager().addBlackboardArtifactTag(artifact, tagName, comment); - } catch (TskCoreException ex) { + Case.getOpenCase().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(() -> { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), diff --git a/Core/src/org/sleuthkit/autopsy/actions/AddBookmarkTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/AddBookmarkTagAction.java index 2fefb10d54..9e99922775 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/AddBookmarkTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/AddBookmarkTagAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * -* Copyright 2011-2017 Basis Technology Corp. +* Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,6 +30,7 @@ import javax.swing.KeyStroke; import org.openide.util.NbBundle; import org.openide.util.Utilities; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.TagName; @@ -44,7 +45,7 @@ public class AddBookmarkTagAction extends AbstractAction { @Override public void actionPerformed(ActionEvent e) { try { - Map tagNamesMap = Case.getCurrentCase().getServices().getTagsManager().getDisplayNamesToTagNamesMap(); + Map tagNamesMap = Case.getOpenCase().getServices().getTagsManager().getDisplayNamesToTagNamesMap(); TagName bookmarkTagName = tagNamesMap.get(BOOKMARK); /* @@ -60,7 +61,7 @@ public class AddBookmarkTagAction extends AbstractAction { AddContentTagAction.getInstance().addTag(bookmarkTagName, NO_COMMENT); } - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(AddBookmarkTagAction.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS } } diff --git a/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java index ac2da58755..dad777585f 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java @@ -27,6 +27,7 @@ import org.openide.util.NbBundle; import org.openide.util.Utilities; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.Content; @@ -139,8 +140,8 @@ public class AddContentTagAction extends AddTagAction { } } - Case.getCurrentCase().getServices().getTagsManager().addContentTag(file, tagName, comment); - } catch (TskCoreException ex) { + Case.getOpenCase().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; SwingUtilities.invokeLater(() -> { diff --git a/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java index 95b68b87d6..12e23bdb30 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,9 +26,9 @@ import javax.swing.AbstractAction; import javax.swing.JMenu; import javax.swing.JMenuItem; import org.openide.util.NbBundle; -import org.openide.util.NbBundle.Messages; import org.openide.util.actions.Presenter; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.TagName; @@ -91,11 +91,11 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup { super(getActionDisplayName()); // Get the current set of tag names. - TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager(); Map tagNamesMap = null; try { + TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager(); tagNamesMap = new TreeMap<>(tagsManager.getDisplayNamesToTagNamesMap()); - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(TagsManager.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS } @@ -168,18 +168,26 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup { * @param comment comment for the content or artifact tag */ private void getAndAddTag(String tagDisplayName, TagName tagName, String comment) { + Case openCase; + try { + openCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + Logger.getLogger(AddTagAction.class.getName()).log(Level.SEVERE, "Exception while getting open case.", ex); // NON-NLS + return; + } + if (tagName == null) { try { - tagName = Case.getCurrentCase().getServices().getTagsManager().addTagName(tagDisplayName); + tagName = openCase.getServices().getTagsManager().addTagName(tagDisplayName); } catch (TagsManager.TagNameAlreadyExistsException ex) { try { - tagName = Case.getCurrentCase().getServices().getTagsManager().getDisplayNamesToTagNamesMap().get(tagDisplayName); + tagName = openCase.getServices().getTagsManager().getDisplayNamesToTagNamesMap().get(tagDisplayName); } catch (TskCoreException ex1) { Logger.getLogger(AddTagAction.class.getName()).log(Level.SEVERE, tagDisplayName + " already exists in database but an error occurred in retrieving it.", ex1); //NON-NLS - } + } } catch (TskCoreException ex) { Logger.getLogger(AddTagAction.class.getName()).log(Level.SEVERE, "Error adding " + tagDisplayName + " tag name", ex); //NON-NLS - } + } } addTag(tagName, comment); } diff --git a/Core/src/org/sleuthkit/autopsy/actions/DeleteBlackboardArtifactTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/DeleteBlackboardArtifactTagAction.java index 5bb578d722..28aa03bed8 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/DeleteBlackboardArtifactTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/DeleteBlackboardArtifactTagAction.java @@ -28,6 +28,7 @@ import org.openide.util.NbBundle; import org.openide.util.Utilities; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.BlackboardArtifactTag; import org.sleuthkit.datamodel.TskCoreException; @@ -72,8 +73,8 @@ public class DeleteBlackboardArtifactTagAction extends AbstractAction { new Thread(() -> { for (BlackboardArtifactTag tag : selectedTags) { try { - Case.getCurrentCase().getServices().getTagsManager().deleteBlackboardArtifactTag(tag); - } catch (TskCoreException ex) { + Case.getOpenCase().getServices().getTagsManager().deleteBlackboardArtifactTag(tag); + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(DeleteBlackboardArtifactTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex); //NON-NLS SwingUtilities.invokeLater(() -> { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), diff --git a/Core/src/org/sleuthkit/autopsy/actions/DeleteContentTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/DeleteContentTagAction.java index 66cb2bf1e7..065a023c2f 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/DeleteContentTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/DeleteContentTagAction.java @@ -28,6 +28,7 @@ import org.openide.util.NbBundle; import org.openide.util.Utilities; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.ContentTag; import org.sleuthkit.datamodel.TskCoreException; @@ -71,8 +72,8 @@ public class DeleteContentTagAction extends AbstractAction { new Thread(() -> { for (ContentTag tag : selectedTags) { try { - Case.getCurrentCase().getServices().getTagsManager().deleteContentTag(tag); - } catch (TskCoreException ex) { + Case.getOpenCase().getServices().getTagsManager().deleteContentTag(tag); + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(DeleteContentTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex); //NON-NLS SwingUtilities.invokeLater(() -> { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), diff --git a/Core/src/org/sleuthkit/autopsy/actions/DeleteFileBlackboardArtifactTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/DeleteFileBlackboardArtifactTagAction.java index dd2108c1fc..ce99fb1ec4 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/DeleteFileBlackboardArtifactTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/DeleteFileBlackboardArtifactTagAction.java @@ -36,6 +36,7 @@ import org.openide.util.NbBundle; import org.openide.util.Utilities; import org.openide.util.actions.Presenter; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.BlackboardArtifact; @@ -95,7 +96,16 @@ public class DeleteFileBlackboardArtifactTagAction extends AbstractAction implem @Override protected Void doInBackground() throws Exception { - TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager(); + TagsManager tagsManager; + try { + tagsManager = Case.getOpenCase().getServices().getTagsManager(); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Error untagging artifact. No open case found.", ex); //NON-NLS + Platform.runLater(() + -> new Alert(Alert.AlertType.ERROR, Bundle.DeleteFileBlackboardArtifactTagAction_deleteTag_alert(artifactId)).show() + ); + return null; + } try { logger.log(Level.INFO, "Removing tag {0} from {1}", new Object[]{tagName.getDisplayName(), artifactTag.getContent().getName()}); //NON-NLS @@ -142,13 +152,13 @@ public class DeleteFileBlackboardArtifactTagAction extends AbstractAction implem BlackboardArtifact artifact = selectedBlackboardArtifactsList.iterator().next(); - // Get the current set of tag names. - TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager(); - Map tagNamesMap = null; try { + // Get the current set of tag names. + TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager(); + tagNamesMap = new TreeMap<>(tagsManager.getDisplayNamesToTagNamesMap()); - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(TagsManager.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS } @@ -158,7 +168,7 @@ public class DeleteFileBlackboardArtifactTagAction extends AbstractAction implem if (null != tagNamesMap && !tagNamesMap.isEmpty()) { try { List existingTagsList - = Case.getCurrentCase().getServices().getTagsManager() + = Case.getOpenCase().getServices().getTagsManager() .getBlackboardArtifactTagsByArtifact(artifact); for (Map.Entry entry : tagNamesMap.entrySet()) { @@ -176,7 +186,7 @@ public class DeleteFileBlackboardArtifactTagAction extends AbstractAction implem } } } - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(TagMenu.class.getName()) .log(Level.SEVERE, "Error retrieving tags for TagMenu", ex); //NON-NLS } diff --git a/Core/src/org/sleuthkit/autopsy/actions/DeleteFileContentTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/DeleteFileContentTagAction.java index c11ffd39fa..abc316b33f 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/DeleteFileContentTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/DeleteFileContentTagAction.java @@ -36,6 +36,7 @@ import org.openide.util.NbBundle; import org.openide.util.Utilities; import org.openide.util.actions.Presenter; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.AbstractFile; @@ -95,7 +96,16 @@ public class DeleteFileContentTagAction extends AbstractAction implements Presen @Override protected Void doInBackground() throws Exception { - TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager(); + TagsManager tagsManager; + try { + tagsManager = Case.getOpenCase().getServices().getTagsManager(); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Error untagging file. No open case found.", ex); //NON-NLS + Platform.runLater(() -> + new Alert(Alert.AlertType.ERROR, Bundle.DeleteFileContentTagAction_deleteTag_alert(fileId)).show() + ); + return null; + } try { logger.log(Level.INFO, "Removing tag {0} from {1}", new Object[]{tagName.getDisplayName(), contentTag.getContent().getName()}); //NON-NLS @@ -139,13 +149,13 @@ public class DeleteFileContentTagAction extends AbstractAction implements Presen if(!selectedAbstractFilesList.isEmpty()) { AbstractFile file = selectedAbstractFilesList.iterator().next(); - // Get the current set of tag names. - TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager(); - Map tagNamesMap = null; try { + // Get the current set of tag names. + TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager(); + tagNamesMap = new TreeMap<>(tagsManager.getDisplayNamesToTagNamesMap()); - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(TagsManager.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS } @@ -155,7 +165,7 @@ public class DeleteFileContentTagAction extends AbstractAction implements Presen if (null != tagNamesMap && !tagNamesMap.isEmpty()) { try { List existingTagsList = - Case.getCurrentCase().getServices().getTagsManager() + Case.getOpenCase().getServices().getTagsManager() .getContentTagsByContent(file); for (Map.Entry entry : tagNamesMap.entrySet()) { @@ -173,7 +183,7 @@ public class DeleteFileContentTagAction extends AbstractAction implements Presen } } } - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(TagMenu.class.getName()) .log(Level.SEVERE, "Error retrieving tags for TagMenu", ex); //NON-NLS } diff --git a/Core/src/org/sleuthkit/autopsy/actions/GetTagNameAndCommentDialog.java b/Core/src/org/sleuthkit/autopsy/actions/GetTagNameAndCommentDialog.java index e01a887949..f295a613a5 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/GetTagNameAndCommentDialog.java +++ b/Core/src/org/sleuthkit/autopsy/actions/GetTagNameAndCommentDialog.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,6 +36,7 @@ import javax.swing.KeyStroke; import org.openide.util.NbBundle; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.TagName; @@ -137,11 +138,11 @@ public class GetTagNameAndCommentDialog extends JDialog { // tag name DTOs to be enable to return the one the user selects. // Tag name DTOs may be null (user tag names that have not been used do // not exist in the database). - TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager(); try { + TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager(); tagNamesSet.addAll(tagsManager.getAllTagNames()); - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(GetTagNameAndCommentDialog.class .getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS } diff --git a/Core/src/org/sleuthkit/autopsy/actions/GetTagNameDialog.java b/Core/src/org/sleuthkit/autopsy/actions/GetTagNameDialog.java index 45d2715f63..4bdbf0bd29 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/GetTagNameDialog.java +++ b/Core/src/org/sleuthkit/autopsy/actions/GetTagNameDialog.java @@ -39,6 +39,7 @@ import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.TagName; @@ -108,10 +109,10 @@ 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. - TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager(); try { + TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager(); tagNamesMap.putAll(tagsManager.getDisplayNamesToTagNamesMap()); - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(GetTagNameDialog.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS } @@ -347,9 +348,9 @@ public class GetTagNameDialog extends JDialog { if (tagName == null) { try { - tagName = Case.getCurrentCase().getServices().getTagsManager().addTagName(tagDisplayName, userTagDescription, TagName.HTML_COLOR.NONE, status); + tagName = Case.getOpenCase().getServices().getTagsManager().addTagName(tagDisplayName, userTagDescription, TagName.HTML_COLOR.NONE, status); dispose(); - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(AddTagAction.class.getName()).log(Level.SEVERE, "Error adding " + tagDisplayName + " tag name", ex); //NON-NLS JOptionPane.showMessageDialog(this, NbBundle.getMessage(this.getClass(), @@ -360,8 +361,8 @@ public class GetTagNameDialog extends JDialog { tagName = null; } catch (TagsManager.TagNameAlreadyExistsException ex) { try { - tagName = Case.getCurrentCase().getServices().getTagsManager().getDisplayNamesToTagNamesMap().get(tagDisplayName); - } catch (TskCoreException ex1) { + tagName = Case.getOpenCase().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, NbBundle.getMessage(this.getClass(), diff --git a/Core/src/org/sleuthkit/autopsy/actions/OpenLogFolderAction.java b/Core/src/org/sleuthkit/autopsy/actions/OpenLogFolderAction.java index 62a23b46b0..021ecd6278 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/OpenLogFolderAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/OpenLogFolderAction.java @@ -32,6 +32,7 @@ import org.openide.awt.ActionRegistration; import org.openide.modules.Places; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; /** @@ -57,9 +58,9 @@ public final class OpenLogFolderAction implements ActionListener { /* * Open the log directory for the case. */ - Case currentCase = Case.getCurrentCase(); + Case currentCase = Case.getOpenCase(); logDir = new File(currentCase.getLogDirectoryPath()); - } catch (IllegalStateException ex) { + } catch (NoCurrentCaseException ex) { /* * There is no open case, open the application level log * directory. diff --git a/Core/src/org/sleuthkit/autopsy/actions/OpenOutputFolderAction.java b/Core/src/org/sleuthkit/autopsy/actions/OpenOutputFolderAction.java index f3b624edb6..9e71c29fa9 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/OpenOutputFolderAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/OpenOutputFolderAction.java @@ -33,6 +33,7 @@ import org.openide.util.NbBundle; import org.openide.util.actions.CallableSystemAction; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; /** @@ -56,7 +57,7 @@ public final class OpenOutputFolderAction extends CallableSystemAction { public void performAction() { File outputDir; try { - Case currentCase = Case.getCurrentCase(); + Case currentCase = Case.getOpenCase(); outputDir = new File(currentCase.getOutputDirectory()); if (outputDir.exists()) { try { @@ -72,7 +73,7 @@ public final class OpenOutputFolderAction extends CallableSystemAction { NbBundle.getMessage(this.getClass(), "OpenOutputFolder.error1", outputDir.getAbsolutePath()), NotifyDescriptor.ERROR_MESSAGE); DialogDisplayer.getDefault().notify(descriptor); } - } catch (IllegalStateException ex) { + } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "OpenOutputFolderAction enabled with no current case", ex); //NON-NLS JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(this.getClass(), "OpenOutputFolder.noCaseOpen")); } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageTask.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageTask.java index f6458e6dd0..21a7bca103 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageTask.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageTask.java @@ -107,9 +107,15 @@ class AddImageTask implements Runnable { */ @Override public void run() { + Case currentCase; + try { + currentCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", ex); + return; + } progressMonitor.setIndeterminate(true); progressMonitor.setProgress(0); - Case currentCase = Case.getCurrentCase(); String imageWriterPath = ""; if (imageWriterSettings != null) { imageWriterPath = imageWriterSettings.getPath(); diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardSelectDspVisual.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardSelectDspVisual.java index 9c66184b47..e01773a79c 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardSelectDspVisual.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardSelectDspVisual.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -58,10 +58,15 @@ final class AddImageWizardSelectDspVisual extends JPanel { initComponents(); selectedDsp = lastDspUsed; //if the last selected DSP was the Local Disk DSP and it would be disabled then we want to select a different DSP - if ((Case.getCurrentCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) && selectedDsp.equals(LocalDiskDSProcessor.getType())) { - selectedDsp = ImageDSProcessor.getType(); + try { + if ((Case.getOpenCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) && selectedDsp.equals(LocalDiskDSProcessor.getType())) { + selectedDsp = ImageDSProcessor.getType(); + } + createDataSourceProcessorButtons(); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", ex); } - createDataSourceProcessorButtons(); + //add actionlistner to listen for change } @@ -96,7 +101,7 @@ final class AddImageWizardSelectDspVisual extends JPanel { * Create the a button for each DataSourceProcessor that should exist as an * option. */ - private void createDataSourceProcessorButtons() { + private void createDataSourceProcessorButtons() throws NoCurrentCaseException { //Listener for button selection ActionListener cbActionListener = new ActionListener() { @Override @@ -126,7 +131,7 @@ final class AddImageWizardSelectDspVisual extends JPanel { //Add the button JToggleButton dspButton = createDspButton(dspType); dspButton.addActionListener(cbActionListener); - if ((Case.getCurrentCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) && dspType.equals(LocalDiskDSProcessor.getType())){ + if ((Case.getOpenCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) && dspType.equals(LocalDiskDSProcessor.getType())){ dspButton.setEnabled(false); //disable the button for local disk DSP when this is a multi user case dspButton.setSelected(false); shouldAddMultiUserWarning = true; diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddLocalFilesTask.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddLocalFilesTask.java index c610ff78c3..e7e3702600 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddLocalFilesTask.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddLocalFilesTask.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013-2016 Basis Technology Corp. + * Copyright 2013-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -87,10 +87,10 @@ class AddLocalFilesTask implements Runnable { List errors = new ArrayList<>(); try { progress.setIndeterminate(true); - FileManager fileManager = Case.getCurrentCase().getServices().getFileManager(); + FileManager fileManager = Case.getOpenCase().getServices().getFileManager(); LocalFilesDataSource newDataSource = fileManager.addLocalFilesDataSource(deviceId, rootVirtualDirectoryName, "", localFilePaths, new ProgressUpdater()); newDataSources.add(newDataSource); - } catch (TskDataException | TskCoreException ex) { + } catch (TskDataException | TskCoreException | NoCurrentCaseException ex) { errors.add(ex.getMessage()); LOGGER.log(Level.SEVERE, String.format("Failed to add datasource: %s", ex.getMessage()), ex); } finally { diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/Bundle.properties b/Core/src/org/sleuthkit/autopsy/casemodule/Bundle.properties index cc7ab91631..ba910c4391 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/casemodule/Bundle.properties @@ -219,6 +219,8 @@ MultiUserCasesPanel.searchLabel.text=Select any case and start typing to search MultiUserCasesPanel.cancelButton.text=Cancel ImageFilePanel.pathErrorLabel.text=Error Label ImageFilePanel.sectorSizeLabel.text=Sector size: +LocalDiskPanel.sectorSizeLabel.text=Sector Size: +LocalDiskPanel.refreshTableButton.text=Refresh Local Disks LocalFilesPanel.displayNameLabel.text=Logical File Set Display Name: Default LocalFilesPanel.errorLabel.text=Error Label LocalFilesPanel.selectedPaths.toolTipText= diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/Case.java b/Core/src/org/sleuthkit/autopsy/casemodule/Case.java index b9665ab811..8775013512 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/Case.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/Case.java @@ -583,24 +583,42 @@ public class Case { } /** + * Deprecated. Use getOpenCase() instead. + * * Gets the current case, if there is one, at the time of the call. * * @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. * - * TODO (JIRA-2229): Case.getCurrentCase() method throws unchecked - * IllegalStateException; change to throw checked exception or return - * null */ - if (null != currentCase) { - return currentCase; + try { + return getOpenCase(); + } catch (NoCurrentCaseException ex) { + 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. + * + * @return The open case. + * + * @throws NoCurrentCaseException if there is no open case. + */ + public static Case getOpenCase() throws NoCurrentCaseException { + Case openCase = currentCase; + if (openCase == null) { + throw new NoCurrentCaseException(NbBundle.getMessage(Case.class, "Case.getCurCase.exception.noneOpen")); } else { - throw new IllegalStateException(NbBundle.getMessage(Case.class, "Case.getCurCase.exception.noneOpen")); + return openCase; } } @@ -806,7 +824,7 @@ public class Case { * * @throws CaseActionException throw if could not create the case dir */ - static void createCaseDirectory(String caseDir, CaseType caseType) throws CaseActionException { + public static void createCaseDirectory(String caseDir, CaseType caseType) throws CaseActionException { File caseDirF = new File(caseDir); diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/CaseDeleteAction.java b/Core/src/org/sleuthkit/autopsy/casemodule/CaseDeleteAction.java index 357b1f4704..2b333e2bdc 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/CaseDeleteAction.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/CaseDeleteAction.java @@ -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.getCurrentCase(); + Case currentCase = Case.getOpenCase(); String caseName = currentCase.getName(); String caseDirectory = currentCase.getCaseDirectory(); @@ -110,7 +110,7 @@ final class CaseDeleteAction extends CallableSystemAction { } }.execute(); } - } catch (IllegalStateException ex) { + } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Case delete action called with no current case", ex); } } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/CaseInformationPanel.form b/Core/src/org/sleuthkit/autopsy/casemodule/CaseInformationPanel.form index 932f370478..3af89b45de 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/CaseInformationPanel.form +++ b/Core/src/org/sleuthkit/autopsy/casemodule/CaseInformationPanel.form @@ -38,9 +38,9 @@ - + - + diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/CaseInformationPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/CaseInformationPanel.java index 04632e76ba..e3afa329d9 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/CaseInformationPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/CaseInformationPanel.java @@ -109,14 +109,11 @@ class CaseInformationPanel extends javax.swing.JPanel { .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 709, Short.MAX_VALUE) .addGroup(outerDetailsPanelLayout.createSequentialGroup() .addContainerGap() - .addComponent(editDetailsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(editDetailsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(closeButton) .addContainerGap()) ); - - outerDetailsPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {closeButton, editDetailsButton}); - outerDetailsPanelLayout.setVerticalGroup( outerDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(outerDetailsPanelLayout.createSequentialGroup() diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/CasePropertiesPanel.form b/Core/src/org/sleuthkit/autopsy/casemodule/CasePropertiesPanel.form index ab036f2e87..84ba87f165 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/CasePropertiesPanel.form +++ b/Core/src/org/sleuthkit/autopsy/casemodule/CasePropertiesPanel.form @@ -101,8 +101,8 @@ - - + + @@ -113,14 +113,14 @@ - - - - + + + - + + - + @@ -281,15 +281,6 @@ - - - - - - - - - @@ -380,20 +371,20 @@ - - - + + + - + - + - - + + @@ -566,21 +557,19 @@ - - - - - + + + - + - + - + diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/CasePropertiesPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/CasePropertiesPanel.java index 101f8688dd..3dfe261302 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/CasePropertiesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/CasePropertiesPanel.java @@ -210,9 +210,6 @@ final class CasePropertiesPanel extends javax.swing.JPanel { caseNumberLabel.setFont(caseNumberLabel.getFont().deriveFont(caseNumberLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); caseNumberLabel.setText(org.openide.util.NbBundle.getMessage(CasePropertiesPanel.class, "CasePropertiesPanel.caseNumberLabel.text")); // NOI18N - caseNumberLabel.setMaximumSize(new java.awt.Dimension(82, 14)); - caseNumberLabel.setMinimumSize(new java.awt.Dimension(82, 14)); - caseNumberLabel.setPreferredSize(new java.awt.Dimension(82, 14)); caseDirLabel.setFont(caseDirLabel.getFont().deriveFont(caseDirLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); caseDirLabel.setText(org.openide.util.NbBundle.getMessage(CasePropertiesPanel.class, "CasePropertiesPanel.caseDirLabel.text")); // NOI18N @@ -242,7 +239,7 @@ final class CasePropertiesPanel extends javax.swing.JPanel { .addGroup(casePanelLayout.createSequentialGroup() .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(caseNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(caseNumberLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(caseNumberLabel)) .addGap(6, 6, 6) .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lbCaseNumberText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -251,11 +248,11 @@ final class CasePropertiesPanel extends javax.swing.JPanel { .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(lbCaseUUIDLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(lbDbName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbDbType, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(caseDirLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(crDateLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(crDateLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(lbDbName, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(6, 6, 6) .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(crDateField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(caseDirField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -264,6 +261,9 @@ final class CasePropertiesPanel extends javax.swing.JPanel { .addComponent(lbCaseUIDText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addContainerGap()) ); + + casePanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {caseDirLabel, caseNameLabel, caseNumberLabel, crDateLabel, lbCaseUUIDLabel, lbDbName, lbDbType}); + casePanelLayout.setVerticalGroup( casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(casePanelLayout.createSequentialGroup() @@ -273,7 +273,7 @@ final class CasePropertiesPanel extends javax.swing.JPanel { .addComponent(lbCaseNameText, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(caseNumberLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(caseNumberLabel, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lbCaseNumberText, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -343,13 +343,13 @@ final class CasePropertiesPanel extends javax.swing.JPanel { .addContainerGap() .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(examinerPanelLayout.createSequentialGroup() - .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(lbExaminerPhoneLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(lbNotesLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(lbNotesLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(lbExaminerPhoneLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(6, 6, 6) .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lbExaminerPhoneText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(caseNotesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 411, Short.MAX_VALUE))) + .addComponent(caseNotesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 704, Short.MAX_VALUE))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, examinerPanelLayout.createSequentialGroup() .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(lbExaminerEmailLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -360,6 +360,9 @@ final class CasePropertiesPanel extends javax.swing.JPanel { .addComponent(lbExaminerEmailText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addContainerGap()) ); + + examinerPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {examinerLabel, lbExaminerEmailLabel, lbExaminerPhoneLabel, lbNotesLabel}); + examinerPanelLayout.setVerticalGroup( examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(examinerPanelLayout.createSequentialGroup() @@ -410,13 +413,12 @@ final class CasePropertiesPanel extends javax.swing.JPanel { .addGroup(pnOrganizationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnOrganizationLayout.createSequentialGroup() .addGroup(pnOrganizationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pnOrganizationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(lbPointOfContactEmailLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(lbPointOfContactNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addComponent(lbOrganizationNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(lbPointOfContactEmailLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(lbOrganizationNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(lbPointOfContactNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(6, 6, 6) .addGroup(pnOrganizationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(lbPointOfContactNameText, javax.swing.GroupLayout.DEFAULT_SIZE, 411, Short.MAX_VALUE) + .addComponent(lbPointOfContactNameText, javax.swing.GroupLayout.DEFAULT_SIZE, 704, Short.MAX_VALUE) .addComponent(lbOrganizationNameText, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbPointOfContactEmailText, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(pnOrganizationLayout.createSequentialGroup() @@ -425,6 +427,9 @@ final class CasePropertiesPanel extends javax.swing.JPanel { .addComponent(lbPointOfContactPhoneText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap()) ); + + pnOrganizationLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {lbOrganizationNameLabel, lbPointOfContactEmailLabel, lbPointOfContactNameLabel, lbPointOfContactPhoneLabel}); + pnOrganizationLayout.setVerticalGroup( pnOrganizationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnOrganizationLayout.createSequentialGroup() diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/ImageDSProcessor.java b/Core/src/org/sleuthkit/autopsy/casemodule/ImageDSProcessor.java index b1824a86e8..6e27d1d831 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/ImageDSProcessor.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/ImageDSProcessor.java @@ -264,7 +264,7 @@ public class ImageDSProcessor implements DataSourceProcessor, AutoIngestDataSour try { // verify that the image has a file system that TSK can process - Case currentCase = Case.getCurrentCase(); + Case currentCase = Case.getOpenCase(); if (!DataSourceUtils.imageHasFileSystem(dataSourcePath)) { // image does not have a file system that TSK can process return 0; diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/ImageFilePanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/ImageFilePanel.java index 29ad64e672..6fa73b7ff7 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/ImageFilePanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/ImageFilePanel.java @@ -31,6 +31,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.filechooser.FileFilter; import org.apache.commons.lang3.StringUtils; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; import static org.sleuthkit.autopsy.casemodule.Bundle.*; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor; @@ -306,7 +307,9 @@ public class ImageFilePanel extends JPanel implements DocumentListener { * * @return true if a proper image has been selected, false otherwise */ - @NbBundle.Messages("ImageFilePanel.pathValidation.dataSourceOnCDriveError=Warning: Path to multi-user data source is on \"C:\" drive") + @NbBundle.Messages({"ImageFilePanel.pathValidation.dataSourceOnCDriveError=Warning: Path to multi-user data source is on \"C:\" drive", + "ImageFilePanel.pathValidation.getOpenCase.Error=Warning: Exception while getting open case." + }) public boolean validatePanel() { pathErrorLabel.setVisible(false); String path = getContentPaths(); @@ -315,9 +318,14 @@ public class ImageFilePanel extends JPanel implements DocumentListener { } // Display warning if there is one (but don't disable "next" button) - if (false == PathValidator.isValid(path, Case.getCurrentCase().getCaseType())) { + try { + if (false == PathValidator.isValid(path, Case.getOpenCase().getCaseType())) { + pathErrorLabel.setVisible(true); + pathErrorLabel.setText(Bundle.ImageFilePanel_pathValidation_dataSourceOnCDriveError()); + } + } catch (NoCurrentCaseException ex) { pathErrorLabel.setVisible(true); - pathErrorLabel.setText(Bundle.ImageFilePanel_pathValidation_dataSourceOnCDriveError()); + pathErrorLabel.setText(Bundle.ImageFilePanel_pathValidation_getOpenCase_Error()); } return new File(path).isFile() diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/LocalDiskDSProcessor.java b/Core/src/org/sleuthkit/autopsy/casemodule/LocalDiskDSProcessor.java index 169c3d0f00..1df465e02a 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/LocalDiskDSProcessor.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/LocalDiskDSProcessor.java @@ -54,6 +54,7 @@ public class LocalDiskDSProcessor implements DataSourceProcessor, AutoIngestData */ private String deviceId; private String drivePath; + private int sectorSize; private String timeZone; private ImageWriterSettings imageWriterSettings; private boolean ignoreFatOrphanFiles; @@ -137,6 +138,7 @@ public class LocalDiskDSProcessor implements DataSourceProcessor, AutoIngestData if (!setDataSourceOptionsCalled) { deviceId = UUID.randomUUID().toString(); drivePath = configPanel.getContentPaths(); + sectorSize = configPanel.getSectorSize(); timeZone = configPanel.getTimeZone(); ignoreFatOrphanFiles = configPanel.getNoFatOrphans(); if (configPanel.getImageWriterEnabled()) { @@ -145,7 +147,7 @@ public class LocalDiskDSProcessor implements DataSourceProcessor, AutoIngestData imageWriterSettings = null; } } - addDiskTask = new AddImageTask(deviceId, drivePath, 0, timeZone, ignoreFatOrphanFiles, imageWriterSettings, progressMonitor, callback); + addDiskTask = new AddImageTask(deviceId, drivePath, sectorSize, timeZone, ignoreFatOrphanFiles, imageWriterSettings, progressMonitor, callback); new Thread(addDiskTask).start(); } @@ -171,7 +173,33 @@ public class LocalDiskDSProcessor implements DataSourceProcessor, AutoIngestData * @param callback Callback to call when processing is done. */ public void run(String deviceId, String drivePath, String timeZone, boolean ignoreFatOrphanFiles, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) { - addDiskTask = new AddImageTask(deviceId, drivePath, 0, timeZone, ignoreFatOrphanFiles, imageWriterSettings, progressMonitor, callback); + run(deviceId, drivePath, 0, timeZone, ignoreFatOrphanFiles, progressMonitor, callback); + } + + /** + * Adds a data source to the case database using a background task in a + * separate thread and the given settings instead of those provided by the + * selection and configuration panel. Returns as soon as the background task + * is started and uses the callback object to signal task completion and + * return results. + * + * @param deviceId An ASCII-printable identifier for the device + * associated with the data source that is + * intended to be unique across multiple cases + * (e.g., a UUID). + * @param drivePath Path to the local drive. + * @param sectorSize The sector size (use '0' for autodetect). + * @param timeZone The time zone to use when processing dates + * and times for the image, obtained from + * java.util.TimeZone.getID. + * @param ignoreFatOrphanFiles Whether to parse orphans if the image has a + * FAT filesystem. + * @param progressMonitor Progress monitor for reporting progress + * during processing. + * @param callback Callback to call when processing is done. + */ + private void run(String deviceId, String drivePath, int sectorSize, String timeZone, boolean ignoreFatOrphanFiles, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) { + addDiskTask = new AddImageTask(deviceId, drivePath, sectorSize, timeZone, ignoreFatOrphanFiles, imageWriterSettings, progressMonitor, callback); new Thread(addDiskTask).start(); } @@ -227,10 +255,11 @@ public class LocalDiskDSProcessor implements DataSourceProcessor, AutoIngestData public void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack) throws AutoIngestDataSourceProcessorException { this.deviceId = deviceId; this.drivePath = dataSourcePath.toString(); + this.sectorSize = 0; this.timeZone = Calendar.getInstance().getTimeZone().getID(); this.ignoreFatOrphanFiles = false; setDataSourceOptionsCalled = true; - run(deviceId, drivePath, timeZone, ignoreFatOrphanFiles, progressMonitor, callBack); + run(deviceId, drivePath, sectorSize, timeZone, ignoreFatOrphanFiles, progressMonitor, callBack); } /** @@ -250,6 +279,7 @@ public class LocalDiskDSProcessor implements DataSourceProcessor, AutoIngestData public void setDataSourceOptions(String drivePath, String timeZone, boolean ignoreFatOrphanFiles) { this.deviceId = UUID.randomUUID().toString(); this.drivePath = drivePath; + this.sectorSize = 0; this.timeZone = Calendar.getInstance().getTimeZone().getID(); this.ignoreFatOrphanFiles = ignoreFatOrphanFiles; setDataSourceOptionsCalled = true; diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/LocalDiskPanel.form b/Core/src/org/sleuthkit/autopsy/casemodule/LocalDiskPanel.form index 09239fe001..940346b4e3 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/LocalDiskPanel.form +++ b/Core/src/org/sleuthkit/autopsy/casemodule/LocalDiskPanel.form @@ -27,55 +27,52 @@ + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - @@ -85,27 +82,32 @@ - + - + - + + + + + + - - - + + + - + @@ -113,7 +115,7 @@ - + @@ -276,15 +278,32 @@ - + - + - + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/LocalDiskPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/LocalDiskPanel.java index 15abfcf441..7e7d2dd4af 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/LocalDiskPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/LocalDiskPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -42,7 +42,9 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.imagewriter.ImageWriterSettings; -@NbBundle.Messages({"LocalDiskPanel.refreshTablebutton.text=Refresh Local Disks" +@NbBundle.Messages({"LocalDiskPanel.refreshTablebutton.text=Refresh Local Disks", + "LocalDiskPanel.listener.getOpenCase.errTitle=No open case available", + "LocalDiskPanel.listener.getOpenCase.errMsg=LocalDiskPanel listener couldn't get the open case." }) /** * ImageTypePanel for adding a local disk or partition such as PhysicalDrive0 or @@ -51,6 +53,7 @@ import org.sleuthkit.autopsy.imagewriter.ImageWriterSettings; final class LocalDiskPanel extends JPanel { private static final Logger logger = Logger.getLogger(LocalDiskPanel.class.getName()); + private static final String[] SECTOR_SIZE_CHOICES = {"Auto Detect", "512", "1024", "2048", "4096"}; private static LocalDiskPanel instance; private static final long serialVersionUID = 1L; private List disks; @@ -68,15 +71,21 @@ final class LocalDiskPanel extends JPanel { initComponents(); customInit(); createTimeZoneList(); + createSectorSizeList(); refreshTable(); diskTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (diskTable.getSelectedRow() >= 0 && diskTable.getSelectedRow() < disks.size()) { enableNext = true; - setPotentialImageWriterPath(disks.get(diskTable.getSelectedRow())); try { + setPotentialImageWriterPath(disks.get(diskTable.getSelectedRow())); firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", e); //NON-NLS + MessageNotifyUtil.Notify.show(Bundle.LocalDiskPanel_listener_getOpenCase_errTitle(), + Bundle.LocalDiskPanel_listener_getOpenCase_errMsg(), + MessageNotifyUtil.MessageType.ERROR); } catch (Exception ex) { logger.log(Level.SEVERE, "LocalDiskPanel listener threw exception", e); //NON-NLS MessageNotifyUtil.Notify.show(NbBundle.getMessage(this.getClass(), "LocalDiskPanel.moduleErr"), @@ -115,7 +124,7 @@ final class LocalDiskPanel extends JPanel { diskTable.setEnabled(false); imageWriterErrorLabel.setVisible(false); imageWriterErrorLabel.setText(""); - if(! PlatformUtil.isWindowsOS()){ + if (!PlatformUtil.isWindowsOS()) { copyImageCheckbox.setSelected(false); copyImageCheckbox.setEnabled(false); } @@ -147,7 +156,9 @@ final class LocalDiskPanel extends JPanel { jLabel1 = new javax.swing.JLabel(); imageWriterErrorLabel = new javax.swing.JLabel(); changeDatabasePathCheckbox = new javax.swing.JCheckBox(); - refreshTablebutton = new javax.swing.JButton(); + refreshTableButton = new javax.swing.JButton(); + sectorSizeLabel = new javax.swing.JLabel(); + sectorSizeComboBox = new javax.swing.JComboBox<>(); setMinimumSize(new java.awt.Dimension(0, 420)); setPreferredSize(new java.awt.Dimension(485, 410)); @@ -205,13 +216,15 @@ final class LocalDiskPanel extends JPanel { org.openide.awt.Mnemonics.setLocalizedText(changeDatabasePathCheckbox, org.openide.util.NbBundle.getMessage(LocalDiskPanel.class, "LocalDiskPanel.changeDatabasePathCheckbox.text")); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(refreshTablebutton, org.openide.util.NbBundle.getMessage(LocalDiskPanel.class, "LocalDiskPanel.refreshTablebutton.text")); // NOI18N - refreshTablebutton.addActionListener(new java.awt.event.ActionListener() { + org.openide.awt.Mnemonics.setLocalizedText(refreshTableButton, org.openide.util.NbBundle.getMessage(LocalDiskPanel.class, "LocalDiskPanel.refreshTableButton.text")); // NOI18N + refreshTableButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - refreshTablebuttonActionPerformed(evt); + refreshTableButtonActionPerformed(evt); } }); + org.openide.awt.Mnemonics.setLocalizedText(sectorSizeLabel, org.openide.util.NbBundle.getMessage(LocalDiskPanel.class, "LocalDiskPanel.sectorSizeLabel.text")); // NOI18N + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -219,66 +232,70 @@ final class LocalDiskPanel extends JPanel { .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(noFatOrphansCheckbox) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(copyImageCheckbox) - .addComponent(descLabel)) - .addGroup(layout.createSequentialGroup() - .addGap(21, 21, 21) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addGroup(layout.createSequentialGroup() - .addComponent(pathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 342, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(browseButton, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(imageWriterErrorLabel) - .addComponent(jLabel1) - .addComponent(changeDatabasePathCheckbox)) - .addGap(0, 0, Short.MAX_VALUE))))) - .addGap(0, 0, Short.MAX_VALUE)) - .addGroup(layout.createSequentialGroup() - .addComponent(timeZoneLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(timeZoneComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) - .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 488, Short.MAX_VALUE) + .addComponent(diskLabel) + .addGap(0, 0, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) - .addComponent(refreshTablebutton, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(refreshTableButton)) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(diskLabel) - .addComponent(errorLabel)) - .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(timeZoneLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(timeZoneComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addGap(21, 21, 21) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(changeDatabasePathCheckbox, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(imageWriterErrorLabel, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(descLabel, javax.swing.GroupLayout.Alignment.LEADING))) + .addComponent(copyImageCheckbox, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(errorLabel, javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(sectorSizeLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(sectorSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addGap(21, 21, 21) + .addComponent(pathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 342, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(browseButton)) + .addComponent(noFatOrphansCheckbox, javax.swing.GroupLayout.Alignment.LEADING)) + .addGap(0, 0, Short.MAX_VALUE))))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(diskLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGap(1, 1, 1) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(refreshTablebutton) + .addComponent(refreshTableButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(timeZoneLabel) .addComponent(timeZoneComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(noFatOrphansCheckbox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(descLabel) + .addGap(10, 10, 10) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(sectorSizeLabel) + .addComponent(sectorSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(copyImageCheckbox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(browseButton) - .addComponent(pathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(pathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(browseButton)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(changeDatabasePathCheckbox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel1) @@ -286,7 +303,7 @@ final class LocalDiskPanel extends JPanel { .addComponent(imageWriterErrorLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(errorLabel) - .addContainerGap(58, Short.MAX_VALUE)) + .addContainerGap(43, Short.MAX_VALUE)) ); }// //GEN-END:initComponents @@ -317,9 +334,9 @@ final class LocalDiskPanel extends JPanel { fireUpdateEvent(); }//GEN-LAST:event_browseButtonActionPerformed - private void refreshTablebuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshTablebuttonActionPerformed + private void refreshTableButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshTableButtonActionPerformed refreshTable(); - }//GEN-LAST:event_refreshTablebuttonActionPerformed + }//GEN-LAST:event_refreshTableButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton browseButton; @@ -334,7 +351,9 @@ final class LocalDiskPanel extends JPanel { private javax.swing.JScrollPane jScrollPane1; private javax.swing.JCheckBox noFatOrphansCheckbox; private javax.swing.JTextField pathTextField; - private javax.swing.JButton refreshTablebutton; + private javax.swing.JButton refreshTableButton; + private javax.swing.JComboBox sectorSizeComboBox; + private javax.swing.JLabel sectorSizeLabel; private javax.swing.JComboBox timeZoneComboBox; private javax.swing.JLabel timeZoneLabel; // End of variables declaration//GEN-END:variables @@ -365,6 +384,21 @@ final class LocalDiskPanel extends JPanel { } } + /** + * Get the sector size. + * + * @return 0 if autodetect; otherwise the value selected. + */ + int getSectorSize() { + int sectorSizeSelectionIndex = sectorSizeComboBox.getSelectedIndex(); + + if (sectorSizeSelectionIndex == 0) { + return 0; + } + + return Integer.valueOf((String) sectorSizeComboBox.getSelectedItem()); + } + String getTimeZone() { String tz = timeZoneComboBox.getSelectedItem().toString(); return tz.substring(tz.indexOf(")") + 2).trim(); @@ -375,11 +409,11 @@ final class LocalDiskPanel extends JPanel { return noFatOrphansCheckbox.isSelected(); } - private static String getDefaultImageWriterFolder() { - return Paths.get(Case.getCurrentCase().getModuleDirectory(), "Image Writer").toString(); + private static String getDefaultImageWriterFolder() throws NoCurrentCaseException { + return Paths.get(Case.getOpenCase().getModuleDirectory(), "Image Writer").toString(); } - private void setPotentialImageWriterPath(LocalDisk disk) { + private void setPotentialImageWriterPath(LocalDisk disk) throws NoCurrentCaseException { File subDirectory = Paths.get(getDefaultImageWriterFolder()).toFile(); if (!subDirectory.exists()) { @@ -464,8 +498,8 @@ final class LocalDiskPanel extends JPanel { } /** - * Creates the drop down list for the time zones and then makes the local - * machine time zone to be selected. + * Creates the drop down list for the time zones and defaults the selection + * to the local machine time zone. */ public void createTimeZoneList() { // load and add all timezone @@ -500,6 +534,17 @@ final class LocalDiskPanel extends JPanel { } + /** + * Creates the drop down list for the sector size and defaults the selection + * to "Auto Detect". + */ + private void createSectorSizeList() { + for (String choice : SECTOR_SIZE_CHOICES) { + sectorSizeComboBox.addItem(choice); + } + sectorSizeComboBox.setSelectedIndex(0); + } + /** * Table model for displaing information from LocalDisk Objects in a table. */ @@ -556,7 +601,7 @@ final class LocalDiskPanel extends JPanel { case 1: return NbBundle.getMessage(this.getClass(), "LocalDiskPanel.diskTable.column2.title"); default: - return "Unnamed"; //NON-NLS + return "Unnamed"; //NON-NLS } } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/LocalFilesDSProcessor.java b/Core/src/org/sleuthkit/autopsy/casemodule/LocalFilesDSProcessor.java index c3a55cbfbb..cfba224f1c 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/LocalFilesDSProcessor.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/LocalFilesDSProcessor.java @@ -31,6 +31,7 @@ import javax.swing.JPanel; import javax.swing.filechooser.FileFilter; import org.apache.commons.io.FilenameUtils; import org.openide.modules.InstalledFileLocator; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; import org.openide.util.lookup.ServiceProvider; @@ -166,6 +167,9 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat errors.add(ex.getMessage()); callback.done(DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS, errors, new ArrayList<>()); return; + } catch (NoCurrentCaseException ex) { + logger.log(Level.WARNING, "Exception while getting open case.", ex); + return; } } } @@ -184,7 +188,7 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat * @throws * org.sleuthkit.autopsy.casemodule.LocalFilesDSProcessor.L01Exception */ - private List extractLogicalEvidenceFileContents(final List logicalEvidenceFilePaths) throws L01Exception { + private List extractLogicalEvidenceFileContents(final List logicalEvidenceFilePaths) throws L01Exception, NoCurrentCaseException { final List extractedPaths = new ArrayList<>(); Path ewfexportPath; ewfexportPath = locateEwfexportExecutable(); @@ -195,7 +199,7 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat command.add("-f"); command.add("files"); command.add("-t"); - File l01Dir = new File(Case.getCurrentCase().getModuleDirectory(), L01_EXTRACTION_DIR); //WJS-TODO change to getOpenCase() when that method exists + File l01Dir = new File(Case.getOpenCase().getModuleDirectory(), L01_EXTRACTION_DIR); //WJS-TODO change to getOpenCase() when that method exists if (!l01Dir.exists()) { l01Dir.mkdirs(); } @@ -354,6 +358,9 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat logger.log(Level.WARNING, "File extension was .l01 but contents of logical evidence file were unable to be extracted", ex); //contents of l01 could not be extracted don't add data source or run ingest return 0; + } catch (NoCurrentCaseException ex) { + logger.log(Level.WARNING, "Exception while getting open case.", ex); + return 0; } } } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/LocalFilesPanel.form b/Core/src/org/sleuthkit/autopsy/casemodule/LocalFilesPanel.form index 3872db93e2..2780050228 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/LocalFilesPanel.form +++ b/Core/src/org/sleuthkit/autopsy/casemodule/LocalFilesPanel.form @@ -88,7 +88,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/LocalFilesPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/LocalFilesPanel.java index c4fedf6cac..b1554eb080 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/LocalFilesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/LocalFilesPanel.java @@ -164,7 +164,7 @@ final class LocalFilesPanel extends javax.swing.JPanel { .addComponent(selectedPathsScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(changeNameButton, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(changeNameButton) .addComponent(displayNameLabel)) .addGap(13, 13, 13) .addComponent(errorLabel) @@ -243,7 +243,7 @@ final class LocalFilesPanel extends javax.swing.JPanel { } /** * Get the path(s) which have been selected on this panel - * + * * @return a List of Strings representing the path(s) for the selected files or directories */ List getContentPaths() { @@ -275,23 +275,29 @@ final class LocalFilesPanel extends javax.swing.JPanel { * * @param paths Absolute paths to the selected data source */ + @NbBundle.Messages("LocalFilesPanel.pathValidation.error=WARNING: Exception while gettting opon case.") private void warnIfPathIsInvalid(final List pathsList) { errorLabel.setVisible(false); - final Case.CaseType currentCaseType = Case.getCurrentCase().getCaseType(); + try { + final Case.CaseType currentCaseType = Case.getOpenCase().getCaseType(); - for (String currentPath : pathsList) { - if (!PathValidator.isValid(currentPath, currentCaseType)) { - errorLabel.setVisible(true); - errorLabel.setText(NbBundle.getMessage(this.getClass(), "DataSourceOnCDriveError.text")); - return; + for (String currentPath : pathsList) { + if (!PathValidator.isValid(currentPath, currentCaseType)) { + errorLabel.setVisible(true); + errorLabel.setText(NbBundle.getMessage(this.getClass(), "DataSourceOnCDriveError.text")); + return; + } } + } catch (NoCurrentCaseException ex) { + errorLabel.setVisible(true); + errorLabel.setText(Bundle.LocalFilesPanel_pathValidation_error()); } } /** * Get the name given to this collection of local files and directories - * + * * @return a String which is the name for the file set. */ String getFileSetName() { diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/LogicalEvidenceFilePanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/LogicalEvidenceFilePanel.java index 106c5165f0..4e70d4b248 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/LogicalEvidenceFilePanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/LogicalEvidenceFilePanel.java @@ -32,6 +32,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; +import org.openide.util.Exceptions; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.PathValidator; @@ -178,7 +179,8 @@ final class LogicalEvidenceFilePanel extends javax.swing.JPanel implements Docum */ @Messages({ "LogicalEvidenceFilePanel.validatePanel.nonL01Error.text=Only files with the .l01 file extension are supported here.", - "LogicalEvidenceFilePanel.pathValidation.dataSourceOnCDriveError=Warning: Path to multi-user data source is on \"C:\" drive" + "LogicalEvidenceFilePanel.pathValidation.dataSourceOnCDriveError=Warning: Path to multi-user data source is on \"C:\" drive", + "LogicalEvidenceFilePanel.pathValidation.getOpenCase.Error=Warning: Exception while getting open case." }) boolean validatePanel() { errorLabel.setVisible(false); @@ -188,9 +190,15 @@ final class LogicalEvidenceFilePanel extends javax.swing.JPanel implements Docum return false; } // display warning if there is one (but don't disable "next" button) - if (!PathValidator.isValid(path, Case.getCurrentCase().getCaseType())) { + try { + if (!PathValidator.isValid(path, Case.getOpenCase().getCaseType())) { + errorLabel.setVisible(true); + errorLabel.setText(Bundle.LogicalEvidenceFilePanel_pathValidation_dataSourceOnCDriveError()); + return false; + } + } catch (NoCurrentCaseException ex) { errorLabel.setVisible(true); - errorLabel.setText(Bundle.LogicalEvidenceFilePanel_pathValidation_dataSourceOnCDriveError()); + errorLabel.setText(Bundle.LogicalEvidenceFilePanel_pathValidation_getOpenCase_Error()); return false; } //check the extension incase the path was manually entered diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/MultiUserCasesPanel.form b/Core/src/org/sleuthkit/autopsy/casemodule/MultiUserCasesPanel.form index beb38e312e..71810b7387 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/MultiUserCasesPanel.form +++ b/Core/src/org/sleuthkit/autopsy/casemodule/MultiUserCasesPanel.form @@ -28,9 +28,9 @@ - - - + + + diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/MultiUserCasesPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/MultiUserCasesPanel.java index a5a1f32879..7a1ca81862 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/MultiUserCasesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/MultiUserCasesPanel.java @@ -205,9 +205,9 @@ final class MultiUserCasesPanel extends JPanel{ .addComponent(caseExplorerScrollPane) .addGroup(layout.createSequentialGroup() .addComponent(searchLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 120, Short.MAX_VALUE) - .addComponent(bnOpenSingleUserCase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(226, 226, 226) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(bnOpenSingleUserCase, javax.swing.GroupLayout.PREFERRED_SIZE, 192, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(190, 190, 190) .addComponent(bnOpen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseVisualPanel1.form b/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseVisualPanel1.form index 5eb64d5756..2b3f85c0e6 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseVisualPanel1.form +++ b/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseVisualPanel1.form @@ -30,14 +30,14 @@ - - + + - - + + diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseVisualPanel1.java b/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseVisualPanel1.java index d736aae980..cd1179b52b 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseVisualPanel1.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseVisualPanel1.java @@ -281,7 +281,7 @@ final class NewCaseVisualPanel1 extends JPanel implements DocumentListener { .addComponent(caseDirTextField, javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(caseNameLabel) - .addGap(26, 26, 26) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(caseNameTextField)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -302,6 +302,9 @@ final class NewCaseVisualPanel1 extends JPanel implements DocumentListener { .addComponent(caseParentDirWarningLabel) .addGap(0, 0, Short.MAX_VALUE)))) ); + + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {caseDirLabel, caseNameLabel, caseTypeLabel}); + layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseWizardAction.java b/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseWizardAction.java index 89d527fcc1..2f806bcecc 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseWizardAction.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseWizardAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -91,9 +91,9 @@ final class NewCaseWizardAction extends CallableSystemAction { if (EamDb.isEnabled()) { //if the eam is enabled we need to save the case organization information now EamDb dbManager = EamDb.getInstance(); if (dbManager != null) { - CorrelationCase cRCase = dbManager.getCase(Case.getCurrentCase()); + CorrelationCase cRCase = dbManager.getCase(Case.getOpenCase()); if (cRCase == null) { - cRCase = dbManager.newCase(Case.getCurrentCase()); + cRCase = dbManager.newCase(Case.getOpenCase()); } if (!organizationName.isEmpty()) { for (EamOrganization org : dbManager.getOrganizations()) { diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/NoCurrentCaseException.java b/Core/src/org/sleuthkit/autopsy/casemodule/NoCurrentCaseException.java new file mode 100755 index 0000000000..b52efe8992 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/casemodule/NoCurrentCaseException.java @@ -0,0 +1,47 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2018 Basis Technology Corp. + * Contact: carrier sleuthkit 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.casemodule; + + +/** + * + * Exception thrown when no current case is available + */ +public class NoCurrentCaseException extends Exception { + private static final long serialVersionUID = 1L; + /** + * Constructs an exception with the specified message. + * + * @param message The exception message. + */ + public NoCurrentCaseException(String message) { + super(message); + } + + /** + * Constructs an exception with the specified message and cause. + * + * @param message The exception message. + * @param cause The exception cause. + */ + public NoCurrentCaseException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/OptionalCasePropertiesPanel.form b/Core/src/org/sleuthkit/autopsy/casemodule/OptionalCasePropertiesPanel.form index ff1b482e50..bf66012584 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/OptionalCasePropertiesPanel.form +++ b/Core/src/org/sleuthkit/autopsy/casemodule/OptionalCasePropertiesPanel.form @@ -59,15 +59,15 @@ + - - + - + - + @@ -172,21 +172,21 @@ - - + + - + - - - + + + - + @@ -356,27 +356,27 @@ - + - - - - + + + + - + - - - - - - - + + + + + + + @@ -394,10 +394,10 @@ - - + + - + diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/OptionalCasePropertiesPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/OptionalCasePropertiesPanel.java index a5b96595fd..c085250158 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/OptionalCasePropertiesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/OptionalCasePropertiesPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -62,12 +62,19 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel { OptionalCasePropertiesPanel(boolean editCurrentCase) { initComponents(); if (editCurrentCase) { - caseDisplayNameTextField.setText(Case.getCurrentCase().getDisplayName()); - caseNumberTextField.setText(Case.getCurrentCase().getNumber()); - examinerTextField.setText(Case.getCurrentCase().getExaminer()); - tfExaminerEmailText.setText(Case.getCurrentCase().getExaminerEmail()); - tfExaminerPhoneText.setText(Case.getCurrentCase().getExaminerPhone()); - taNotesText.setText(Case.getCurrentCase().getCaseNotes()); + Case openCase; + try { + openCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex); + return; + } + caseDisplayNameTextField.setText(openCase.getDisplayName()); + caseNumberTextField.setText(openCase.getNumber()); + examinerTextField.setText(openCase.getExaminer()); + tfExaminerEmailText.setText(openCase.getExaminerEmail()); + tfExaminerPhoneText.setText(openCase.getExaminerPhone()); + taNotesText.setText(openCase.getCaseNotes()); setUpCaseDetailsFields(); setUpOrganizationData(); } else { @@ -86,15 +93,18 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel { private void setUpOrganizationData() { if (EamDb.isEnabled()) { - Case currentCase = Case.getCurrentCase(); - if (currentCase != null) { - try { + try { + Case currentCase = Case.getOpenCase(); + if (currentCase != null) { EamDb dbManager = EamDb.getInstance(); selectedOrg = dbManager.getCase(currentCase).getOrg(); - } catch (EamDbException ex) { - LOGGER.log(Level.SEVERE, "Unable to get Organization associated with the case from Central Repo", ex); } + } catch (EamDbException ex) { + LOGGER.log(Level.SEVERE, "Unable to get Organization associated with the case from Central Repo", ex); + } catch (NoCurrentCaseException ex) { + LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex); } + if (selectedOrg != null) { setCurrentlySelectedOrganization(selectedOrg.getName()); } @@ -270,12 +280,12 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel { .addGroup(casePanelLayout.createSequentialGroup() .addContainerGap() .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(caseDisplayNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(caseNumberLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(caseNumberLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE) + .addComponent(caseDisplayNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(caseDisplayNameTextField) - .addComponent(caseNumberTextField)) + .addComponent(caseNumberTextField) + .addComponent(caseDisplayNameTextField)) .addContainerGap()) ); casePanelLayout.setVerticalGroup( @@ -338,20 +348,23 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel { .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lbNotesLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbExaminerPhoneLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(10, 10, 10) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(caseNotesScrollPane) .addComponent(tfExaminerPhoneText))) .addGroup(examinerPanelLayout.createSequentialGroup() - .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lbExaminerEmailLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(examinerLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(examinerLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(examinerTextField) .addComponent(tfExaminerEmailText)))) .addGap(11, 11, 11)) ); + + examinerPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {examinerLabel, lbExaminerEmailLabel, lbExaminerPhoneLabel, lbNotesLabel}); + examinerPanelLayout.setVerticalGroup( examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(examinerPanelLayout.createSequentialGroup() @@ -421,24 +434,27 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel { .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(orgainizationPanelLayout.createSequentialGroup() .addGap(106, 106, 106) - .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(lbPointOfContactNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lbPointOfContactPhoneLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(lbPointOfContactEmailLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGap(15, 15, 15) + .addComponent(lbPointOfContactEmailLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(lbPointOfContactNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lbPointOfContactPhoneText, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbPointOfContactNameText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbPointOfContactEmailText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(orgainizationPanelLayout.createSequentialGroup() .addContainerGap() - .addComponent(lbOrganizationNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(comboBoxOrgName, 0, 161, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(bnNewOrganization, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(lbOrganizationNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 206, Short.MAX_VALUE) + .addGap(18, 18, 18) + .addComponent(comboBoxOrgName, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(bnNewOrganization, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); + + orgainizationPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {lbPointOfContactEmailLabel, lbPointOfContactNameLabel, lbPointOfContactPhoneLabel}); + orgainizationPanelLayout.setVerticalGroup( orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(orgainizationPanelLayout.createSequentialGroup() @@ -449,8 +465,8 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel { .addComponent(bnNewOrganization, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(lbPointOfContactNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(lbPointOfContactNameText, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(lbPointOfContactNameText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(lbPointOfContactNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(lbPointOfContactPhoneLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/RecentCases.java b/Core/src/org/sleuthkit/autopsy/casemodule/RecentCases.java index 49e480450f..6aeb3338d4 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/RecentCases.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/RecentCases.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -374,8 +374,8 @@ final class RecentCases extends CallableSystemAction implements Presenter.Menu { int i = 0; String currentCaseName = null; try { - currentCaseName = Case.getCurrentCase().getDisplayName(); - } catch (IllegalStateException ex) { + currentCaseName = Case.getOpenCase().getDisplayName(); + } catch (NoCurrentCaseException ex) { // in case there is no current case. } @@ -407,8 +407,8 @@ final class RecentCases extends CallableSystemAction implements Presenter.Menu { String[] casePaths = new String[LENGTH]; String currentCasePath = null; try { - currentCasePath = Case.getCurrentCase().getMetadata().getFilePath().toString(); - } catch (IllegalStateException ex) { + currentCasePath = Case.getOpenCase().getMetadata().getFilePath().toString(); + } catch (NoCurrentCaseException ex) { /* * There may be no current case. */ diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/events/ContentTagAddedEvent.java b/Core/src/org/sleuthkit/autopsy/casemodule/events/ContentTagAddedEvent.java index 966138434a..c724dfa104 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/events/ContentTagAddedEvent.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/events/ContentTagAddedEvent.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2015 Basis Technology Corp. + * Copyright 2015-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.casemodule.events; import java.io.Serializable; import javax.annotation.concurrent.Immutable; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.datamodel.ContentTag; import org.sleuthkit.datamodel.TskCoreException; @@ -41,10 +42,10 @@ public class ContentTagAddedEvent extends TagAddedEvent implements S * * @return ContentTag that was added * - * @throws IllegalStateException + * @throws NoCurrentCaseException * @throws TskCoreException */ - ContentTag getTagByID() throws IllegalStateException, TskCoreException { - return Case.getCurrentCase().getServices().getTagsManager().getContentTagByTagID(getTagID()); + ContentTag getTagByID() throws NoCurrentCaseException, TskCoreException { + return Case.getOpenCase().getServices().getTagsManager().getContentTagByTagID(getTagID()); } } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/events/DataSourceAddedEvent.java b/Core/src/org/sleuthkit/autopsy/casemodule/events/DataSourceAddedEvent.java index aa02c07846..dcf575a5dc 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/events/DataSourceAddedEvent.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/events/DataSourceAddedEvent.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2015 Basis Technology Corp. + * Copyright 2015-2018 Basis Technology Corp. * Contact: carrier sleuthkit 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; } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/events/TagAddedEvent.java b/Core/src/org/sleuthkit/autopsy/casemodule/events/TagAddedEvent.java index 1f679c47a3..6d7ebb4f9c 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/events/TagAddedEvent.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/events/TagAddedEvent.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2015 Basis Technology Corp. + * Copyright 2015-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.casemodule.events; import java.io.Serializable; import java.util.logging.Level; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.events.AutopsyEvent; import org.sleuthkit.datamodel.Tag; @@ -84,7 +85,7 @@ abstract class TagAddedEvent extends AutopsyEvent implements Seri try { tag = getTagByID(); return tag; - } catch (IllegalStateException | TskCoreException ex) { + } catch (NoCurrentCaseException | TskCoreException ex) { Logger.getLogger(TagAddedEvent.class.getName()).log(Level.SEVERE, "Error doing lazy load for remote event", ex); //NON-NLS return null; } @@ -98,8 +99,8 @@ abstract class TagAddedEvent extends AutopsyEvent implements Seri * * @return the Tag based on the saved tag id * - * @throws IllegalStateException + * @throws NoCurrentCaseException * @throws TskCoreException */ - abstract T getTagByID() throws IllegalStateException, TskCoreException; + abstract T getTagByID() throws NoCurrentCaseException, TskCoreException; } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form index 8654d04598..48e10b74da 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form @@ -65,7 +65,7 @@ - + @@ -89,21 +89,14 @@ - - - - - - - - - - - - - - + + + + + + + @@ -117,7 +110,7 @@ - + @@ -266,14 +259,14 @@ - + - + - + - + @@ -293,10 +286,10 @@ - + - + diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java index 11d6495a39..874bcc77bc 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java @@ -122,7 +122,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel { jScrollPane2.setPreferredSize(new java.awt.Dimension(750, 490)); - jSplitPane1.setDividerLocation(365); + jSplitPane1.setDividerLocation(450); jSplitPane1.setDividerSize(1); jSplitPane1.setPreferredSize(new java.awt.Dimension(748, 488)); @@ -184,17 +184,13 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel { .addGroup(modifyTagTypesListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tagTypesListLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(modifyTagTypesListPanelLayout.createSequentialGroup() - .addGroup(modifyTagTypesListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(modifyTagTypesListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addComponent(TagNameScrollPane, javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, modifyTagTypesListPanelLayout.createSequentialGroup() - .addComponent(newTagNameButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(editTagNameButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(deleteTagNameButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addComponent(panelDescriptionScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 345, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(0, 0, Short.MAX_VALUE))) + .addComponent(newTagNameButton, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(editTagNameButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(deleteTagNameButton, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(TagNameScrollPane) + .addComponent(panelDescriptionScrollPane)) .addContainerGap()) ); @@ -208,7 +204,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tagTypesListLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(TagNameScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 338, Short.MAX_VALUE) + .addComponent(TagNameScrollPane) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(modifyTagTypesListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(newTagNameButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -248,14 +244,14 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel { .addGroup(tagTypesAdditionalPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(tagTypesAdditionalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(descriptionScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE) + .addComponent(descriptionScrollPane) .addGroup(tagTypesAdditionalPanelLayout.createSequentialGroup() .addGroup(tagTypesAdditionalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(descriptionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(descriptionLabel) .addGroup(tagTypesAdditionalPanelLayout.createSequentialGroup() - .addComponent(isNotableLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(isNotableLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(notableYesOrNoLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(notableYesOrNoLabel)) .addComponent(ingestRunningWarningLabel)) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) @@ -269,9 +265,9 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel { .addComponent(descriptionScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(tagTypesAdditionalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(isNotableLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(isNotableLabel) .addComponent(notableYesOrNoLabel)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 304, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 311, Short.MAX_VALUE) .addComponent(ingestRunningWarningLabel) .addGap(31, 31, 31)) ); diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java index 8d7eda2ec4..b38165ef5c 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,6 +29,7 @@ import java.util.Set; import java.util.logging.Level; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifactTag; @@ -98,11 +99,11 @@ public class TagsManager implements Closeable { tagDisplayNames.add(tagType.getDisplayName()); }); try { - TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager(); + TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager(); for (TagName tagName : tagsManager.getAllTagNames()) { tagDisplayNames.add(tagName.getDisplayName()); } - } catch (IllegalStateException ignored) { + } catch (NoCurrentCaseException ignored) { /* * No current case, nothing more to add to the set. */ @@ -339,8 +340,8 @@ public class TagsManager implements Closeable { ContentTag tag; tag = caseDb.addContentTag(content, tagName, comment, beginByteOffset, endByteOffset); try { - Case.getCurrentCase().notifyContentTagAdded(tag); - } catch (IllegalStateException ex) { + Case.getOpenCase().notifyContentTagAdded(tag); + } catch (NoCurrentCaseException ex) { throw new TskCoreException("Added a tag to a closed case", ex); } return tag; @@ -357,8 +358,8 @@ public class TagsManager implements Closeable { public void deleteContentTag(ContentTag tag) throws TskCoreException { caseDb.deleteContentTag(tag); try { - Case.getCurrentCase().notifyContentTagDeleted(tag); - } catch (IllegalStateException ex) { + Case.getOpenCase().notifyContentTagDeleted(tag); + } catch (NoCurrentCaseException ex) { throw new TskCoreException("Deleted a tag from a closed case", ex); } } @@ -469,8 +470,8 @@ 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.getCurrentCase().notifyBlackBoardArtifactTagAdded(tag); - } catch (IllegalStateException ex) { + Case.getOpenCase().notifyBlackBoardArtifactTagAdded(tag); + } catch (NoCurrentCaseException ex) { throw new TskCoreException("Added a tag to a closed case", ex); } return tag; @@ -487,8 +488,8 @@ public class TagsManager implements Closeable { public void deleteBlackboardArtifactTag(BlackboardArtifactTag tag) throws TskCoreException { caseDb.deleteBlackboardArtifactTag(tag); try { - Case.getCurrentCase().notifyBlackBoardArtifactTagDeleted(tag); - } catch (IllegalStateException ex) { + Case.getOpenCase().notifyBlackBoardArtifactTagDeleted(tag); + } catch (NoCurrentCaseException ex) { throw new TskCoreException("Deleted a tag from a closed case", ex); } } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationDataSource.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationDataSource.java index 9aa9fada32..cba529954e 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationDataSource.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationDataSource.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2017 Basis Technology Corp. + * Copyright 2015-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.centralrepository.datamodel; import java.io.Serializable; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskDataException; @@ -73,8 +74,8 @@ public class CorrelationDataSource implements Serializable { public static CorrelationDataSource fromTSKDataSource(CorrelationCase correlationCase, Content dataSource) throws EamDbException { Case curCase; try { - curCase = Case.getCurrentCase(); - } catch (IllegalStateException ex) { + curCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { throw new EamDbException("Autopsy case is closed"); } String deviceId; diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamArtifactUtil.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamArtifactUtil.java index c0810b52d3..43812eeebf 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamArtifactUtil.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamArtifactUtil.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2017 Basis Technology Corp. + * Copyright 2015-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,6 +23,7 @@ import java.util.List; import java.util.logging.Level; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; @@ -89,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.getCurrentCase(); + Case currentCase = Case.getOpenCase(); AbstractFile bbSourceFile = currentCase.getSleuthkitCase().getAbstractFileById(bbArtifact.getObjectID()); if (null == bbSourceFile) { //@@@ Log this @@ -97,9 +98,9 @@ public class EamArtifactUtil { } // make an instance for the BB source file - CorrelationCase correlationCase = EamDb.getInstance().getCase(Case.getCurrentCase()); + CorrelationCase correlationCase = EamDb.getInstance().getCase(Case.getOpenCase()); if (null == correlationCase) { - correlationCase = EamDb.getInstance().newCase(Case.getCurrentCase()); + correlationCase = EamDb.getInstance().newCase(Case.getOpenCase()); } CorrelationAttributeInstance eamInstance = new CorrelationAttributeInstance( correlationCase, @@ -116,7 +117,7 @@ public class EamArtifactUtil { } catch (TskCoreException | EamDbException ex) { LOGGER.log(Level.SEVERE, "Error creating artifact instance.", ex); // NON-NLS return eamArtifacts; - } catch (IllegalStateException ex) { + } catch (NoCurrentCaseException ex) { LOGGER.log(Level.SEVERE, "Case is closed.", ex); // NON-NLS return eamArtifacts; } @@ -145,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.getCurrentCase().getSleuthkitCase().getBlackboardArtifact(attribute.getValueLong()); + BlackboardArtifact associatedArtifact = Case.getOpenCase().getSleuthkitCase().getBlackboardArtifact(attribute.getValueLong()); return EamArtifactUtil.getCorrelationAttributeFromBlackboardArtifact(correlationType, associatedArtifact); } @@ -203,6 +204,9 @@ public class EamArtifactUtil { } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error getting attribute while getting type from BlackboardArtifact.", ex); // NON-NLS return null; + } catch (NoCurrentCaseException ex) { + LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex); // NON-NLS + return null; } if (null != value) { @@ -250,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.getCurrentCase()); + CorrelationCase correlationCase = EamDb.getInstance().getCase(Case.getOpenCase()); if (null == correlationCase) { - correlationCase = EamDb.getInstance().newCase(Case.getCurrentCase()); + correlationCase = EamDb.getInstance().newCase(Case.getOpenCase()); } CorrelationAttributeInstance cei = new CorrelationAttributeInstance( correlationCase, @@ -263,7 +267,7 @@ public class EamArtifactUtil { ); eamArtifact.addInstance(cei); return eamArtifact; - } catch (TskCoreException | EamDbException ex) { + } catch (TskCoreException | EamDbException | NoCurrentCaseException ex) { LOGGER.log(Level.SEVERE, "Error making correlation attribute.", ex); return null; } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java index b053d9df17..da11671a08 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2017 Basis Technology Corp. + * Copyright 2015-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,6 +28,7 @@ import java.util.logging.Level; import java.util.stream.Collectors; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; +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; @@ -162,8 +163,8 @@ final class CaseEventListener implements PropertyChangeListener { try { // Get the remaining tags on the content object - Content content = Case.getCurrentCase().getSleuthkitCase().getContentById(contentID); - TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager(); + Content content = Case.getOpenCase().getSleuthkitCase().getContentById(contentID); + TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager(); List tags = tagsManager.getContentTagsByContent(content); if (tags.stream() @@ -185,7 +186,7 @@ final class CaseEventListener implements PropertyChangeListener { // There's still at least one bad tag, so leave the known status as is return; } - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { LOGGER.log(Level.SEVERE, "Failed to find content", ex); return; } @@ -241,6 +242,13 @@ final class CaseEventListener implements PropertyChangeListener { return; } } else { //BLACKBOARD_ARTIFACT_TAG_DELETED + Case openCase; + try { + openCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex); + return; + } // For deleted tags, we want to set the file status to UNKNOWN if: // - The tag that was just removed is notable in central repo // - There are no remaining tags that are notable @@ -256,9 +264,9 @@ final class CaseEventListener implements PropertyChangeListener { try { // Get the remaining tags on the artifact - content = Case.getCurrentCase().getSleuthkitCase().getContentById(contentID); - bbArtifact = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifact(artifactID); - TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager(); + content = openCase.getSleuthkitCase().getContentById(contentID); + bbArtifact = openCase.getSleuthkitCase().getBlackboardArtifact(artifactID); + TagsManager tagsManager = openCase.getServices().getTagsManager(); List tags = tagsManager.getBlackboardArtifactTagsByArtifact(bbArtifact); if (tags.stream() @@ -319,10 +327,10 @@ final class CaseEventListener implements PropertyChangeListener { * that are tagged with the given tag name. */ try { - TagName tagName = Case.getCurrentCase().getServices().getTagsManager().getDisplayNamesToTagNamesMap().get(modifiedTagName); + TagName tagName = Case.getOpenCase().getServices().getTagsManager().getDisplayNamesToTagNamesMap().get(modifiedTagName); //First update the artifacts //Get all BlackboardArtifactTags with this tag name - List artifactTags = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifactTagsByTagName(tagName); + List artifactTags = Case.getOpenCase().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; @@ -338,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.getCurrentCase().getServices().getTagsManager(); + TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager(); List tags = tagsManager.getBlackboardArtifactTagsByArtifact(bbArtifact); //get all tags which are on this blackboard artifact for (BlackboardArtifactTag t : tags) { @@ -366,7 +374,7 @@ final class CaseEventListener implements PropertyChangeListener { } // Next update the files - List fileTags = Case.getCurrentCase().getSleuthkitCase().getContentTagsByTagName(tagName); + List fileTags = Case.getOpenCase().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 @@ -376,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.getCurrentCase().getServices().getTagsManager(); + TagsManager tagsManager = Case.getOpenCase().getServices().getTagsManager(); List tags = tagsManager.getContentTagsByContent(content); //get all tags which are on this file for (ContentTag t : tags) { @@ -405,6 +413,8 @@ final class CaseEventListener implements PropertyChangeListener { LOGGER.log(Level.SEVERE, "Cannot update known status in central repository for tag: " + modifiedTagName, ex); //NON-NLS } catch (EamDbException ex) { LOGGER.log(Level.SEVERE, "Cannot get central repository for tag: " + modifiedTagName, ex); //NON-NLS + } catch (NoCurrentCaseException ex) { + LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS } } //TAG_STATUS_CHANGED } @@ -424,15 +434,22 @@ final class CaseEventListener implements PropertyChangeListener { if (!EamDb.isEnabled()) { return; } + Case openCase; + try { + openCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex); + return; + } final DataSourceAddedEvent dataSourceAddedEvent = (DataSourceAddedEvent) event; Content newDataSource = dataSourceAddedEvent.getDataSource(); try { - String deviceId = Case.getCurrentCase().getSleuthkitCase().getDataSource(newDataSource.getId()).getDeviceId(); - CorrelationCase correlationCase = dbManager.getCase(Case.getCurrentCase()); + String deviceId = openCase.getSleuthkitCase().getDataSource(newDataSource.getId()).getDeviceId(); + CorrelationCase correlationCase = dbManager.getCase(openCase); if (null == correlationCase) { - correlationCase = dbManager.newCase(Case.getCurrentCase()); + correlationCase = dbManager.newCase(openCase); } if (null == dbManager.getDataSource(correlationCase, deviceId)) { dbManager.newDataSource(CorrelationDataSource.fromTSKDataSource(correlationCase, newDataSource)); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java index 0877bc1685..258cb13dcf 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2017 Basis Technology Corp. + * Copyright 2015-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,6 +32,7 @@ import java.util.logging.Level; import java.util.stream.Collectors; import org.openide.util.NbBundle; 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.ingest.IngestManager; @@ -144,9 +145,9 @@ public class IngestEventsListener { tifArtifact.addAttributes(attributes); try { // index the artifact for keyword search - Blackboard blackboard = Case.getCurrentCase().getServices().getBlackboard(); + Blackboard blackboard = Case.getOpenCase().getServices().getBlackboard(); blackboard.indexArtifact(tifArtifact); - } catch (Blackboard.BlackboardException ex) { + } catch (Blackboard.BlackboardException | NoCurrentCaseException ex) { LOGGER.log(Level.SEVERE, "Unable to index blackboard artifact " + tifArtifact.getArtifactID(), ex); //NON-NLS } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/IngestModule.java b/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/IngestModule.java index 09f3c63449..9657cdcd19 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/IngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/IngestModule.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,6 +26,7 @@ import java.util.stream.Collectors; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.Blackboard; import org.sleuthkit.autopsy.core.RuntimeProperties; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; @@ -79,7 +80,12 @@ class IngestModule implements FileIngestModule { return ProcessResult.OK; } - blackboard = Case.getCurrentCase().getServices().getBlackboard(); + try { + blackboard = Case.getOpenCase().getServices().getBlackboard(); + } catch (NoCurrentCaseException ex) { + LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex); + return ProcessResult.ERROR; + } if (!EamArtifactUtil.isValidCentralRepoFile(af)) { return ProcessResult.OK; @@ -190,8 +196,16 @@ class IngestModule implements FileIngestModule { } return; } + Case autopsyCase; + try { + autopsyCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex); + throw new IngestModuleException("Exception while getting open case.", ex); + } + // Don't allow sqlite central repo databases to be used for multi user cases - if ((Case.getCurrentCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) + if ((autopsyCase.getCaseType() == Case.CaseType.MULTI_USER_CASE) && (EamDbPlatformEnum.getSelectedPlatform() == EamDbPlatformEnum.SQLITE)) { LOGGER.log(Level.SEVERE, "Cannot run correlation engine on a multi-user case with a SQLite central repository."); throw new IngestModuleException("Cannot run on a multi-user case with a SQLite central repository."); // NON-NLS @@ -212,7 +226,7 @@ class IngestModule implements FileIngestModule { LOGGER.log(Level.SEVERE, "Error getting correlation type FILES in ingest module start up.", ex); // NON-NLS throw new IngestModuleException("Error getting correlation type FILES in ingest module start up.", ex); // NON-NLS } - Case autopsyCase = Case.getCurrentCase(); + try { eamCase = centralRepoDb.getCase(autopsyCase); } catch (EamDbException ex) { diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/AddNewOrganizationDialog.form b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/AddNewOrganizationDialog.form index 1a4c8e4966..649c7d2df6 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/AddNewOrganizationDialog.form +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/AddNewOrganizationDialog.form @@ -49,7 +49,7 @@ - + @@ -68,7 +68,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/AddNewOrganizationDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/AddNewOrganizationDialog.java index 4bed9b319f..5ebfd1a629 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/AddNewOrganizationDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/AddNewOrganizationDialog.java @@ -280,7 +280,7 @@ public class AddNewOrganizationDialog extends javax.swing.JDialog { .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(lbOrganizationName, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(lbOrganizationName) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tfOrganizationName)) .addGroup(layout.createSequentialGroup() @@ -294,7 +294,7 @@ public class AddNewOrganizationDialog extends javax.swing.JDialog { .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(lbOrganizationName, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(lbOrganizationName) .addComponent(tfOrganizationName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lbPocHeading) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.form b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.form index 0d925df9e1..ea06641799 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.form +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.form @@ -44,7 +44,7 @@ - + @@ -120,12 +120,12 @@ - + - + @@ -133,7 +133,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java index 926ac8c286..aaf6c6b4f7 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java @@ -232,18 +232,18 @@ public class EamDbSettingsDialog extends JDialog { .addComponent(lbHostName) .addComponent(lbPort) .addComponent(lbUserName) - .addComponent(lbDatabaseType, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(lbDatabaseType) .addGroup(pnSQLiteSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(lbDatabasePath, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbUserPassword, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addComponent(lbDatabaseDesc, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(lbDatabaseDesc)) .addGap(10, 10, 10) .addGroup(pnSQLiteSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lbFullDbPath, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(pnSQLiteSettingsLayout.createSequentialGroup() .addComponent(cbDatabaseType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(lbSingleUserSqLite, javax.swing.GroupLayout.DEFAULT_SIZE, 467, Short.MAX_VALUE) + .addComponent(lbSingleUserSqLite, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(9, 9, 9)) .addGroup(pnSQLiteSettingsLayout.createSequentialGroup() .addComponent(tfDatabasePath) @@ -317,7 +317,7 @@ public class EamDbSettingsDialog extends JDialog { .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(pnSQLiteSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pnButtons, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(10, 10, 10)) ); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form index 53f65a4e6c..c53942cc0c 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form @@ -25,11 +25,11 @@ - + - + - + @@ -44,7 +44,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -208,7 +208,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java index 0015dbaf81..8b0a1b6b93 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java @@ -167,7 +167,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i .addGroup(pnDatabaseConfigurationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(lbDbPlatformTypeLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbDbNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(lbDbLocationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(lbDbLocationLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(pnDatabaseConfigurationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lbDbNameValue, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -237,7 +237,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i .addGroup(pnCorrelationPropertiesLayout.createSequentialGroup() .addContainerGap() .addGroup(pnCorrelationPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(correlationPropertiesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 642, Short.MAX_VALUE) + .addComponent(correlationPropertiesScrollPane) .addGroup(pnCorrelationPropertiesLayout.createSequentialGroup() .addComponent(bnManageTypes) .addGap(0, 0, Short.MAX_VALUE))) @@ -310,11 +310,11 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i .addComponent(tbOops, javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(organizationPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(organizationPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addComponent(lbCentralRepository, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pnCorrelationProperties, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pnCorrelationProperties, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE) .addComponent(pnDatabaseConfiguration, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(cbUseCentralRepo, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(cbUseCentralRepo, javax.swing.GroupLayout.Alignment.LEADING)) .addContainerGap()))) ); layout.setVerticalGroup( @@ -324,7 +324,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cbUseCentralRepo) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pnDatabaseConfiguration, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(pnDatabaseConfiguration, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0) .addComponent(pnCorrelationProperties, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.form b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.form index 0655ced314..7bccab25f6 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.form +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.form @@ -3,11 +3,12 @@
- + - + + @@ -66,7 +67,7 @@ - + @@ -106,7 +107,7 @@ - + @@ -140,7 +141,7 @@ - + @@ -149,7 +150,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java index ccf98bd858..3f3e89f5d5 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java @@ -155,7 +155,7 @@ public final class ManageOrganizationsDialog extends JDialog { editButton = new javax.swing.JButton(); orgDetailsLabel = new javax.swing.JLabel(); - setMinimumSize(new java.awt.Dimension(545, 450)); + setMinimumSize(new java.awt.Dimension(545, 415)); manageOrganizationsScrollPane.setMinimumSize(null); manageOrganizationsScrollPane.setPreferredSize(new java.awt.Dimension(535, 415)); @@ -244,7 +244,7 @@ public final class ManageOrganizationsDialog extends JDialog { .addContainerGap() .addGroup(manageOrganizationsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(orgDescriptionScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(orgListLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(orgListLabel) .addGroup(manageOrganizationsPanelLayout.createSequentialGroup() .addComponent(newButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -276,7 +276,7 @@ public final class ManageOrganizationsDialog extends JDialog { .addContainerGap()) .addGroup(manageOrganizationsPanelLayout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(orgDetailsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(orgDetailsLabel) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) ); manageOrganizationsPanelLayout.setVerticalGroup( @@ -302,7 +302,7 @@ public final class ManageOrganizationsDialog extends JDialog { .addGroup(manageOrganizationsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(pocEmailTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pocEmailLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 235, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(closeButton)) .addComponent(jSeparator1) .addGroup(manageOrganizationsPanelLayout.createSequentialGroup() @@ -310,7 +310,7 @@ public final class ManageOrganizationsDialog extends JDialog { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(orgListLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(orgListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE) + .addComponent(orgListScrollPane) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(manageOrganizationsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(newButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -335,6 +335,8 @@ public final class ManageOrganizationsDialog extends JDialog { .addGap(0, 0, 0) .addComponent(manageOrganizationsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); + + pack(); }// //GEN-END:initComponents private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountsRootChildren.java b/Core/src/org/sleuthkit/autopsy/communications/AccountsRootChildren.java index 63e1e17d82..d15feb83d6 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountsRootChildren.java +++ b/Core/src/org/sleuthkit/autopsy/communications/AccountsRootChildren.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2017 Basis Technology Corp. + * Copyright 2017-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,6 +30,7 @@ import org.openide.nodes.Sheet; 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.datamodel.NodeProperty; import org.sleuthkit.datamodel.Account; import org.sleuthkit.datamodel.AccountDeviceInstance; @@ -76,13 +77,13 @@ class AccountsRootChildren extends ChildFactory { private String getDataSourceName(AccountDeviceInstance accountDeviceInstance) { try { - final SleuthkitCase sleuthkitCase = Case.getCurrentCase().getSleuthkitCase(); + final SleuthkitCase sleuthkitCase = Case.getOpenCase().getSleuthkitCase(); for (DataSource dataSource : sleuthkitCase.getDataSources()) { if (dataSource.getDeviceId().equals(accountDeviceInstance.getDeviceId())) { return sleuthkitCase.getContentById(dataSource.getId()).getName(); } } - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Error getting datasource name, falling back on device ID.", ex); } return accountDeviceInstance.getDeviceId(); diff --git a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.form b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.form index df30cb548f..5e8450d171 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.form +++ b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.form @@ -18,9 +18,9 @@ - + - + diff --git a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java index 1c0582a300..ab240e6687 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java @@ -94,9 +94,9 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(6, 6, 6) - .addComponent(filtersPane, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(filtersPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1339, Short.MAX_VALUE) + .addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1277, Short.MAX_VALUE) .addGap(0, 0, 0)) ); layout.setVerticalGroup( diff --git a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.form b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.form index 25153de997..e7fa50618f 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.form +++ b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.form @@ -21,7 +21,7 @@ - + @@ -76,9 +76,6 @@ - - - @@ -313,14 +310,14 @@ - - - + + + - - - + + + @@ -399,12 +396,12 @@ - - - + + + diff --git a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java index 84db631a86..3d6766cdeb 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java +++ b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2017 Basis Technology Corp. + * Copyright 2017-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,6 +36,7 @@ import org.openide.nodes.Children; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import static org.sleuthkit.autopsy.casemodule.Case.Events.CURRENT_CASE; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ThreadConfined; @@ -198,7 +199,7 @@ final public class FiltersPanel extends javax.swing.JPanel { //TODO: something like this commented code could be used to show only //the account types that are found: - //final CommunicationsManager communicationsManager = Case.getCurrentCase().getSleuthkitCase().getCommunicationsManager(); + //final CommunicationsManager communicationsManager = Case.getOpenCase().getSleuthkitCase().getCommunicationsManager(); //List accountTypesInUse = communicationsManager.getAccountTypesInUse(); //accountTypesInUSe.forEach(...) Account.Type.PREDEFINED_ACCOUNT_TYPES.forEach(type -> { @@ -229,7 +230,7 @@ final public class FiltersPanel extends javax.swing.JPanel { */ private void updateDeviceFilter() { try { - final SleuthkitCase sleuthkitCase = Case.getCurrentCase().getSleuthkitCase(); + final SleuthkitCase sleuthkitCase = Case.getOpenCase().getSleuthkitCase(); for (DataSource dataSource : sleuthkitCase.getDataSources()) { String dsName = sleuthkitCase.getContentById(dataSource.getId()).getName(); @@ -242,7 +243,7 @@ final public class FiltersPanel extends javax.swing.JPanel { }); }; - } catch (IllegalStateException ex) { + } catch (NoCurrentCaseException ex) { logger.log(Level.WARNING, "Communications Visualization Tool opened with no open case.", ex); } catch (TskCoreException tskCoreException) { logger.log(Level.SEVERE, "There was a error loading the datasources for the case.", tskCoreException); @@ -264,7 +265,6 @@ final public class FiltersPanel extends javax.swing.JPanel { filtersTitleLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/funnel.png"))); // NOI18N filtersTitleLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.filtersTitleLabel.text")); // NOI18N - filtersTitleLabel.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N unCheckAllAccountTypesButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.unCheckAllAccountTypesButton.text")); // NOI18N unCheckAllAccountTypesButton.addActionListener(new java.awt.event.ActionListener() { @@ -421,13 +421,16 @@ final public class FiltersPanel extends javax.swing.JPanel { .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addComponent(endCheckBox) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(endDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(12, 12, 12) + .addComponent(endDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(startCheckBox) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(startDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addGap(12, 12, 12) + .addComponent(startDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) ); + + jPanel4Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {endCheckBox, startCheckBox}); + jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() @@ -445,8 +448,8 @@ final public class FiltersPanel extends javax.swing.JPanel { refreshButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/arrow-circle-double-135.png"))); // NOI18N refreshButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.refreshButton.text")); // NOI18N - needsRefreshLabel.setForeground(new java.awt.Color(255, 0, 0)); needsRefreshLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.needsRefreshLabel.text")); // NOI18N + needsRefreshLabel.setForeground(new java.awt.Color(255, 0, 0)); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); @@ -457,7 +460,7 @@ final public class FiltersPanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addComponent(filtersTitleLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(applyFiltersButton, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(applyFiltersButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(refreshButton)) .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -498,10 +501,12 @@ final public class FiltersPanel extends javax.swing.JPanel { ImmutableSet.of(CALL_LOG, MESSAGE))); try { - final CommunicationsManager commsManager = Case.getCurrentCase().getSleuthkitCase().getCommunicationsManager(); + final CommunicationsManager commsManager = Case.getOpenCase().getSleuthkitCase().getCommunicationsManager(); em.setRootContext(new AbstractNode(Children.create(new AccountsRootChildren(commsManager, commsFilter), true))); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "There was an error getting the CommunicationsManager for the current case.", ex); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", ex); } needsRefresh = false; diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/FileViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/FileViewer.java index c4bb4a3fc8..395f2aa7e5 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/FileViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/FileViewer.java @@ -47,7 +47,6 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer // TBD: This hardcoded list of viewers should be replaced with a dynamic lookup private static final FileTypeViewer[] KNOWN_VIEWERS = new FileTypeViewer[]{ - // new JPEGViewerDummy(), // this if for testing only new SQLiteViewer(), new PListViewer(), new MediaFileViewer() diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/JPEGViewerDummy.form b/Core/src/org/sleuthkit/autopsy/contentviewers/JPEGViewerDummy.form deleted file mode 100644 index 587dd3c9a0..0000000000 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/JPEGViewerDummy.form +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/JPEGViewerDummy.java b/Core/src/org/sleuthkit/autopsy/contentviewers/JPEGViewerDummy.java deleted file mode 100644 index 479eefab99..0000000000 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/JPEGViewerDummy.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.sleuthkit.autopsy.contentviewers; - - -import java.awt.Component; -import java.util.Arrays; -import java.util.List; -import org.sleuthkit.datamodel.AbstractFile; -import org.sleuthkit.autopsy.corecomponentinterfaces.FileTypeViewer; - -public class JPEGViewerDummy extends javax.swing.JPanel implements FileTypeViewer { - - public static final String[] SUPPORTED_MIMETYPES = new String[]{"image/jpeg"}; - - /** - * Creates new form JPEGViewer - */ - public JPEGViewerDummy() { - initComponents(); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - - jLabel1 = new javax.swing.JLabel(); - jTextField1 = new javax.swing.JTextField(); - - org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(JPEGViewerDummy.class, "JPEGViewerDummy.jLabel1.text")); // NOI18N - - jTextField1.setEditable(false); - jTextField1.setText(org.openide.util.NbBundle.getMessage(JPEGViewerDummy.class, "JPEGViewerDummy.jTextField1.text")); // NOI18N - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(43, 43, 43) - .addComponent(jLabel1) - .addGap(35, 35, 35) - .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(120, Short.MAX_VALUE)) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel1) - .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(269, Short.MAX_VALUE)) - ); - }// //GEN-END:initComponents - - @Override - public List getSupportedMIMETypes() { - return Arrays.asList(SUPPORTED_MIMETYPES); - } - - @Override - public Component getComponent() { - return this; - } - - @Override - public void resetComponent() { - this.jTextField1.setText(""); - } - - @Override - public void setFile(AbstractFile file) { - this.jTextField1.setText(file.getName()); - } - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JLabel jLabel1; - private javax.swing.JTextField jTextField1; - // End of variables declaration//GEN-END:variables - -} diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/PListViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/PListViewer.java index 64c5db3542..f3d630eaf3 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/PListViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/PListViewer.java @@ -54,6 +54,7 @@ import org.openide.nodes.Children; import org.openide.util.NbBundle; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.TskCoreException; import org.xml.sax.SAXException; @@ -189,8 +190,21 @@ public class PListViewer extends javax.swing.JPanel implements FileTypeViewer, E */ private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed + Case openCase; + try { + openCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + JOptionPane.showMessageDialog(this, + "Failed to export plist file.", + Bundle.PListViewer_ExportFailed_message(), + JOptionPane.ERROR_MESSAGE); + + LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex); + return; + } + final JFileChooser fileChooser = new JFileChooser(); - fileChooser.setCurrentDirectory(new File(Case.getCurrentCase().getExportDirectory())); + fileChooser.setCurrentDirectory(new File(openCase.getExportDirectory())); fileChooser.setFileFilter(new FileNameExtensionFilter("XML file", "xml")); final int returnVal = fileChooser.showSaveDialog(this); diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/SQLiteViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/SQLiteViewer.java index d7ee98896a..4e8fb1fe80 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/SQLiteViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/SQLiteViewer.java @@ -44,6 +44,7 @@ import javax.swing.SwingWorker; import org.openide.util.NbBundle; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.FileManager; import org.sleuthkit.autopsy.casemodule.services.Services; import org.sleuthkit.autopsy.coreutils.Logger; @@ -329,7 +330,7 @@ public class SQLiteViewer extends javax.swing.JPanel implements FileTypeViewer { try { // Copy the file to temp folder - tmpDBPathName = Case.getCurrentCase().getTempDirectory() + File.separator + sqliteFile.getName(); + tmpDBPathName = Case.getOpenCase().getTempDirectory() + File.separator + sqliteFile.getName(); tmpDBFile = new File(tmpDBPathName); ContentUtils.writeToFile(sqliteFile, tmpDBFile); @@ -342,7 +343,9 @@ public class SQLiteViewer extends javax.swing.JPanel implements FileTypeViewer { connection = DriverManager.getConnection("jdbc:sqlite:" + tmpDBPathName); //NON-NLS // Read all table names and schema - getTables(); + return getTables(); + } catch (NoCurrentCaseException ex) { + LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS } catch (IOException ex) { LOGGER.log(Level.SEVERE, "Failed to copy DB file " + sqliteFile.getName(), ex); //NON-NLS throw ex; @@ -401,8 +404,14 @@ public class SQLiteViewer extends javax.swing.JPanel implements FileTypeViewer { * @return true if the meta file is found and copied successfully, false otherwise */ private boolean findAndCopySQLiteMetaFile(AbstractFile sqliteFile, String metaFileName ) { - - SleuthkitCase sleuthkitCase = Case.getCurrentCase().getSleuthkitCase(); + Case openCase; + try { + openCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS + return false; + } + SleuthkitCase sleuthkitCase = openCase.getSleuthkitCase(); Services services = new Services(sleuthkitCase); FileManager fileManager = services.getFileManager(); @@ -416,7 +425,7 @@ public class SQLiteViewer extends javax.swing.JPanel implements FileTypeViewer { if (metaFiles != null) { for (AbstractFile metaFile: metaFiles) { - String tmpMetafilePathName = Case.getCurrentCase().getTempDirectory() + File.separator + metaFile.getName(); + String tmpMetafilePathName = openCase.getTempDirectory() + File.separator + metaFile.getName(); File tmpMetafile = new File(tmpMetafilePathName); try { diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/AboutWindowPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/AboutWindowPanel.java index 3584cb5211..9506058b66 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/AboutWindowPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/AboutWindowPanel.java @@ -116,7 +116,7 @@ public final class AboutWindowPanel extends JPanel implements HyperlinkListener jScrollPane2.setViewportView(description); verboseLoggingButton.setBackground(new java.awt.Color(255, 255, 255)); - verboseLoggingButton.setText(NbBundle.getMessage(this.getClass(), "AboutWindowPanel.actVerboseLogging.text")); + verboseLoggingButton.setText("Activate verbose logging"); verboseLoggingButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { activateVerboseLogging(evt); diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.form b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.form index 36b88c10ca..0ee7b6314e 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.form @@ -100,15 +100,15 @@ - - + + - + @@ -449,34 +449,34 @@ - + - + - + - + - + - + - + - + - + - + @@ -492,23 +492,23 @@ - - + + - + - + - + - + diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java index d86e97d11c..51a374260a 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java @@ -620,14 +620,14 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, logoPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(specifyLogoRB, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(defaultLogoRB, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(specifyLogoRB) + .addComponent(defaultLogoRB)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(logoPanelLayout.createSequentialGroup() .addComponent(agencyLogoPathField, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(browseLogosButton, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(browseLogosButton)) .addComponent(agencyLogoPathFieldValidationLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(agencyLogoPreview, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -830,33 +830,38 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { .addContainerGap() .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(runtimePanelLayout.createSequentialGroup() - .addComponent(totalMemoryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(totalMemoryLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(systemMemoryTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(2, 2, 2) + .addGap(6, 6, 6) .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(runtimePanelLayout.createSequentialGroup() - .addComponent(maxMemoryUnitsLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(maxMemoryUnitsLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(restartNecessaryWarning, javax.swing.GroupLayout.DEFAULT_SIZE, 333, Short.MAX_VALUE)) + .addComponent(restartNecessaryWarning, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(runtimePanelLayout.createSequentialGroup() - .addComponent(maxMemoryUnitsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(maxMemoryUnitsLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(memFieldValidationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(memFieldValidationLabel) .addGap(0, 0, Short.MAX_VALUE)))) .addGroup(runtimePanelLayout.createSequentialGroup() - .addComponent(maxMemoryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(maxMemoryLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(memField, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(runtimePanelLayout.createSequentialGroup() - .addComponent(maxLogFileCount, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(maxLogFileCount) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(logFileCount, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(logNumAlert))) .addContainerGap()) ); + + runtimePanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {maxLogFileCount, maxMemoryLabel, totalMemoryLabel}); + + runtimePanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {logFileCount, memField}); + runtimePanelLayout.setVerticalGroup( runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(runtimePanelLayout.createSequentialGroup() @@ -864,19 +869,19 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(totalMemoryLabel) .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(restartNecessaryWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(maxMemoryUnitsLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(restartNecessaryWarning) + .addComponent(maxMemoryUnitsLabel1)) .addComponent(systemMemoryTotal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(maxMemoryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(maxMemoryLabel) .addComponent(memField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(maxMemoryUnitsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(memFieldValidationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(maxMemoryUnitsLabel)) + .addComponent(memFieldValidationLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(maxLogFileCount, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(maxLogFileCount) .addComponent(logFileCount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(logNumAlert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.form b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.form index 8e379954e9..d6bce85869 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.form +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.form @@ -67,7 +67,7 @@ - + @@ -75,18 +75,18 @@ - + - + - + @@ -112,7 +112,7 @@ - + @@ -155,15 +155,6 @@ - - - - - - - - - @@ -204,9 +195,6 @@ - - - diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java index c4f35e9b8a..f57827e4f0 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java @@ -230,9 +230,6 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat currentPageLabel.setPreferredSize(new java.awt.Dimension(18, 14)); pageLabel.setText(org.openide.util.NbBundle.getMessage(DataContentViewerArtifact.class, "DataContentViewerArtifact.pageLabel.text")); // NOI18N - pageLabel.setMaximumSize(new java.awt.Dimension(33, 14)); - pageLabel.setMinimumSize(new java.awt.Dimension(33, 14)); - pageLabel.setPreferredSize(new java.awt.Dimension(33, 14)); nextPageButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_forward.png"))); // NOI18N nextPageButton.setText(org.openide.util.NbBundle.getMessage(DataContentViewerArtifact.class, "DataContentViewerArtifact.nextPageButton.text")); // NOI18N @@ -251,7 +248,6 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat pageLabel2.setText(org.openide.util.NbBundle.getMessage(DataContentViewerArtifact.class, "DataContentViewerArtifact.pageLabel2.text")); // NOI18N pageLabel2.setMaximumSize(new java.awt.Dimension(29, 14)); pageLabel2.setMinimumSize(new java.awt.Dimension(29, 14)); - pageLabel2.setPreferredSize(new java.awt.Dimension(29, 14)); prevPageButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back.png"))); // NOI18N prevPageButton.setText(org.openide.util.NbBundle.getMessage(DataContentViewerArtifact.class, "DataContentViewerArtifact.prevPageButton.text")); // NOI18N @@ -276,7 +272,7 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() - .addComponent(pageLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(pageLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(currentPageLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) @@ -284,17 +280,17 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(totalPageLabel) .addGap(41, 41, 41) - .addComponent(pageLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(pageLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(prevPageButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0) .addComponent(nextPageButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(366, Short.MAX_VALUE)) + .addContainerGap(334, Short.MAX_VALUE)) .addComponent(resultsTableScrollPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap(280, Short.MAX_VALUE) - .addComponent(artifactLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 258, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(artifactLabel) .addContainerGap(84, Short.MAX_VALUE))) ); jPanel1Layout.setVerticalGroup( @@ -302,7 +298,7 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(pageLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(pageLabel) .addComponent(currentPageLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(ofLabel) .addComponent(totalPageLabel)) @@ -314,7 +310,7 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat .addGap(0, 0, 0)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(artifactLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(artifactLabel) .addGap(0, 401, Short.MAX_VALUE))) ); diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.form b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.form index acbf07db40..69f92968a3 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.form +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.form @@ -45,7 +45,7 @@ - + @@ -147,9 +147,6 @@ - - - @@ -163,9 +160,6 @@ - - - @@ -233,9 +227,6 @@ - - - diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.java index 7a4df69e9d..31888037b7 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.java @@ -128,12 +128,10 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont currentPageLabel.setText(org.openide.util.NbBundle.getMessage(DataContentViewerHex.class, "DataContentViewerHex.currentPageLabel.text_1")); // NOI18N currentPageLabel.setMaximumSize(new java.awt.Dimension(18, 14)); currentPageLabel.setMinimumSize(new java.awt.Dimension(18, 14)); - currentPageLabel.setPreferredSize(new java.awt.Dimension(18, 14)); pageLabel.setText(org.openide.util.NbBundle.getMessage(DataContentViewerHex.class, "DataContentViewerHex.pageLabel.text_1")); // NOI18N pageLabel.setMaximumSize(new java.awt.Dimension(33, 14)); pageLabel.setMinimumSize(new java.awt.Dimension(33, 14)); - pageLabel.setPreferredSize(new java.awt.Dimension(33, 14)); prevPageButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back.png"))); // NOI18N prevPageButton.setText(org.openide.util.NbBundle.getMessage(DataContentViewerHex.class, "DataContentViewerHex.prevPageButton.text")); // NOI18N @@ -166,7 +164,6 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont pageLabel2.setText(org.openide.util.NbBundle.getMessage(DataContentViewerHex.class, "DataContentViewerHex.pageLabel2.text")); // NOI18N pageLabel2.setMaximumSize(new java.awt.Dimension(29, 14)); pageLabel2.setMinimumSize(new java.awt.Dimension(29, 14)); - pageLabel2.setPreferredSize(new java.awt.Dimension(29, 14)); goToPageTextField.setText(org.openide.util.NbBundle.getMessage(DataContentViewerHex.class, "DataContentViewerHex.goToPageTextField.text")); // NOI18N goToPageTextField.addActionListener(new java.awt.event.ActionListener() { @@ -249,7 +246,7 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(hexViewerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(hexViewerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 701, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) ); layout.setVerticalGroup( diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerString.form b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerString.form index 68ddf6e1f3..20e77d395a 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerString.form +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerString.form @@ -45,7 +45,7 @@ - + @@ -167,9 +167,6 @@ - - - @@ -186,9 +183,6 @@ - - - @@ -229,9 +223,6 @@ - - - diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerString.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerString.java index 936ff3c46b..c006a45aa0 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerString.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerString.java @@ -142,13 +142,11 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC currentPageLabel.setText(org.openide.util.NbBundle.getMessage(DataContentViewerString.class, "DataContentViewerString.currentPageLabel.text_1")); // NOI18N currentPageLabel.setMaximumSize(new java.awt.Dimension(18, 14)); - currentPageLabel.setMinimumSize(new java.awt.Dimension(18, 14)); currentPageLabel.setPreferredSize(new java.awt.Dimension(18, 14)); pageLabel.setText(org.openide.util.NbBundle.getMessage(DataContentViewerString.class, "DataContentViewerString.pageLabel.text_1")); // NOI18N pageLabel.setMaximumSize(new java.awt.Dimension(33, 14)); pageLabel.setMinimumSize(new java.awt.Dimension(33, 14)); - pageLabel.setPreferredSize(new java.awt.Dimension(33, 14)); nextPageButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_forward.png"))); // NOI18N nextPageButton.setText(org.openide.util.NbBundle.getMessage(DataContentViewerString.class, "DataContentViewerString.nextPageButton.text")); // NOI18N @@ -167,7 +165,6 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC pageLabel2.setText(org.openide.util.NbBundle.getMessage(DataContentViewerString.class, "DataContentViewerString.pageLabel2.text")); // NOI18N pageLabel2.setMaximumSize(new java.awt.Dimension(29, 14)); pageLabel2.setMinimumSize(new java.awt.Dimension(29, 14)); - pageLabel2.setPreferredSize(new java.awt.Dimension(29, 14)); prevPageButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back.png"))); // NOI18N prevPageButton.setText(org.openide.util.NbBundle.getMessage(DataContentViewerString.class, "DataContentViewerString.prevPageButton.text")); // NOI18N @@ -256,7 +253,7 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 728, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java b/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java index 0ecfec0b30..54f2a358b5 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java @@ -18,11 +18,13 @@ */ package org.sleuthkit.autopsy.corecomponents; +import java.awt.Font; import java.awt.Insets; import java.util.Map; import java.util.TreeMap; import java.util.logging.Level; import javax.swing.BorderFactory; +import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.UnsupportedLookAndFeelException; @@ -56,7 +58,9 @@ public class Installer extends ModuleInstall { @Override public void restored() { super.restored(); - setLookAndFeel(); + SwingUtilities.invokeLater(() -> { + setLookAndFeel(); + }); UIManager.put("ViewTabDisplayerUI", "org.sleuthkit.autopsy.corecomponents.NoTabsTabDisplayerUI"); UIManager.put(DefaultTabbedContainerUI.KEY_VIEW_CONTENT_BORDER, BorderFactory.createEmptyBorder()); UIManager.put("TabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0)); @@ -69,7 +73,7 @@ public class Installer extends ModuleInstall { public void uninstalled() { super.uninstalled(); } - + private void setLookAndFeel() { if (System.getProperty("os.name").toLowerCase().contains("mac")) { //NON-NLS setOSXLookAndFeel(); @@ -90,6 +94,7 @@ public class Installer extends ModuleInstall { logger.log(Level.WARNING, "Error setting OS-X look-and-feel", ex); //NON-NLS } + // Store the keys that deal with menu items final String[] UI_MENU_ITEM_KEYS = new String[]{"MenuBarUI",}; //NON-NLS Map uiEntries = new TreeMap<>(); @@ -115,6 +120,16 @@ public class Installer extends ModuleInstall { }); } + public static void setUIFont (javax.swing.plaf.FontUIResource f){ + java.util.Enumeration keys = UIManager.getDefaults().keys(); + while (keys.hasMoreElements()) { + Object key = keys.nextElement(); + Object value = UIManager.getDefaults().get(key); + if (value instanceof javax.swing.plaf.FontUIResource) + UIManager.put(key, f); + } + } + private void setModuleSettings(String value) { if (ModuleSettings.configExists("timeline")) { ModuleSettings.setConfigSetting("timeline", "enable_timeline", value); @@ -128,6 +143,7 @@ public class Installer extends ModuleInstall { try { UIManager.put("swing.boldMetal", Boolean.FALSE); UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + setUIFont (new javax.swing.plaf.FontUIResource("DejaVu Sans Condensed", Font.PLAIN, 11)); setModuleSettings("true"); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { logger.log(Level.WARNING, "Error setting crossplatform look-and-feel, setting default look-and-feel",ex); diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/AbstractAbstractFileNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/AbstractAbstractFileNode.java index df2d3dfdc4..1404ca4950 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/AbstractAbstractFileNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/AbstractAbstractFileNode.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,6 +33,7 @@ import org.openide.nodes.Sheet; import org.openide.util.NbBundle; import org.openide.util.WeakListeners; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent; import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent; import org.sleuthkit.autopsy.coreutils.Logger; @@ -263,8 +264,8 @@ public abstract class AbstractAbstractFileNode extends A protected void addTagProperty(Sheet.Set ss) { List tags = new ArrayList<>(); try { - tags.addAll(Case.getCurrentCase().getServices().getTagsManager().getContentTagsByContent(content)); - } catch (TskCoreException ex) { + tags.addAll(Case.getOpenCase().getServices().getTagsManager().getContentTagsByContent(content)); + } catch (TskCoreException | NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Failed to get tags for content " + content.getName(), ex); } ss.put(new NodeProperty<>("Tags", AbstractAbstractFileNode_tagsProperty_displayName(), diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/AbstractContentNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/AbstractContentNode.java index 66355c2661..8750d57f30 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/AbstractContentNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/AbstractContentNode.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,6 +26,7 @@ import java.util.logging.Level; import org.openide.util.lookup.Lookups; import org.openide.util.Lookup; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE; import org.sleuthkit.datamodel.Content; @@ -119,12 +120,12 @@ public abstract class AbstractContentNode extends ContentNode + " AND type = " + TskData.ObjectType.ABSTRACTFILE.getObjectType() + ") AS OBJECT_IDS"; //NON-NLS; - try (SleuthkitCase.CaseDbQuery dbQuery = Case.getCurrentCase().getSleuthkitCase().executeQuery(query)) { + try (SleuthkitCase.CaseDbQuery dbQuery = Case.getOpenCase().getSleuthkitCase().executeQuery(query)) { ResultSet resultSet = dbQuery.getResultSet(); if(resultSet.next()){ return (0 < resultSet.getInt("count")); } - } catch (TskCoreException | SQLException ex) { + } catch (TskCoreException | SQLException | NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Error checking if the node has children, for content: " + c, ex); //NON-NLS } } diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java index 056d87bfbd..0e4e3a891d 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -35,12 +35,14 @@ import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.stream.Collectors; import javax.swing.Action; +import org.apache.commons.lang3.StringUtils; import org.openide.nodes.Sheet; import org.openide.util.Lookup; import org.openide.util.NbBundle; import org.openide.util.WeakListeners; import org.openide.util.lookup.Lookups; import org.sleuthkit.autopsy.casemodule.Case; +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; @@ -259,7 +261,7 @@ public class BlackboardArtifactNode extends AbstractContentNode(NbBundle.getMessage(BlackboardArtifactNode.class, "BlackboardArtifactNode.createSheet.artifactType.name"), NbBundle.getMessage(BlackboardArtifactNode.class, "BlackboardArtifactNode.createSheet.artifactType.displayName"), NO_DESCR, @@ -336,7 +338,7 @@ public class BlackboardArtifactNode extends AbstractContentNode(Bundle.BlackboardArtifactNode_createSheet_artifactMD5_name(), Bundle.BlackboardArtifactNode_createSheet_artifactMD5_displayName(), "", - file != null ? file.getMd5Hash() : "")); + file != null ? StringUtils.defaultString(file.getMd5Hash()) : "")); } } else { String dataSourceStr = ""; @@ -448,9 +450,9 @@ public class BlackboardArtifactNode extends AbstractContentNode tags = new ArrayList<>(); try { - tags.addAll(Case.getCurrentCase().getServices().getTagsManager().getBlackboardArtifactTagsByArtifact(artifact)); - tags.addAll(Case.getCurrentCase().getServices().getTagsManager().getContentTagsByContent(associated)); - } catch (TskCoreException ex) { + tags.addAll(Case.getOpenCase().getServices().getTagsManager().getBlackboardArtifactTagsByArtifact(artifact)); + tags.addAll(Case.getOpenCase().getServices().getTagsManager().getContentTagsByContent(associated)); + } catch (TskCoreException | NoCurrentCaseException ex) { LOGGER.log(Level.SEVERE, "Failed to get tags for artifact " + artifact.getDisplayName(), ex); } ss.put(new NodeProperty<>("Tags", NbBundle.getMessage(AbstractAbstractFileNode.class, "BlackboardArtifactNode.createSheet.tags.displayName"), diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java index 9ce002efc0..745753f2d4 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java @@ -23,6 +23,7 @@ import java.util.Arrays; import java.util.List; import java.util.logging.Level; import javax.swing.Action; +import org.apache.commons.lang3.StringUtils; import org.openide.nodes.Children; import org.openide.nodes.Sheet; import org.openide.util.NbBundle; @@ -114,7 +115,7 @@ class ContentTagNode extends DisplayableItemNode { properties.put(new NodeProperty<>(Bundle.ContentTagNode_createSheet_artifactMD5_name(), Bundle.ContentTagNode_createSheet_artifactMD5_displayName(), "", - file != null ? file.getMd5Hash() : "")); + file != null ? StringUtils.defaultString(file.getMd5Hash()) : "")); return propertySheet; } diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/ContentUtils.java b/Core/src/org/sleuthkit/autopsy/datamodel/ContentUtils.java index e974801953..5041250134 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/ContentUtils.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/ContentUtils.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -44,6 +44,7 @@ import org.sleuthkit.datamodel.LayoutFile; import org.sleuthkit.datamodel.LocalFile; import org.sleuthkit.datamodel.LocalDirectory; import org.sleuthkit.datamodel.ReadContentInputStream; +import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; import org.sleuthkit.datamodel.SlackFile; import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.VirtualDirectory; @@ -69,18 +70,20 @@ public final class ContentUtils { }); } - // don't instantiate + /** + * Don't instantiate + */ private ContentUtils() { throw new AssertionError(); } /** - * Convert epoch seconds to a string value in the given time zone + * Convert epoch seconds to a string value in the given time zone. * - * @param epochSeconds - * @param tzone + * @param epochSeconds Epoch seconds + * @param tzone Time zone * - * @return + * @return The time */ public static String getStringTime(long epochSeconds, TimeZone tzone) { String time = "0000-00-00 00:00:00"; @@ -93,6 +96,14 @@ public final class ContentUtils { return time; } + /** + * Convert epoch seconds to a string value (ISO8601) in the given time zone. + * + * @param epochSeconds Epoch seconds + * @param tzone Time zone + * + * @return The time + */ public static String getStringTimeISO8601(long epochSeconds, TimeZone tzone) { String time = "0000-00-00T00:00:00Z"; //NON-NLS if (epochSeconds != 0) { @@ -109,12 +120,12 @@ public final class ContentUtils { * Convert epoch seconds to a string value (convenience method) * * @param epochSeconds - * @param c + * @param content * * @return */ - public static String getStringTime(long epochSeconds, Content c) { - return getStringTime(epochSeconds, getTimeZone(c)); + public static String getStringTime(long epochSeconds, Content content) { + return getStringTime(epochSeconds, getTimeZone(content)); } /** @@ -130,13 +141,13 @@ public final class ContentUtils { return getStringTimeISO8601(epochSeconds, getTimeZone(c)); } - public static TimeZone getTimeZone(Content c) { + public static TimeZone getTimeZone(Content content) { try { if (!shouldDisplayTimesInLocalTime()) { return TimeZone.getTimeZone("GMT"); } else { - final Content dataSource = c.getDataSource(); + final Content dataSource = content.getDataSource(); if ((dataSource != null) && (dataSource instanceof Image)) { Image image = (Image) dataSource; return TimeZone.getTimeZone(image.getTimeZone()); @@ -151,10 +162,21 @@ public final class ContentUtils { } private static final SystemNameVisitor systemName = new SystemNameVisitor(); + /** + * Get system name from content using SystemNameVisitor. + * + * @param content The content object. + * + * @return The system name. + */ public static String getSystemName(Content content) { return content.accept(systemName); } + /** + * Visitor designed to handle the system name (content name and ID + * appended). + */ private static class SystemNameVisitor extends ContentVisitor.Default { SystemNameVisitor() { @@ -220,27 +242,37 @@ public final class ContentUtils { return totalRead; } + /** + * Write content to an output file. + * + * @param content The Content object. + * @param outputFile The output file. + * + * @throws IOException If the file could not be written. + */ public static void writeToFile(Content content, java.io.File outputFile) throws IOException { writeToFile(content, outputFile, null, null, false); } - + /** * Reads all the data from any content object and writes (extracts) it to a * file, using a cancellation check instead of a Future object method. - * + * * @param content Any content object. * @param outputFile Will be created if it doesn't exist, and overwritten * if it does * @param cancelCheck A function used to check if the file write process * should be terminated. + * * @return number of bytes extracted + * * @throws IOException if file could not be written */ public static long writeToFile(Content content, java.io.File outputFile, Supplier cancelCheck) throws IOException { InputStream in = new ReadContentInputStream(content); long totalRead = 0; - + try (FileOutputStream out = new FileOutputStream(outputFile, false)) { byte[] buffer = new byte[TO_FILE_BUFFER_SIZE]; int len = in.read(buffer); @@ -260,7 +292,9 @@ public final class ContentUtils { /** * Helper to ignore the '.' and '..' directories - * @param dir the directory to check + * + * @param dir the directory to check + * * @return true if dir is a '.' or '..' directory, false otherwise */ public static boolean isDotDirectory(AbstractFile dir) { @@ -313,61 +347,81 @@ public final class ContentUtils { } @Override - public Void visit(File f) { + public Void visit(File file) { try { - ContentUtils.writeToFile(f, dest, progress, worker, source); + ContentUtils.writeToFile(file, dest, progress, worker, source); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, + String.format("Error reading file '%s' (id=%d).", + file.getName(), file.getId()), ex); //NON-NLS } catch (IOException ex) { logger.log(Level.SEVERE, - "Trouble extracting file to " + dest.getAbsolutePath(), //NON-NLS - ex); + String.format("Error extracting file '%s' (id=%d) to '%s'.", + file.getName(), file.getId(), dest.getAbsolutePath()), ex); //NON-NLS } return null; } @Override - public Void visit(LayoutFile f) { + public Void visit(LayoutFile file) { try { - ContentUtils.writeToFile(f, dest, progress, worker, source); + ContentUtils.writeToFile(file, dest, progress, worker, source); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, + String.format("Error reading file '%s' (id=%d).", + file.getName(), file.getId()), ex); //NON-NLS } catch (IOException ex) { logger.log(Level.SEVERE, - "Trouble extracting unallocated content file to " + dest.getAbsolutePath(), //NON-NLS - ex); + String.format("Error extracting unallocated content file '%s' (id=%d) to '%s'.", + file.getName(), file.getId(), dest.getAbsolutePath()), ex); //NON-NLS } return null; } @Override - public Void visit(DerivedFile df) { + public Void visit(DerivedFile file) { try { - ContentUtils.writeToFile(df, dest, progress, worker, source); + ContentUtils.writeToFile(file, dest, progress, worker, source); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, + String.format("Error reading file '%s' (id=%d).", + file.getName(), file.getId()), ex); //NON-NLS } catch (IOException ex) { logger.log(Level.SEVERE, - "Error extracting derived file to " + dest.getAbsolutePath(), //NON-NLS - ex); + String.format("Error extracting derived file '%s' (id=%d) to '%s'.", + file.getName(), file.getId(), dest.getAbsolutePath()), ex); //NON-NLS } return null; } @Override - public Void visit(LocalFile lf) { + public Void visit(LocalFile file) { try { - ContentUtils.writeToFile(lf, dest, progress, worker, source); + ContentUtils.writeToFile(file, dest, progress, worker, source); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, + String.format("Error reading file '%s' (id=%d).", + file.getName(), file.getId()), ex); //NON-NLS } catch (IOException ex) { logger.log(Level.SEVERE, - "Error extracting local file to " + dest.getAbsolutePath(), //NON-NLS - ex); + String.format("Error extracting local file '%s' (id=%d) to '%s'.", + file.getName(), file.getId(), dest.getAbsolutePath()), ex); //NON-NLS } return null; } - + @Override - public Void visit(SlackFile f) { + public Void visit(SlackFile file) { try { - ContentUtils.writeToFile(f, dest, progress, worker, source); + ContentUtils.writeToFile(file, dest, progress, worker, source); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, + String.format("Error reading file '%s' (id=%d).", + file.getName(), file.getId()), ex); //NON-NLS } catch (IOException ex) { logger.log(Level.SEVERE, - "Trouble extracting slack file to " + dest.getAbsolutePath(), //NON-NLS - ex); + String.format("Error extracting slack file '%s' (id=%d) to '%s'.", + file.getName(), file.getId(), dest.getAbsolutePath()), ex); //NON-NLS } return null; } @@ -381,15 +435,15 @@ public final class ContentUtils { public Void visit(VirtualDirectory dir) { return visitDir(dir); } - + @Override public Void visit(LocalDirectory dir) { return visitDir(dir); } - private java.io.File getFsContentDest(Content fsc) { + private java.io.File getFsContentDest(Content content) { String path = dest.getAbsolutePath() + java.io.File.separator - + fsc.getName(); + + content.getName(); return new java.io.File(path); } @@ -406,7 +460,7 @@ public final class ContentUtils { int numProcessed = 0; // recurse on children for (Content child : dir.getChildren()) { - if (child instanceof AbstractFile){ //ensure the directory's artifact children are ignored + if (child instanceof AbstractFile) { //ensure the directory's artifact children are ignored java.io.File childFile = getFsContentDest(child); ExtractFscContentVisitor childVisitor = new ExtractFscContentVisitor<>(childFile, progress, worker, false); @@ -414,10 +468,10 @@ public final class ContentUtils { // will have a progress and worker, and will keep track // of the progress bar's progress if (worker != null && worker.isCancelled()) { - break; + break; } if (progress != null && source) { - progress.progress(child.getName(), numProcessed); + progress.progress(child.getName(), numProcessed); } child.accept(childVisitor); numProcessed++; @@ -447,5 +501,5 @@ public final class ContentUtils { public static boolean shouldDisplayTimesInLocalTime() { return displayTimesInLocalTime; } - -} \ No newline at end of file + +} diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/DeletedContent.java b/Core/src/org/sleuthkit/autopsy/datamodel/DeletedContent.java index 9b6f36a56b..816105d080 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/DeletedContent.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/DeletedContent.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -39,6 +39,7 @@ import org.openide.util.NbBundle; import org.openide.util.lookup.Lookups; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.coreutils.Logger; import static org.sleuthkit.autopsy.datamodel.Bundle.*; @@ -206,11 +207,11 @@ public class DeletedContent implements AutopsyVisitableItem { * that is already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); // new file was added // @@@ COULD CHECK If the new file is deleted before notifying... update(); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { /** * Case is closed, do nothing. */ @@ -225,9 +226,9 @@ public class DeletedContent implements AutopsyVisitableItem { * received for a case that is already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); update(); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { /** * Case is closed, do nothing. */ diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/EmailExtracted.java b/Core/src/org/sleuthkit/autopsy/datamodel/EmailExtracted.java index 7ffcfc077c..935aec9c62 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/EmailExtracted.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/EmailExtracted.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2012-2017 Basis Technology Corp. + * Copyright 2012-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -39,6 +39,7 @@ import org.openide.nodes.Sheet; 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 org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.ModuleDataEvent; @@ -240,7 +241,7 @@ public class EmailExtracted 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 @@ -251,7 +252,7 @@ public class EmailExtracted implements AutopsyVisitableItem { if (null != eventData && eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) { emailResults.update(); } - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { /** * Case is closed, do nothing. */ @@ -265,9 +266,9 @@ public class EmailExtracted implements AutopsyVisitableItem { * that is already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); emailResults.update(); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { /** * Case is closed, do nothing. */ diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/ExtractedContent.java b/Core/src/org/sleuthkit/autopsy/datamodel/ExtractedContent.java index 9a7334f423..3e001b097d 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/ExtractedContent.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/ExtractedContent.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -34,6 +34,7 @@ import org.openide.nodes.Sheet; 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 org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.ModuleDataEvent; @@ -210,7 +211,7 @@ public class ExtractedContent implements AutopsyVisitableItem { * may be received for a case that is already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); /** * Due to some unresolved issues with how cases are closed, * it is possible for the event to have a null oldValue if @@ -220,7 +221,7 @@ public class ExtractedContent implements AutopsyVisitableItem { if (null != event && !(this.doNotShow.contains(event.getBlackboardArtifactType()))) { refresh(true); } - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { /** * Case is closed, do nothing. */ @@ -233,9 +234,9 @@ public class ExtractedContent implements AutopsyVisitableItem { * may be received for a case that is already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); refresh(true); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { /** * Case is closed, do nothing. */ @@ -401,7 +402,7 @@ public class ExtractedContent 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 @@ -412,7 +413,7 @@ public class ExtractedContent implements AutopsyVisitableItem { if (null != event && event.getBlackboardArtifactType().equals(type)) { refresh(true); } - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { /** * Case is closed, do nothing. */ @@ -426,9 +427,9 @@ public class ExtractedContent implements AutopsyVisitableItem { * that is already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); refresh(true); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { /** * Case is closed, do nothing. */ diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/FileSize.java b/Core/src/org/sleuthkit/autopsy/datamodel/FileSize.java index 007c59ad41..0a9321e4d5 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/FileSize.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/FileSize.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013-2017 Basis Technology Corp. + * Copyright 2013-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,6 +36,7 @@ import org.openide.nodes.Sheet; 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.core.UserPreferences; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.IngestManager; @@ -201,9 +202,9 @@ 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.getCurrentCase(); + Case.getOpenCase(); update(); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { /** * Case is closed, do nothing. */ @@ -218,9 +219,9 @@ public class FileSize implements AutopsyVisitableItem { * that is already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); update(); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { /** * Case is closed, do nothing. */ diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByExtension.java b/Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByExtension.java index 2341fff12c..2d8cc564d2 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByExtension.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByExtension.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -37,6 +37,7 @@ import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; import org.openide.util.lookup.Lookups; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.datamodel.FileTypes.FileTypesKey; @@ -93,10 +94,10 @@ public final class FileTypesByExtension implements AutopsyVisitableItem { * that is already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); typesRoot.updateShowCounts(); update(); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { /** * Case is closed, do nothing. */ diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByMimeType.java b/Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByMimeType.java index 9fe183a8a8..e7af90fab7 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByMimeType.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByMimeType.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -41,6 +41,7 @@ import org.openide.nodes.Sheet; import org.openide.util.NbBundle; import org.openide.util.lookup.Lookups; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import static org.sleuthkit.autopsy.core.UserPreferences.hideKnownFilesInViewsTree; import static org.sleuthkit.autopsy.core.UserPreferences.hideSlackFilesInViewsTree; import org.sleuthkit.autopsy.coreutils.Logger; @@ -163,10 +164,10 @@ public final class FileTypesByMimeType extends Observable implements AutopsyVisi * already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); typesRoot.updateShowCounts(); populateHashMap(); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { /** * Case is closed, do nothing. */ diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java index 4efe1db364..7c06fb7afb 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,6 +33,7 @@ import org.openide.nodes.Sheet; 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.coreutils.Logger; import org.sleuthkit.autopsy.directorytree.ExplorerNodeActionVisitor; import org.sleuthkit.autopsy.directorytree.FileSearchAction; @@ -170,7 +171,7 @@ public class ImageNode extends AbstractContentNode { Bundle.ImageNode_createSheet_timezone_desc(), this.content.getTimeZone())); - try (CaseDbQuery query = Case.getCurrentCase().getSleuthkitCase().executeQuery("SELECT device_id FROM data_source_info WHERE obj_id = " + this.content.getId());) { + try (CaseDbQuery query = Case.getOpenCase().getSleuthkitCase().executeQuery("SELECT device_id FROM data_source_info WHERE obj_id = " + this.content.getId());) { ResultSet deviceIdSet = query.getResultSet(); if (deviceIdSet.next()) { ss.put(new NodeProperty<>(Bundle.ImageNode_createSheet_deviceId_name(), @@ -178,7 +179,7 @@ public class ImageNode extends AbstractContentNode { Bundle.ImageNode_createSheet_deviceId_desc(), deviceIdSet.getString("device_id"))); } - } catch (SQLException | TskCoreException ex) { + } catch (SQLException | TskCoreException | NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Failed to get device id for the following image: " + this.content.getId(), ex); } diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/KeywordHits.java b/Core/src/org/sleuthkit/autopsy/datamodel/KeywordHits.java index 75873d135e..dbe3dc371b 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/KeywordHits.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/KeywordHits.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit 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()) diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/Reports.java b/Core/src/org/sleuthkit/autopsy/datamodel/Reports.java index a09f518780..9c6d9f1829 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/Reports.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/Reports.java @@ -40,6 +40,7 @@ import org.openide.util.NbBundle; import org.openide.util.Utilities; 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 org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.directorytree.ExternalViewerAction; @@ -114,9 +115,9 @@ public final class Reports implements AutopsyVisitableItem { * that is already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); ReportNodeFactory.this.refresh(true); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { /** * Case is closed, do nothing. */ @@ -128,8 +129,8 @@ public final class Reports implements AutopsyVisitableItem { @Override protected boolean createKeys(List keys) { try { - keys.addAll(Case.getCurrentCase().getAllReports()); - } catch (TskCoreException ex) { + keys.addAll(Case.getOpenCase().getAllReports()); + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(Reports.ReportNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get reports", ex); //NON-NLS } return true; @@ -265,8 +266,8 @@ public final class Reports implements AutopsyVisitableItem { NbBundle.getMessage(Reports.class, "DeleteReportAction.actionPerformed.showConfirmDialog.title"), JOptionPane.YES_NO_OPTION)) { try { - Case.getCurrentCase().deleteReports(selectedReportsCollection); - } catch (TskCoreException | IllegalStateException ex) { + Case.getOpenCase().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()); } diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/Tags.java b/Core/src/org/sleuthkit/autopsy/datamodel/Tags.java index 64b77ac245..57fd35beba 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/Tags.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/Tags.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -34,6 +34,7 @@ import org.openide.nodes.Sheet; 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.casemodule.services.TagsManager; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.IngestManager; @@ -141,10 +142,10 @@ public class Tags implements AutopsyVisitableItem { * that is already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); refresh(true); tagResults.update(); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { /** * Case is closed, do nothing. */ @@ -158,10 +159,10 @@ public class Tags implements AutopsyVisitableItem { * that is already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); refresh(true); tagResults.update(); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { /** * Case is closed, do nothing. */ @@ -195,10 +196,10 @@ public class Tags implements AutopsyVisitableItem { @Override protected boolean createKeys(List keys) { try { - List tagNamesInUse = Case.getCurrentCase().getServices().getTagsManager().getTagNamesInUse(); + List tagNamesInUse = Case.getOpenCase().getServices().getTagsManager().getTagNamesInUse(); Collections.sort(tagNamesInUse); keys.addAll(tagNamesInUse); - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(TagNameNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS } return true; @@ -242,10 +243,10 @@ public class Tags implements AutopsyVisitableItem { private void updateDisplayName() { long tagsCount = 0; try { - TagsManager tm = Case.getCurrentCase().getServices().getTagsManager(); + TagsManager tm = Case.getOpenCase().getServices().getTagsManager(); tagsCount = tm.getContentTagsCountByTagName(tagName); tagsCount += tm.getBlackboardArtifactTagsCountByTagName(tagName); - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(TagNameNode.class.getName()).log(Level.SEVERE, "Failed to get tags count for " + tagName.getDisplayName() + " tag name", ex); //NON-NLS } setDisplayName(tagName.getDisplayName() + " \u200E(\u200E" + tagsCount + ")\u200E"); @@ -347,8 +348,8 @@ public class Tags implements AutopsyVisitableItem { private void updateDisplayName() { long tagsCount = 0; try { - tagsCount = Case.getCurrentCase().getServices().getTagsManager().getContentTagsCountByTagName(tagName); - } catch (TskCoreException ex) { + tagsCount = Case.getOpenCase().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 } super.setDisplayName(CONTENT_DISPLAY_NAME + " (" + tagsCount + ")"); @@ -402,8 +403,8 @@ public class Tags implements AutopsyVisitableItem { protected boolean createKeys(List keys) { // Use the content tags bearing the specified tag name as the keys. try { - keys.addAll(Case.getCurrentCase().getServices().getTagsManager().getContentTagsByTagName(tagName)); - } catch (TskCoreException ex) { + keys.addAll(Case.getOpenCase().getServices().getTagsManager().getContentTagsByTagName(tagName)); + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(ContentTagNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS } return true; @@ -446,8 +447,8 @@ public class Tags implements AutopsyVisitableItem { private void updateDisplayName() { long tagsCount = 0; try { - tagsCount = Case.getCurrentCase().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagName(tagName); - } catch (TskCoreException ex) { + tagsCount = Case.getOpenCase().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 } super.setDisplayName(ARTIFACT_DISPLAY_NAME + " (" + tagsCount + ")"); @@ -501,8 +502,8 @@ public class Tags implements AutopsyVisitableItem { protected boolean createKeys(List keys) { try { // Use the blackboard artifact tags bearing the specified tag name as the keys. - keys.addAll(Case.getCurrentCase().getServices().getTagsManager().getBlackboardArtifactTagsByTagName(tagName)); - } catch (TskCoreException ex) { + keys.addAll(Case.getOpenCase().getServices().getTagsManager().getBlackboardArtifactTagsByTagName(tagName)); + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(BlackboardArtifactTagNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS } return true; diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java index 3d78d3f13d..312e6a8da0 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,6 +26,7 @@ import java.util.logging.Level; import org.openide.nodes.Sheet; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; @@ -105,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.getCurrentCase().getSleuthkitCase().executeQuery("SELECT time_zone FROM data_source_info WHERE obj_id = " + this.content.getId())) { + try (SleuthkitCase.CaseDbQuery query = Case.getOpenCase().getSleuthkitCase().executeQuery("SELECT time_zone FROM data_source_info WHERE obj_id = " + this.content.getId())) { ResultSet timeZoneSet = query.getResultSet(); if (timeZoneSet.next()) { ss.put(new NodeProperty<>(Bundle.VirtualDirectoryNode_createSheet_timezone_name(), @@ -113,10 +114,10 @@ public class VirtualDirectoryNode extends SpecialDirectoryNode { Bundle.VirtualDirectoryNode_createSheet_timezone_desc(), timeZoneSet.getString("time_zone"))); } - } catch (SQLException | TskCoreException ex) { + } 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.getCurrentCase().getSleuthkitCase().executeQuery("SELECT device_id FROM data_source_info WHERE obj_id = " + this.content.getId());) { + try (SleuthkitCase.CaseDbQuery query = Case.getOpenCase().getSleuthkitCase().executeQuery("SELECT device_id FROM data_source_info WHERE obj_id = " + this.content.getId());) { ResultSet deviceIdSet = query.getResultSet(); if (deviceIdSet.next()) { ss.put(new NodeProperty<>(Bundle.VirtualDirectoryNode_createSheet_deviceId_name(), @@ -124,7 +125,7 @@ public class VirtualDirectoryNode extends SpecialDirectoryNode { Bundle.VirtualDirectoryNode_createSheet_deviceId_desc(), deviceIdSet.getString("device_id"))); } - } catch (SQLException | TskCoreException ex) { + } catch (SQLException | TskCoreException | NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Failed to get device id for the following image: " + this.content.getId(), ex); } diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/accounts/Accounts.java b/Core/src/org/sleuthkit/autopsy/datamodel/accounts/Accounts.java index b3e8a9a1b1..422a0cff0a 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/accounts/Accounts.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/accounts/Accounts.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -59,6 +59,7 @@ import org.openide.util.NbBundle; import org.openide.util.Utilities; import org.openide.util.lookup.Lookups; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent; import org.sleuthkit.autopsy.datamodel.AutopsyItemVisitor; import org.sleuthkit.autopsy.datamodel.AutopsyVisitableItem; @@ -240,7 +241,7 @@ final public class Accounts 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 @@ -252,7 +253,7 @@ final public class Accounts implements AutopsyVisitableItem { && eventData.getBlackboardArtifactType().getTypeID() == ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) { reviewStatusBus.post(eventData); } - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { // Case is closed, do nothing. } } else if (eventType.equals(IngestManager.IngestJobEvent.COMPLETED.toString()) @@ -264,9 +265,9 @@ final public class Accounts implements AutopsyVisitableItem { * that is already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); refresh(true); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { // Case is closed, do nothing. } } else if (eventType.equals(Case.Events.CURRENT_CASE.toString())) { @@ -368,7 +369,7 @@ final public class Accounts 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 @@ -380,7 +381,7 @@ final public class Accounts implements AutopsyVisitableItem { && eventData.getBlackboardArtifactType().getTypeID() == ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) { reviewStatusBus.post(eventData); } - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { // Case is closed, do nothing. } } else if (eventType.equals(IngestManager.IngestJobEvent.COMPLETED.toString()) @@ -392,10 +393,10 @@ final public class Accounts implements AutopsyVisitableItem { * that is already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); refresh(true); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { // Case is closed, do nothing. } } else if (eventType.equals(Case.Events.CURRENT_CASE.toString())) { @@ -517,7 +518,7 @@ final public class Accounts 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 @@ -529,7 +530,7 @@ final public class Accounts implements AutopsyVisitableItem { && eventData.getBlackboardArtifactType().getTypeID() == ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) { reviewStatusBus.post(eventData); } - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { // Case is closed, do nothing. } } else if (eventType.equals(IngestManager.IngestJobEvent.COMPLETED.toString()) @@ -541,10 +542,10 @@ final public class Accounts implements AutopsyVisitableItem { * that is already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); refresh(true); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { // Case is closed, do nothing. } } else if (eventType.equals(Case.Events.CURRENT_CASE.toString())) { @@ -651,7 +652,7 @@ final public class Accounts 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 @@ -663,7 +664,7 @@ final public class Accounts implements AutopsyVisitableItem { && eventData.getBlackboardArtifactType().getTypeID() == ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) { reviewStatusBus.post(eventData); } - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { // Case is closed, do nothing. } } else if (eventType.equals(IngestManager.IngestJobEvent.COMPLETED.toString()) @@ -675,10 +676,10 @@ final public class Accounts implements AutopsyVisitableItem { * that is already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); refresh(true); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { // Case is closed, do nothing. } } else if (eventType.equals(Case.Events.CURRENT_CASE.toString())) { @@ -862,7 +863,7 @@ final public class Accounts 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 @@ -874,7 +875,7 @@ final public class Accounts implements AutopsyVisitableItem { && eventData.getBlackboardArtifactType().getTypeID() == ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) { reviewStatusBus.post(eventData); } - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { // Case is closed, do nothing. } } else if (eventType.equals(IngestManager.IngestJobEvent.COMPLETED.toString()) @@ -886,10 +887,10 @@ final public class Accounts implements AutopsyVisitableItem { * that is already closed. */ try { - Case.getCurrentCase(); + Case.getOpenCase(); refresh(true); - } catch (IllegalStateException notUsed) { + } catch (NoCurrentCaseException notUsed) { // Case is closed, do nothing. } } else if (eventType.equals(Case.Events.CURRENT_CASE.toString())) { diff --git a/Core/src/org/sleuthkit/autopsy/datasourceprocessors/RawDSInputPanel.form b/Core/src/org/sleuthkit/autopsy/datasourceprocessors/RawDSInputPanel.form index ff07eaa18c..2935c9826f 100644 --- a/Core/src/org/sleuthkit/autopsy/datasourceprocessors/RawDSInputPanel.form +++ b/Core/src/org/sleuthkit/autopsy/datasourceprocessors/RawDSInputPanel.form @@ -23,18 +23,18 @@ - + - + - + - + - + diff --git a/Core/src/org/sleuthkit/autopsy/datasourceprocessors/RawDSInputPanel.java b/Core/src/org/sleuthkit/autopsy/datasourceprocessors/RawDSInputPanel.java index 8fb6fe5ccf..7c0b16af78 100644 --- a/Core/src/org/sleuthkit/autopsy/datasourceprocessors/RawDSInputPanel.java +++ b/Core/src/org/sleuthkit/autopsy/datasourceprocessors/RawDSInputPanel.java @@ -163,15 +163,15 @@ final class RawDSInputPanel extends JPanel implements DocumentListener { .addGroup(layout.createSequentialGroup() .addComponent(pathTextField) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(browseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(browseButton)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(pathLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(pathLabel) .addGroup(layout.createSequentialGroup() - .addComponent(timeZoneLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(timeZoneLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(timeZoneComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGap(0, 19, Short.MAX_VALUE)) + .addComponent(timeZoneComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(0, 0, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jBreakFileUpLabel) diff --git a/Core/src/org/sleuthkit/autopsy/diagnostics/PerformancePanel.form b/Core/src/org/sleuthkit/autopsy/diagnostics/PerformancePanel.form index 7d0049cd82..2c3f32bf2b 100644 --- a/Core/src/org/sleuthkit/autopsy/diagnostics/PerformancePanel.form +++ b/Core/src/org/sleuthkit/autopsy/diagnostics/PerformancePanel.form @@ -37,10 +37,10 @@ - - - - + + + + @@ -58,7 +58,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/diagnostics/PerformancePanel.java b/Core/src/org/sleuthkit/autopsy/diagnostics/PerformancePanel.java index 69a80462d8..1525958390 100644 --- a/Core/src/org/sleuthkit/autopsy/diagnostics/PerformancePanel.java +++ b/Core/src/org/sleuthkit/autopsy/diagnostics/PerformancePanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2014 Basis Technology Corp. + * Copyright 2014-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -120,10 +120,10 @@ public class PerformancePanel extends javax.swing.JDialog { .addComponent(jLabel3)) .addGap(31, 31, 31) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(fileReadLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 228, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(dbReadLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(cpuTimeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 284, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(imgReadLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(fileReadLabel) + .addComponent(dbReadLabel) + .addComponent(cpuTimeLabel) + .addComponent(imgReadLabel)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel4) @@ -134,7 +134,7 @@ public class PerformancePanel extends javax.swing.JDialog { .addComponent(jLabel5)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() - .addComponent(statusLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 508, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(statusLabel) .addGap(0, 0, Short.MAX_VALUE)))) ); layout.setVerticalGroup( @@ -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; diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/AddExternalViewerRulePanel.form b/Core/src/org/sleuthkit/autopsy/directorytree/AddExternalViewerRulePanel.form index 8ad8af3aa4..68f89b870d 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/AddExternalViewerRulePanel.form +++ b/Core/src/org/sleuthkit/autopsy/directorytree/AddExternalViewerRulePanel.form @@ -31,7 +31,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/AddExternalViewerRulePanel.java b/Core/src/org/sleuthkit/autopsy/directorytree/AddExternalViewerRulePanel.java index 75ae1a4aed..66705cc174 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/AddExternalViewerRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/AddExternalViewerRulePanel.java @@ -229,7 +229,7 @@ class AddExternalViewerRulePanel extends javax.swing.JPanel { .addComponent(browseButton)) .addGroup(layout.createSequentialGroup() .addComponent(exePathLabel) - .addGap(0, 80, Short.MAX_VALUE)) + .addGap(0, 0, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addComponent(nameLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerGlobalSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerGlobalSettingsPanel.form index 50706d661f..e04dc19270 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerGlobalSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerGlobalSettingsPanel.form @@ -86,7 +86,6 @@ - @@ -113,7 +112,7 @@ - + @@ -124,7 +123,7 @@ - + @@ -147,11 +146,6 @@ - - - - - @@ -165,15 +159,15 @@ - - + - + - - + + + @@ -184,9 +178,9 @@ - - - + + + @@ -205,25 +199,6 @@ - - - - - - - - - - - - - - - - - - - @@ -238,9 +213,6 @@ - - - @@ -260,9 +232,6 @@ - - - @@ -282,14 +251,27 @@ - - - + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerGlobalSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerGlobalSettingsPanel.java index 574747281d..29241cf02e 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerGlobalSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerGlobalSettingsPanel.java @@ -87,11 +87,11 @@ final class ExternalViewerGlobalSettingsPanel extends javax.swing.JPanel impleme exePathNameLabel = new javax.swing.JLabel(); rulesPanel = new javax.swing.JPanel(); ruleListLabel = new javax.swing.JLabel(); - rulesScrollPane = new javax.swing.JScrollPane(); - rulesList = new javax.swing.JList<>(); newRuleButton = new javax.swing.JButton(); editRuleButton = new javax.swing.JButton(); deleteRuleButton = new javax.swing.JButton(); + jScrollPane2 = new javax.swing.JScrollPane(); + rulesList = new javax.swing.JList<>(); setPreferredSize(new java.awt.Dimension(701, 453)); @@ -99,7 +99,6 @@ final class ExternalViewerGlobalSettingsPanel extends javax.swing.JPanel impleme org.openide.awt.Mnemonics.setLocalizedText(externalViewerTitleLabel, org.openide.util.NbBundle.getMessage(ExternalViewerGlobalSettingsPanel.class, "ExternalViewerGlobalSettingsPanel.externalViewerTitleLabel.text")); // NOI18N - jSplitPane1.setDividerLocation(365); jSplitPane1.setDividerSize(1); exePanel.setPreferredSize(new java.awt.Dimension(311, 224)); @@ -117,7 +116,7 @@ final class ExternalViewerGlobalSettingsPanel extends javax.swing.JPanel impleme .addGroup(exePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(exePathLabel) .addComponent(exePathNameLabel)) - .addContainerGap(47, Short.MAX_VALUE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); exePanelLayout.setVerticalGroup( exePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -126,22 +125,17 @@ final class ExternalViewerGlobalSettingsPanel extends javax.swing.JPanel impleme .addComponent(exePathLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(exePathNameLabel) - .addContainerGap(361, Short.MAX_VALUE)) + .addContainerGap(355, Short.MAX_VALUE)) ); jSplitPane1.setRightComponent(exePanel); - rulesPanel.setPreferredSize(new java.awt.Dimension(365, 406)); - org.openide.awt.Mnemonics.setLocalizedText(ruleListLabel, org.openide.util.NbBundle.getMessage(ExternalViewerGlobalSettingsPanel.class, "ExternalViewerGlobalSettingsPanel.ruleListLabel.text")); // NOI18N - rulesScrollPane.setViewportView(rulesList); - newRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(newRuleButton, org.openide.util.NbBundle.getMessage(ExternalViewerGlobalSettingsPanel.class, "ExternalViewerGlobalSettingsPanel.newRuleButton.text")); // NOI18N newRuleButton.setMaximumSize(new java.awt.Dimension(111, 25)); newRuleButton.setMinimumSize(new java.awt.Dimension(111, 25)); - newRuleButton.setPreferredSize(new java.awt.Dimension(111, 25)); newRuleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newRuleButtonActionPerformed(evt); @@ -152,7 +146,6 @@ final class ExternalViewerGlobalSettingsPanel extends javax.swing.JPanel impleme org.openide.awt.Mnemonics.setLocalizedText(editRuleButton, org.openide.util.NbBundle.getMessage(ExternalViewerGlobalSettingsPanel.class, "ExternalViewerGlobalSettingsPanel.editRuleButton.text")); // NOI18N editRuleButton.setMaximumSize(new java.awt.Dimension(111, 25)); editRuleButton.setMinimumSize(new java.awt.Dimension(111, 25)); - editRuleButton.setPreferredSize(new java.awt.Dimension(111, 25)); editRuleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { editRuleButtonActionPerformed(evt); @@ -163,13 +156,14 @@ final class ExternalViewerGlobalSettingsPanel extends javax.swing.JPanel impleme org.openide.awt.Mnemonics.setLocalizedText(deleteRuleButton, org.openide.util.NbBundle.getMessage(ExternalViewerGlobalSettingsPanel.class, "ExternalViewerGlobalSettingsPanel.deleteRuleButton.text")); // NOI18N deleteRuleButton.setMaximumSize(new java.awt.Dimension(111, 25)); deleteRuleButton.setMinimumSize(new java.awt.Dimension(111, 25)); - deleteRuleButton.setPreferredSize(new java.awt.Dimension(111, 25)); deleteRuleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deleteRuleButtonActionPerformed(evt); } }); + jScrollPane2.setViewportView(rulesList); + javax.swing.GroupLayout rulesPanelLayout = new javax.swing.GroupLayout(rulesPanel); rulesPanel.setLayout(rulesPanelLayout); rulesPanelLayout.setHorizontalGroup( @@ -178,14 +172,14 @@ final class ExternalViewerGlobalSettingsPanel extends javax.swing.JPanel impleme .addContainerGap() .addGroup(rulesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(ruleListLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(rulesScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 345, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, rulesPanelLayout.createSequentialGroup() - .addGap(0, 0, Short.MAX_VALUE) + .addGap(6, 6, 6) .addComponent(newRuleButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGap(16, 16, 16) .addComponent(editRuleButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(deleteRuleButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(16, 16, 16) + .addComponent(deleteRuleButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(jScrollPane2)) .addContainerGap()) ); rulesPanelLayout.setVerticalGroup( @@ -194,8 +188,8 @@ final class ExternalViewerGlobalSettingsPanel extends javax.swing.JPanel impleme .addContainerGap() .addComponent(ruleListLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(rulesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jScrollPane2) + .addGap(12, 12, 12) .addGroup(rulesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(newRuleButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(editRuleButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -370,6 +364,7 @@ final class ExternalViewerGlobalSettingsPanel extends javax.swing.JPanel impleme private javax.swing.JLabel externalViewerTitleLabel; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; private javax.swing.JSplitPane jSplitPane1; private javax.swing.JButton newRuleButton; private javax.swing.JLabel ruleListLabel; diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/FileSystemDetailsPanel.form b/Core/src/org/sleuthkit/autopsy/directorytree/FileSystemDetailsPanel.form index fc323af4c7..1baefa41b4 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/FileSystemDetailsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/directorytree/FileSystemDetailsPanel.form @@ -24,7 +24,7 @@ - + @@ -78,7 +78,7 @@ - + @@ -88,7 +88,7 @@ - + @@ -101,12 +101,12 @@ - + - + diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/FileSystemDetailsPanel.java b/Core/src/org/sleuthkit/autopsy/directorytree/FileSystemDetailsPanel.java index 3aa9a718b1..f896fa0dad 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/FileSystemDetailsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/FileSystemDetailsPanel.java @@ -166,14 +166,14 @@ final class FileSystemDetailsPanel extends javax.swing.JPanel { .addGroup(genInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(genInfoPanelLayout.createSequentialGroup() .addGroup(genInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(blockSizeValue, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE) + .addComponent(blockSizeValue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(imgOffsetValue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(genInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addComponent(jLabel3))) .addComponent(volumeIDValue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(fsTypeValue, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(fsTypeValue)) .addGap(10, 10, 10) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(10, 10, 10) @@ -184,11 +184,11 @@ final class FileSystemDetailsPanel extends javax.swing.JPanel { .addComponent(lastInumLabel)) .addGap(10, 10, 10) .addGroup(genInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(blockCountValue, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE) + .addComponent(blockCountValue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(rootInumValue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(firstInumValue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lastInumValue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(229, Short.MAX_VALUE)) ); genInfoPanelLayout.setVerticalGroup( genInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -248,7 +248,7 @@ final class FileSystemDetailsPanel extends javax.swing.JPanel { .addComponent(genInfoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 534, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(221, 221, 221) - .addComponent(OKButton, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(OKButton))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/ImageDetailsPanel.form b/Core/src/org/sleuthkit/autopsy/directorytree/ImageDetailsPanel.form index 161b073bed..e85a5fbfd8 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/ImageDetailsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/directorytree/ImageDetailsPanel.form @@ -24,7 +24,7 @@ - + @@ -40,13 +40,10 @@ - - - - - + + diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/ImageDetailsPanel.java b/Core/src/org/sleuthkit/autopsy/directorytree/ImageDetailsPanel.java index a9f117b6dd..b551c11c69 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/ImageDetailsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/ImageDetailsPanel.java @@ -109,7 +109,7 @@ class ImageDetailsPanel extends javax.swing.JPanel { .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(imgNameLabel) .addComponent(imgTypeLabel) @@ -122,11 +122,9 @@ class ImageDetailsPanel extends javax.swing.JPanel { .addComponent(imgTypeValue) .addComponent(imgSectorSizeValue) .addComponent(imgTotalSizeValue) - .addComponent(imgHashValue)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(OKButton, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + .addComponent(imgHashValue))) + .addComponent(OKButton)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/ViewSourceArtifactAction.java b/Core/src/org/sleuthkit/autopsy/directorytree/ViewSourceArtifactAction.java index a9d23a14de..04a2cccc2c 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/ViewSourceArtifactAction.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/ViewSourceArtifactAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,6 +23,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.AbstractAction; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.TskCoreException; @@ -48,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.getCurrentCase().getSleuthkitCase().getBlackboardArtifact(attribute.getValueLong()); + BlackboardArtifact associatedArtifact = Case.getOpenCase().getSleuthkitCase().getBlackboardArtifact(attribute.getValueLong()); if (associatedArtifact != null) { dirTree.viewArtifact(associatedArtifact); break; @@ -56,7 +57,7 @@ class ViewSourceArtifactAction extends AbstractAction { } } - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { logger.log(Level.WARNING, "Unable to perform view artifact on an associated artifact of " + artifact.getDisplayName(), ex); //NON-NLS } } diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/VolumeDetailsPanel.form b/Core/src/org/sleuthkit/autopsy/directorytree/VolumeDetailsPanel.form index 5f4e933d1c..861be648f3 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/VolumeDetailsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/directorytree/VolumeDetailsPanel.form @@ -82,7 +82,7 @@ - + @@ -101,7 +101,7 @@ - + @@ -113,7 +113,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/VolumeDetailsPanel.java b/Core/src/org/sleuthkit/autopsy/directorytree/VolumeDetailsPanel.java index 44359f92c4..cea09df745 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/VolumeDetailsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/VolumeDetailsPanel.java @@ -119,7 +119,7 @@ class VolumeDetailsPanel extends javax.swing.JPanel { jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1) .addGap(11, 11, 11) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(volumeIDLabel) @@ -135,7 +135,7 @@ class VolumeDetailsPanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(descLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(descLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(flagsLabel) @@ -143,7 +143,7 @@ class VolumeDetailsPanel extends javax.swing.JPanel { .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(descValue) .addGap(25, 25, 25))) - .addContainerGap(15, Short.MAX_VALUE)) + .addContainerGap(29, Short.MAX_VALUE)) ); OKButton.setFont(OKButton.getFont().deriveFont(OKButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); diff --git a/Core/src/org/sleuthkit/autopsy/examples/SampleContentViewer.form b/Core/src/org/sleuthkit/autopsy/examples/SampleContentViewer.form index aafb471dd0..aff213ed81 100644 --- a/Core/src/org/sleuthkit/autopsy/examples/SampleContentViewer.form +++ b/Core/src/org/sleuthkit/autopsy/examples/SampleContentViewer.form @@ -18,8 +18,8 @@ - - + + @@ -27,8 +27,8 @@ - - + + diff --git a/Core/src/org/sleuthkit/autopsy/examples/SampleContentViewer.java b/Core/src/org/sleuthkit/autopsy/examples/SampleContentViewer.java index 61de9bab7c..17c73388aa 100644 --- a/Core/src/org/sleuthkit/autopsy/examples/SampleContentViewer.java +++ b/Core/src/org/sleuthkit/autopsy/examples/SampleContentViewer.java @@ -73,15 +73,15 @@ class SampleContentViewer extends javax.swing.JPanel implements DataContentViewe layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 369, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(21, Short.MAX_VALUE)) + .addComponent(jLabel1) + .addContainerGap(339, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(19, 19, 19) - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(243, Short.MAX_VALUE)) + .addComponent(jLabel1) + .addContainerGap(266, Short.MAX_VALUE)) ); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.form b/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.form index 0d2d2b3d19..6bb0f547fe 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.form +++ b/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.form @@ -67,7 +67,7 @@ - + @@ -83,10 +83,10 @@ - + - + diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.java b/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.java index 1c38b7e35b..dedc5a2899 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.java +++ b/Core/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.java @@ -270,7 +270,7 @@ class DateSearchPanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(timeZoneComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(timeZoneComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(modifiedCheckBox) .addGap(6, 6, 6) @@ -282,10 +282,10 @@ class DateSearchPanel extends javax.swing.JPanel { .addGap(33, 33, 33)) .addGroup(layout.createSequentialGroup() .addComponent(dateCheckBox) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(fromDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1) .addGap(10, 10, 10) .addComponent(toDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/FileSearchPanel.form b/Core/src/org/sleuthkit/autopsy/filesearch/FileSearchPanel.form index f6fd00903f..89fe3dc17f 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/FileSearchPanel.form +++ b/Core/src/org/sleuthkit/autopsy/filesearch/FileSearchPanel.form @@ -70,12 +70,12 @@ - - - + + + diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/FileSearchPanel.java b/Core/src/org/sleuthkit/autopsy/filesearch/FileSearchPanel.java index e39070cd70..21c62d9c3e 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/FileSearchPanel.java +++ b/Core/src/org/sleuthkit/autopsy/filesearch/FileSearchPanel.java @@ -291,8 +291,8 @@ class FileSearchPanel extends javax.swing.JPanel { searchButton.setText(org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.searchButton.text")); // NOI18N - errorLabel.setForeground(new java.awt.Color(255, 51, 51)); errorLabel.setText(org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.errorLabel.text")); // NOI18N + errorLabel.setForeground(new java.awt.Color(255, 51, 51)); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/HashSearchPanel.form b/Core/src/org/sleuthkit/autopsy/filesearch/HashSearchPanel.form index bb410a2aaa..050e944da4 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/HashSearchPanel.form +++ b/Core/src/org/sleuthkit/autopsy/filesearch/HashSearchPanel.form @@ -75,14 +75,14 @@ + + + - - - diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/HashSearchPanel.java b/Core/src/org/sleuthkit/autopsy/filesearch/HashSearchPanel.java index 22b8f74314..3f0d5176ac 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/HashSearchPanel.java +++ b/Core/src/org/sleuthkit/autopsy/filesearch/HashSearchPanel.java @@ -125,8 +125,8 @@ class HashSearchPanel extends javax.swing.JPanel { selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(HashSearchPanel.class, "NameSearchPanel.selectAllMenuItem.text")); // NOI18N rightClickMenu.add(selectAllMenuItem); - hashCheckBox.setFont(hashCheckBox.getFont().deriveFont(hashCheckBox.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); hashCheckBox.setText(org.openide.util.NbBundle.getMessage(HashSearchPanel.class, "HashSearchPanel.md5CheckBox.text")); // NOI18N + hashCheckBox.setFont(hashCheckBox.getFont().deriveFont(hashCheckBox.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); hashCheckBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { hashCheckBoxActionPerformed(evt); diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/MimeTypePanel.form b/Core/src/org/sleuthkit/autopsy/filesearch/MimeTypePanel.form index 7eb2d436df..772e74f9fc 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/MimeTypePanel.form +++ b/Core/src/org/sleuthkit/autopsy/filesearch/MimeTypePanel.form @@ -33,7 +33,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -89,12 +89,12 @@ - - - + + + diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/MimeTypePanel.java b/Core/src/org/sleuthkit/autopsy/filesearch/MimeTypePanel.java index 10d77dbb9e..0f775a8320 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/MimeTypePanel.java +++ b/Core/src/org/sleuthkit/autopsy/filesearch/MimeTypePanel.java @@ -98,8 +98,8 @@ public class MimeTypePanel extends javax.swing.JPanel { } }); - jLabel1.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(MimeTypePanel.class, "MimeTypePanel.jLabel1.text")); // NOI18N + jLabel1.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); @@ -111,9 +111,9 @@ public class MimeTypePanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 246, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) ); @@ -122,7 +122,7 @@ public class MimeTypePanel extends javax.swing.JPanel { .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(mimeTypeCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 106, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel1) .addContainerGap()) diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/NameSearchPanel.form b/Core/src/org/sleuthkit/autopsy/filesearch/NameSearchPanel.form index b06f6d4c17..af80aa264a 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/NameSearchPanel.form +++ b/Core/src/org/sleuthkit/autopsy/filesearch/NameSearchPanel.form @@ -55,16 +55,16 @@ - + - + - - + + - + @@ -127,7 +127,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/NameSearchPanel.java b/Core/src/org/sleuthkit/autopsy/filesearch/NameSearchPanel.java index cf197c4e00..81ff01fd0f 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/NameSearchPanel.java +++ b/Core/src/org/sleuthkit/autopsy/filesearch/NameSearchPanel.java @@ -149,7 +149,7 @@ class NameSearchPanel extends javax.swing.JPanel { noteNameLabel.setText(org.openide.util.NbBundle.getMessage(NameSearchPanel.class, "NameSearchPanel.noteNameLabel.text")); // NOI18N noteNameLabel.setMaximumSize(new java.awt.Dimension(250, 30)); noteNameLabel.setMinimumSize(new java.awt.Dimension(250, 30)); - noteNameLabel.setPreferredSize(new java.awt.Dimension(250, 30)); + noteNameLabel.setPreferredSize(new java.awt.Dimension(250, 40)); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); @@ -158,11 +158,11 @@ class NameSearchPanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addGap(0, 0, 0) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(noteNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 296, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(noteNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addComponent(nameCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(searchTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 247, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(searchTextField))) .addGap(0, 0, 0)) ); layout.setVerticalGroup( diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/SizeSearchPanel.form b/Core/src/org/sleuthkit/autopsy/filesearch/SizeSearchPanel.form index dcdab6f802..91ef54d8ab 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/SizeSearchPanel.form +++ b/Core/src/org/sleuthkit/autopsy/filesearch/SizeSearchPanel.form @@ -56,12 +56,13 @@ - - - - - - + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/filesearch/SizeSearchPanel.java b/Core/src/org/sleuthkit/autopsy/filesearch/SizeSearchPanel.java index 51aa688619..089b83530a 100644 --- a/Core/src/org/sleuthkit/autopsy/filesearch/SizeSearchPanel.java +++ b/Core/src/org/sleuthkit/autopsy/filesearch/SizeSearchPanel.java @@ -162,11 +162,12 @@ class SizeSearchPanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addComponent(sizeCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(sizeCompareComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(sizeCompareComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(sizeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(sizeTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(sizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(sizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(63, 63, 63)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) diff --git a/Core/src/org/sleuthkit/autopsy/imagewriter/ImageWriter.java b/Core/src/org/sleuthkit/autopsy/imagewriter/ImageWriter.java index 3cd166a1b5..dcdbca0379 100644 --- a/Core/src/org/sleuthkit/autopsy/imagewriter/ImageWriter.java +++ b/Core/src/org/sleuthkit/autopsy/imagewriter/ImageWriter.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,6 +32,7 @@ import java.util.logging.Level; import org.netbeans.api.progress.ProgressHandle; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.core.RuntimeProperties; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.Image; @@ -78,12 +79,12 @@ class ImageWriter implements PropertyChangeListener{ this.settings = settings; doUI = RuntimeProperties.runningWithGUI(); - // We save the reference to the sleuthkit case here in case getCurrentCase() is set to + // We save the reference to the sleuthkit case here in case getOpenCase() is set to // null before Image Writer finishes. The user can still elect to wait for image writer // (in ImageWriterService.closeCaseResources) even though the case is closing. try{ - caseDb = Case.getCurrentCase().getSleuthkitCase(); - } catch (IllegalStateException ex){ + caseDb = Case.getOpenCase().getSleuthkitCase(); + } catch (NoCurrentCaseException ex){ logger.log(Level.SEVERE, "Unable to load case. Image writer will be cancelled."); this.isCancelled = true; } @@ -151,10 +152,10 @@ class ImageWriter implements PropertyChangeListener{ Image image; try{ - image = Case.getCurrentCase().getSleuthkitCase().getImageById(dataSourceId); + image = Case.getOpenCase().getSleuthkitCase().getImageById(dataSourceId); imageHandle = image.getImageHandle(); - } catch (IllegalStateException ex){ - // This exception means that getCurrentCase() failed because no case was open. + } catch (NoCurrentCaseException ex){ + // This exception means that getOpenCase() failed because no case was open. // This can happen when the user closes the case while ingest is ongoing - canceling // ingest fires off the DataSourceAnalysisCompletedEvent while the case is in the // process of closing. diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form index 2d2f730188..b58ddaa1ac 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form @@ -42,11 +42,11 @@ - + - + @@ -69,7 +69,7 @@ - + @@ -132,7 +132,7 @@ - + @@ -146,12 +146,12 @@ - + - - + + @@ -221,9 +221,6 @@ - - - @@ -237,9 +234,6 @@ - - - @@ -259,9 +253,6 @@ - - - diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index 8feb3d0bb2..18d19c9060 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -43,6 +43,7 @@ import javax.swing.table.TableColumn; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.IngestJobInfoPanel; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog; import org.sleuthkit.autopsy.modules.interestingitems.FilesSet; import org.sleuthkit.autopsy.modules.interestingitems.FilesSetDefsPanel; @@ -97,9 +98,9 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { this.settings = settings; this.dataSources.addAll(dataSources); try { - SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase(); + SleuthkitCase skCase = Case.getOpenCase().getSleuthkitCase(); ingestJobs.addAll(skCase.getIngestJobs()); - } catch (IllegalStateException ex) { + } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "No open case", ex); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Failed to load ingest job information", ex); @@ -265,7 +266,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { .addGap(8, 8, 8) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(descriptionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) - .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 320, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(globalSettingsButton))) @@ -275,11 +276,11 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap() - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE) .addGap(18, 18, 18) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(8, 8, 8) - .addComponent(descriptionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(descriptionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(globalSettingsButton) .addGap(8, 8, 8)) @@ -289,7 +290,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { jButtonSelectAll.setMargin(new java.awt.Insets(2, 8, 2, 8)); jButtonSelectAll.setMaximumSize(new java.awt.Dimension(87, 23)); jButtonSelectAll.setMinimumSize(new java.awt.Dimension(87, 23)); - jButtonSelectAll.setPreferredSize(new java.awt.Dimension(86, 23)); jButtonSelectAll.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonSelectAllActionPerformed(evt); @@ -298,7 +298,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { jButtonDeselectAll.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.jButtonDeselectAll.text")); // NOI18N jButtonDeselectAll.setMargin(new java.awt.Insets(2, 8, 2, 8)); - jButtonDeselectAll.setPreferredSize(new java.awt.Dimension(86, 23)); jButtonDeselectAll.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonDeselectAllActionPerformed(evt); @@ -309,7 +308,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { pastJobsButton.setMargin(new java.awt.Insets(2, 8, 2, 8)); pastJobsButton.setMaximumSize(new java.awt.Dimension(87, 23)); pastJobsButton.setMinimumSize(new java.awt.Dimension(87, 23)); - pastJobsButton.setPreferredSize(new java.awt.Dimension(87, 23)); pastJobsButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { pastJobsButtonActionPerformed(evt); @@ -339,10 +337,10 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(pastJobsButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(modulesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(fileIngestFilterLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(fileIngestFilterLabel) .addComponent(fileIngestFilterComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(4, 4, 4) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 284, Short.MAX_VALUE) .addGap(5, 5, 5)) ); @@ -362,9 +360,9 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButtonSelectAll, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jButtonDeselectAll, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButtonDeselectAll) .addComponent(pastJobsButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE)) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE)) .addContainerGap()) ); }// //GEN-END:initComponents diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java index 089ebfc53e..13d67f9e9c 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java @@ -50,6 +50,7 @@ import org.openide.util.Cancellable; import org.openide.util.NbBundle; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.core.RuntimeProperties; import org.sleuthkit.autopsy.core.ServicesMonitor; import org.sleuthkit.autopsy.core.UserPreferences; @@ -190,10 +191,10 @@ public class IngestManager { * only necessary for multi-user cases. */ try { - if (Case.getCurrentCase().getCaseType() != Case.CaseType.MULTI_USER_CASE) { + if (Case.getOpenCase().getCaseType() != Case.CaseType.MULTI_USER_CASE) { return; } - } catch (IllegalStateException noCaseOpenException) { + } catch (NoCurrentCaseException noCaseOpenException) { return; } @@ -251,13 +252,13 @@ public class IngestManager { caseIsOpen = true; clearIngestMessageBox(); try { - Case openedCase = Case.getCurrentCase(); + Case openedCase = Case.getOpenCase(); String channelPrefix = openedCase.getName(); if (Case.CaseType.MULTI_USER_CASE == openedCase.getCaseType()) { jobEventPublisher.openRemoteEventChannel(String.format(INGEST_JOB_EVENT_CHANNEL_NAME, channelPrefix)); moduleEventPublisher.openRemoteEventChannel(String.format(INGEST_MODULE_EVENT_CHANNEL_NAME, channelPrefix)); } - } catch (IllegalStateException | AutopsyEventException ex) { + } catch (NoCurrentCaseException | AutopsyEventException ex) { logger.log(Level.SEVERE, "Failed to open remote events channel", ex); //NON-NLS MessageNotifyUtil.Notify.error(NbBundle.getMessage(IngestManager.class, "IngestManager.OpenEventChannel.Fail.Title"), NbBundle.getMessage(IngestManager.class, "IngestManager.OpenEventChannel.Fail.ErrMsg")); @@ -347,61 +348,65 @@ public class IngestManager { }) private IngestJobStartResult startIngestJob(IngestJob job) { List errors = null; - if (caseIsOpen) { - if (Case.getCurrentCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) { - try { - if (!servicesMonitor.getServiceStatus(ServicesMonitor.Service.REMOTE_CASE_DATABASE.toString()).equals(ServicesMonitor.ServiceStatus.UP.toString())) { - if (RuntimeProperties.runningWithGUI()) { - EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - String serviceDisplayName = ServicesMonitor.Service.REMOTE_CASE_DATABASE.getDisplayName(); - JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), - NbBundle.getMessage(this.getClass(), "IngestManager.cancellingIngest.msgDlg.text"), - NbBundle.getMessage(this.getClass(), "IngestManager.serviceIsDown.msgDlg.text", serviceDisplayName), - JOptionPane.ERROR_MESSAGE); - } - }); - } - return new IngestJobStartResult(null, new IngestManagerException("Ingest aborted. Remote database is down"), Collections.emptyList()); //NON-NLS + Case openCase; + try { + openCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + return new IngestJobStartResult(null, new IngestManagerException("Exception while getting open case.", ex), Collections.emptyList()); //NON-NLS + } + if (openCase.getCaseType() == Case.CaseType.MULTI_USER_CASE) { + try { + if (!servicesMonitor.getServiceStatus(ServicesMonitor.Service.REMOTE_CASE_DATABASE.toString()).equals(ServicesMonitor.ServiceStatus.UP.toString())) { + if (RuntimeProperties.runningWithGUI()) { + EventQueue.invokeLater(new Runnable() { + @Override + public void run() { + String serviceDisplayName = ServicesMonitor.Service.REMOTE_CASE_DATABASE.getDisplayName(); + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), + NbBundle.getMessage(this.getClass(), "IngestManager.cancellingIngest.msgDlg.text"), + NbBundle.getMessage(this.getClass(), "IngestManager.serviceIsDown.msgDlg.text", serviceDisplayName), + JOptionPane.ERROR_MESSAGE); + } + }); } - } catch (ServicesMonitor.ServicesMonitorException ex) { - return new IngestJobStartResult(null, new IngestManagerException("Database server is down", ex), Collections.emptyList()); //NON-NLS + return new IngestJobStartResult(null, new IngestManagerException("Ingest aborted. Remote database is down"), Collections.emptyList()); //NON-NLS } + } catch (ServicesMonitor.ServicesMonitorException ex) { + return new IngestJobStartResult(null, new IngestManagerException("Database server is down", ex), Collections.emptyList()); //NON-NLS } + } - if (!ingestMonitor.isRunning()) { - ingestMonitor.start(); + if (!ingestMonitor.isRunning()) { + ingestMonitor.start(); + } + + ingestJobsById.put(job.getId(), job); + errors = job.start(); + if (errors.isEmpty()) { + this.fireIngestJobStarted(job.getId()); + IngestManager.logger.log(Level.INFO, "Ingest job {0} started", job.getId()); //NON-NLS + } else { + this.ingestJobsById.remove(job.getId()); + for (IngestModuleError error : errors) { + logger.log(Level.SEVERE, String.format("Error starting %s ingest module for job %d", error.getModuleDisplayName(), job.getId()), error.getThrowable()); //NON-NLS } - - ingestJobsById.put(job.getId(), job); - errors = job.start(); - if (errors.isEmpty()) { - this.fireIngestJobStarted(job.getId()); - IngestManager.logger.log(Level.INFO, "Ingest job {0} started", job.getId()); //NON-NLS - } else { - this.ingestJobsById.remove(job.getId()); + IngestManager.logger.log(Level.SEVERE, "Ingest job {0} could not be started", job.getId()); //NON-NLS + if (RuntimeProperties.runningWithGUI()) { + final StringBuilder message = new StringBuilder(1024); + message.append(Bundle.IngestManager_startupErr_dlgMsg()).append("\n"); //NON-NLS + message.append(Bundle.IngestManager_startupErr_dlgSolution()).append("\n\n"); //NON-NLS + message.append(Bundle.IngestManager_startupErr_dlgErrorList()).append("\n"); //NON-NLS for (IngestModuleError error : errors) { - logger.log(Level.SEVERE, String.format("Error starting %s ingest module for job %d", error.getModuleDisplayName(), job.getId()), error.getThrowable()); //NON-NLS + String moduleName = error.getModuleDisplayName(); + String errorMessage = error.getThrowable().getLocalizedMessage(); + message.append(moduleName).append(": ").append(errorMessage).append("\n"); //NON-NLS } - IngestManager.logger.log(Level.SEVERE, "Ingest job {0} could not be started", job.getId()); //NON-NLS - if (RuntimeProperties.runningWithGUI()) { - final StringBuilder message = new StringBuilder(1024); - message.append(Bundle.IngestManager_startupErr_dlgMsg()).append("\n"); //NON-NLS - message.append(Bundle.IngestManager_startupErr_dlgSolution()).append("\n\n"); //NON-NLS - message.append(Bundle.IngestManager_startupErr_dlgErrorList()).append("\n"); //NON-NLS - for (IngestModuleError error : errors) { - String moduleName = error.getModuleDisplayName(); - String errorMessage = error.getThrowable().getLocalizedMessage(); - message.append(moduleName).append(": ").append(errorMessage).append("\n"); //NON-NLS - } - message.append("\n\n"); - EventQueue.invokeLater(() -> { - JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), message, Bundle.IngestManager_startupErr_dlgTitle(), JOptionPane.ERROR_MESSAGE); - }); - } - return new IngestJobStartResult(null, new IngestManagerException("Errors occurred while starting ingest"), errors); //NON-NLS + message.append("\n\n"); + EventQueue.invokeLater(() -> { + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), message, Bundle.IngestManager_startupErr_dlgTitle(), JOptionPane.ERROR_MESSAGE); + }); } + return new IngestJobStartResult(null, new IngestManagerException("Errors occurred while starting ingest"), errors); //NON-NLS } return new IngestJobStartResult(job, null, errors); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestMessageDetailsPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/IngestMessageDetailsPanel.form index a5472cdc25..2ce86e07d2 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestMessageDetailsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestMessageDetailsPanel.form @@ -150,9 +150,6 @@ - - - @@ -172,9 +169,6 @@ - - - diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestMessageDetailsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestMessageDetailsPanel.java index 2659ce400a..363a11b969 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestMessageDetailsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestMessageDetailsPanel.java @@ -142,7 +142,6 @@ class IngestMessageDetailsPanel extends javax.swing.JPanel { viewArtifactButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/ingest/goto_res.png"))); // NOI18N viewArtifactButton.setText(org.openide.util.NbBundle.getMessage(IngestMessageDetailsPanel.class, "IngestMessageDetailsPanel.viewArtifactButton.text")); // NOI18N viewArtifactButton.setIconTextGap(2); - viewArtifactButton.setPreferredSize(new java.awt.Dimension(93, 23)); viewArtifactButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { viewArtifactButtonActionPerformed(evt); @@ -154,7 +153,6 @@ class IngestMessageDetailsPanel extends javax.swing.JPanel { viewContentButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/ingest/goto_dir.png"))); // NOI18N viewContentButton.setText(org.openide.util.NbBundle.getMessage(IngestMessageDetailsPanel.class, "IngestMessageDetailsPanel.viewContentButton.text")); // NOI18N viewContentButton.setIconTextGap(2); - viewContentButton.setPreferredSize(new java.awt.Dimension(111, 23)); viewContentButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { viewContentButtonActionPerformed(evt); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestMessagePanel.form b/Core/src/org/sleuthkit/autopsy/ingest/IngestMessagePanel.form index 932ef4c075..cffdc11205 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestMessagePanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestMessagePanel.form @@ -20,7 +20,7 @@ - + @@ -105,11 +105,11 @@ - + - + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestMessagePanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestMessagePanel.java index b90844c538..f9063b289c 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestMessagePanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestMessagePanel.java @@ -181,11 +181,11 @@ class IngestMessagePanel extends JPanel implements TableModelListener { .addGap(101, 101, 101) .addComponent(totalMessagesNameLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(totalMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE) + .addComponent(totalMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(22, 22, 22) .addComponent(totalUniqueMessagesNameLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(totalUniqueMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE) + .addComponent(totalUniqueMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(22, 22, 22)) ); controlPanelLayout.setVerticalGroup( @@ -204,7 +204,7 @@ class IngestMessagePanel extends JPanel implements TableModelListener { layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(controlPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.form index 8434d1f38d..ee5930d82f 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.form @@ -77,7 +77,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.java index 09408d1125..ed02db96cb 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.java @@ -211,7 +211,7 @@ final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabelProcessTimeOutUnits))) .addGap(213, 213, 213))) - .addContainerGap(52, Short.MAX_VALUE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(ingestWarningLabel) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/ProfilePanel.form b/Core/src/org/sleuthkit/autopsy/ingest/ProfilePanel.form index fc32cf5528..d570baa6c6 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/ProfilePanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/ProfilePanel.form @@ -43,8 +43,8 @@ - - + + @@ -66,7 +66,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/ProfilePanel.java b/Core/src/org/sleuthkit/autopsy/ingest/ProfilePanel.java index 8040893fcf..83b7cd3036 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/ProfilePanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/ProfilePanel.java @@ -133,8 +133,8 @@ class ProfilePanel extends IngestModuleGlobalSettingsPanel { .addGroup(jPanel2Layout.createSequentialGroup() .addGap(6, 6, 6) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(profileDescLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(profileNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(profileDescLabel) + .addComponent(profileNameLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(profileDescPane) @@ -151,7 +151,7 @@ class ProfilePanel extends IngestModuleGlobalSettingsPanel { .addComponent(profileNameLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(profileDescLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(profileDescLabel) .addComponent(profileDescPane, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(2, 2, 2)) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.form index a03fa2cd75..e9f3fc3801 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.form @@ -29,24 +29,21 @@ - - + + - - - - - - - - + + - + + + + + - - - + + @@ -66,7 +63,7 @@ - + @@ -118,25 +115,27 @@ - + - - + - - - - - - + + + + + + + + + - + @@ -172,81 +171,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -286,9 +210,6 @@ - - - @@ -408,5 +329,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java index 3dcbb6dc16..7e97fe0e7d 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java @@ -82,9 +82,6 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op profileListPane = new javax.swing.JScrollPane(); profileList = new javax.swing.JList<>(); profileListLabel = new javax.swing.JLabel(); - newProfileButton = new javax.swing.JButton(); - editProfileButton = new javax.swing.JButton(); - deleteProfileButton = new javax.swing.JButton(); profileDescPane = new javax.swing.JScrollPane(); profileDescArea = new javax.swing.JTextArea(); profileDescLabel = new javax.swing.JLabel(); @@ -99,6 +96,10 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op jSeparator2 = new javax.swing.JSeparator(); jScrollPane2 = new javax.swing.JScrollPane(); infoTextArea = new javax.swing.JTextArea(); + buttonEnclosingPanel = new javax.swing.JPanel(); + editProfileButton = new javax.swing.JButton(); + newProfileButton = new javax.swing.JButton(); + deleteProfileButton = new javax.swing.JButton(); setBorder(javax.swing.BorderFactory.createEtchedBorder()); setPreferredSize(new java.awt.Dimension(800, 488)); @@ -108,42 +109,6 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op org.openide.awt.Mnemonics.setLocalizedText(profileListLabel, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.profileListLabel.text")); // NOI18N - newProfileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(newProfileButton, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.newProfileButton.text")); // NOI18N - newProfileButton.setMargin(new java.awt.Insets(2, 6, 2, 6)); - newProfileButton.setMaximumSize(new java.awt.Dimension(111, 25)); - newProfileButton.setMinimumSize(new java.awt.Dimension(111, 25)); - newProfileButton.setPreferredSize(new java.awt.Dimension(111, 25)); - newProfileButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - newProfileButtonActionPerformed(evt); - } - }); - - editProfileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/edit16.png"))); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(editProfileButton, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.editProfileButton.text")); // NOI18N - editProfileButton.setMargin(new java.awt.Insets(2, 6, 2, 6)); - editProfileButton.setMaximumSize(new java.awt.Dimension(111, 25)); - editProfileButton.setMinimumSize(new java.awt.Dimension(111, 25)); - editProfileButton.setPreferredSize(new java.awt.Dimension(111, 25)); - editProfileButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - editProfileButtonActionPerformed(evt); - } - }); - - deleteProfileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/delete16.png"))); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(deleteProfileButton, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.deleteProfileButton.text")); // NOI18N - deleteProfileButton.setMargin(new java.awt.Insets(2, 6, 2, 6)); - deleteProfileButton.setMaximumSize(new java.awt.Dimension(111, 25)); - deleteProfileButton.setMinimumSize(new java.awt.Dimension(111, 25)); - deleteProfileButton.setPreferredSize(new java.awt.Dimension(111, 25)); - deleteProfileButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - deleteProfileButtonActionPerformed(evt); - } - }); - profileDescArea.setEditable(false); profileDescArea.setBackground(new java.awt.Color(240, 240, 240)); profileDescArea.setColumns(20); @@ -157,7 +122,6 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op org.openide.awt.Mnemonics.setLocalizedText(filterNameLabel, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.filterNameLabel.text")); // NOI18N filterNameLabel.setMinimumSize(new java.awt.Dimension(30, 14)); - filterNameLabel.setPreferredSize(new java.awt.Dimension(30, 14)); filterNameText.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); filterNameText.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); @@ -201,6 +165,66 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op infoTextArea.setWrapStyleWord(true); jScrollPane2.setViewportView(infoTextArea); + editProfileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/edit16.png"))); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(editProfileButton, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.editProfileButton.text")); // NOI18N + editProfileButton.setMargin(new java.awt.Insets(2, 6, 2, 6)); + editProfileButton.setMaximumSize(new java.awt.Dimension(111, 25)); + editProfileButton.setMinimumSize(new java.awt.Dimension(111, 25)); + editProfileButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + editProfileButtonActionPerformed(evt); + } + }); + + newProfileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(newProfileButton, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.newProfileButton.text")); // NOI18N + newProfileButton.setMargin(new java.awt.Insets(2, 6, 2, 6)); + newProfileButton.setMaximumSize(new java.awt.Dimension(111, 25)); + newProfileButton.setMinimumSize(new java.awt.Dimension(111, 25)); + newProfileButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + newProfileButtonActionPerformed(evt); + } + }); + + deleteProfileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/delete16.png"))); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(deleteProfileButton, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.deleteProfileButton.text")); // NOI18N + deleteProfileButton.setMargin(new java.awt.Insets(2, 6, 2, 6)); + deleteProfileButton.setMaximumSize(new java.awt.Dimension(111, 25)); + deleteProfileButton.setMinimumSize(new java.awt.Dimension(111, 25)); + deleteProfileButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + deleteProfileButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout buttonEnclosingPanelLayout = new javax.swing.GroupLayout(buttonEnclosingPanel); + buttonEnclosingPanel.setLayout(buttonEnclosingPanelLayout); + buttonEnclosingPanelLayout.setHorizontalGroup( + buttonEnclosingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(buttonEnclosingPanelLayout.createSequentialGroup() + .addContainerGap() + .addComponent(newProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(editProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(deleteProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + buttonEnclosingPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deleteProfileButton, editProfileButton, newProfileButton}); + + buttonEnclosingPanelLayout.setVerticalGroup( + buttonEnclosingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(buttonEnclosingPanelLayout.createSequentialGroup() + .addContainerGap() + .addGroup(buttonEnclosingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(newProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(editProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(deleteProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap()) + ); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -208,20 +232,17 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(newProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(editProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(deleteProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 346, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(profileListLabel)) - .addGap(6, 6, 6)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(profileListPane, javax.swing.GroupLayout.PREFERRED_SIZE, 346, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 346, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(profileListLabel)) + .addGap(6, 6, 6)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(profileListPane, javax.swing.GroupLayout.PREFERRED_SIZE, 346, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))) + .addGroup(layout.createSequentialGroup() + .addComponent(buttonEnclosingPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -238,7 +259,7 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(ingestWarningLabel) - .addGap(0, 69, Short.MAX_VALUE)) + .addGap(0, 0, Short.MAX_VALUE)) .addComponent(profileDescPane, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(selectedModulesPane, javax.swing.GroupLayout.Alignment.TRAILING))) .addGroup(layout.createSequentialGroup() @@ -257,9 +278,7 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op .addContainerGap()))) ); - layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deleteProfileButton, editProfileButton, newProfileButton}); - - layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jScrollPane2, profileListPane}); + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonEnclosingPanel, jScrollPane2, profileListPane}); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -281,21 +300,21 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(selectedModulesLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(selectedModulesPane, javax.swing.GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE)) + .addComponent(selectedModulesPane, javax.swing.GroupLayout.DEFAULT_SIZE, 173, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(profileListLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(profileListPane, javax.swing.GroupLayout.DEFAULT_SIZE, 356, Short.MAX_VALUE) - .addGap(0, 0, 0))) - .addGap(6, 6, 6) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(newProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(editProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(deleteProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(ingestWarningLabel)) - .addGap(6, 6, 6)) + .addComponent(profileListPane, javax.swing.GroupLayout.DEFAULT_SIZE, 332, Short.MAX_VALUE))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(11, 11, 11) + .addComponent(ingestWarningLabel)) + .addGroup(layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonEnclosingPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap()) .addComponent(jSeparator2))) ); }// //GEN-END:initComponents @@ -473,6 +492,7 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op } // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JPanel buttonEnclosingPanel; private javax.swing.JButton deleteProfileButton; private javax.swing.JButton editProfileButton; private javax.swing.JTextArea filterDescArea; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/events/BlackboardPostEvent.java b/Core/src/org/sleuthkit/autopsy/ingest/events/BlackboardPostEvent.java index 7846f122f3..9e05d538de 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/events/BlackboardPostEvent.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/events/BlackboardPostEvent.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,6 +26,7 @@ import java.util.logging.Level; import java.util.stream.Collectors; import javax.annotation.concurrent.Immutable; 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.autopsy.ingest.IngestManager; @@ -93,11 +94,11 @@ public final class BlackboardPostEvent extends AutopsyEvent implements Serializa SerializableEventData data = (SerializableEventData) super.getOldValue(); Collection artifacts = new ArrayList<>(); for (Long id : data.artifactIds) { - artifacts.add(Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifact(id)); + artifacts.add(Case.getOpenCase().getSleuthkitCase().getBlackboardArtifact(id)); } eventData = new ModuleDataEvent(data.moduleName, data.artifactTypeId, !artifacts.isEmpty() ? artifacts : null); return eventData; - } catch (IllegalStateException | TskCoreException ex) { + } catch (NoCurrentCaseException | TskCoreException ex) { logger.log(Level.SEVERE, "Error doing lazy load for remote event", ex); //NON-NLS return null; } diff --git a/Core/src/org/sleuthkit/autopsy/menuactions/DataContentDynamicMenu.java b/Core/src/org/sleuthkit/autopsy/menuactions/DataContentDynamicMenu.java index 40ae79064c..a677f8042a 100644 --- a/Core/src/org/sleuthkit/autopsy/menuactions/DataContentDynamicMenu.java +++ b/Core/src/org/sleuthkit/autopsy/menuactions/DataContentDynamicMenu.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit 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 } diff --git a/Core/src/org/sleuthkit/autopsy/menuactions/DataExplorerDynamicMenu.java b/Core/src/org/sleuthkit/autopsy/menuactions/DataExplorerDynamicMenu.java index 16776ecdf4..38377d0f28 100644 --- a/Core/src/org/sleuthkit/autopsy/menuactions/DataExplorerDynamicMenu.java +++ b/Core/src/org/sleuthkit/autopsy/menuactions/DataExplorerDynamicMenu.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit 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 } diff --git a/Core/src/org/sleuthkit/autopsy/menuactions/SpacerPanel.java b/Core/src/org/sleuthkit/autopsy/menuactions/SpacerPanel.java index 8738be1686..c57f0b32a9 100644 --- a/Core/src/org/sleuthkit/autopsy/menuactions/SpacerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/menuactions/SpacerPanel.java @@ -31,7 +31,7 @@ import org.openide.util.actions.Presenter; class SpacerPanel extends javax.swing.JPanel { SpacerPanel() { - this.setPreferredSize(new Dimension(2000, 20)); + this.setPreferredSize(new Dimension(1000, 20)); } } diff --git a/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/Bundle.properties index 95ce1719ef..37cfd1d8b2 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/Bundle.properties @@ -1,6 +1,6 @@ EncryptionDetectionIngestJobSettingsPanel.minimumEntropyLabel.text=Minimum Entropy: EncryptionDetectionIngestJobSettingsPanel.minimumFileSizeLabel.text=Minimum File Size: -EncryptionDetectionIngestJobSettingsPanel.fileSizeMultiplesEnforcedCheckbox.text=Consider only files with sizes that are multiples of 512. +EncryptionDetectionIngestJobSettingsPanel.fileSizeMultiplesEnforcedCheckbox.text=Consider only file sizes that are multiples of 512. EncryptionDetectionIngestJobSettingsPanel.slackFilesAllowedCheckbox.text=Consider slack space files. EncryptionDetectionIngestJobSettingsPanel.mbLabel.text=MB EncryptionDetectionIngestJobSettingsPanel.detectionSettingsLabel.text=Detection Settings diff --git a/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionFileIngestModule.java index 685f85f6b2..0e618ba9c9 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionFileIngestModule.java @@ -37,6 +37,7 @@ import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.ReadContentInputStream; +import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskData; @@ -100,6 +101,9 @@ final class EncryptionDetectionFileIngestModule extends FileIngestModuleAdapter if (isFileEncrypted(file)) { return flagFile(file); } + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Unable to read file '%s'", file.getParentPath() + file.getName()), ex); + return IngestModule.ProcessResult.ERROR; } catch (IOException | TskCoreException ex) { logger.log(Level.SEVERE, String.format("Unable to process file '%s'", file.getParentPath() + file.getName()), ex); return IngestModule.ProcessResult.ERROR; @@ -184,7 +188,7 @@ final class EncryptionDetectionFileIngestModule extends FileIngestModuleAdapter * * @return True if the AbstractFile is encrypted. */ - private boolean isFileEncrypted(AbstractFile file) throws IOException, TskCoreException { + private boolean isFileEncrypted(AbstractFile file) throws ReadContentInputStreamException, IOException, TskCoreException { /* * Criteria for the checks in this method are partially based on * http://www.forensicswiki.org/wiki/TrueCrypt#Detection @@ -223,13 +227,9 @@ final class EncryptionDetectionFileIngestModule extends FileIngestModuleAdapter } if (possiblyEncrypted) { - try { - calculatedEntropy = calculateEntropy(file); - if (calculatedEntropy >= minimumEntropy) { - return true; - } - } catch (IOException ex) { - throw new IOException("Unable to calculate the entropy.", ex); + calculatedEntropy = calculateEntropy(file); + if (calculatedEntropy >= minimumEntropy) { + return true; } } @@ -247,7 +247,7 @@ final class EncryptionDetectionFileIngestModule extends FileIngestModuleAdapter * @throws IOException If there is a failure closing or reading from the * InputStream. */ - private double calculateEntropy(AbstractFile file) throws IOException { + private double calculateEntropy(AbstractFile file) throws ReadContentInputStreamException, IOException { /* * Logic in this method is based on * https://github.com/willjasen/entropy/blob/master/entropy.java @@ -283,18 +283,12 @@ final class EncryptionDetectionFileIngestModule extends FileIngestModuleAdapter return -entropyAccumulator; - } catch (IOException ex) { - throw new IOException("IOException occurred while trying to read data from InputStream.", ex); } finally { - try { - if (in != null) { - in.close(); - } - if (bin != null) { - bin.close(); - } - } catch (IOException ex) { - throw new IOException("Failed to close InputStream.", ex); + if (in != null) { + in.close(); + } + if (bin != null) { + bin.close(); } } } diff --git a/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionIngestJobSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionIngestJobSettingsPanel.form index c2bb97607e..2f66c65b81 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionIngestJobSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionIngestJobSettingsPanel.form @@ -35,7 +35,7 @@ - + @@ -59,7 +59,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionIngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionIngestJobSettingsPanel.java index eb318ccdfd..b4e2ed487a 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionIngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionIngestJobSettingsPanel.java @@ -174,7 +174,7 @@ final class EncryptionDetectionIngestJobSettingsPanel extends IngestModuleIngest .addComponent(minimumEntropyLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(minimumEntropyTextbox, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addContainerGap(15, Short.MAX_VALUE)) + .addContainerGap(33, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -194,7 +194,7 @@ final class EncryptionDetectionIngestJobSettingsPanel extends IngestModuleIngest .addComponent(fileSizeMultiplesEnforcedCheckbox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(slackFilesAllowedCheckbox) - .addContainerGap(160, Short.MAX_VALUE)) + .addContainerGap(60, Short.MAX_VALUE)) ); }// //GEN-END:initComponents diff --git a/Core/src/org/sleuthkit/autopsy/modules/exif/ExifParserFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/exif/ExifParserFileIngestModule.java index 7aa1224e18..4b7703dbd2 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/exif/ExifParserFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/exif/ExifParserFileIngestModule.java @@ -56,6 +56,7 @@ import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Image; import org.sleuthkit.datamodel.ReadContentInputStream; +import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskData; import org.sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM; @@ -221,10 +222,13 @@ public final class ExifParserFileIngestModule implements FileIngestModule { logger.log(Level.WARNING, "Failed to create blackboard artifact for exif metadata ({0}).", ex.getLocalizedMessage()); //NON-NLS return ProcessResult.ERROR; } catch (ImageProcessingException ex) { - logger.log(Level.WARNING, "Failed to process the image file: {0}/{1}({2})", new Object[]{f.getParentPath(), f.getName(), ex.getLocalizedMessage()}); //NON-NLS + logger.log(Level.WARNING, String.format("Failed to process the image file '%s/%s' (id=%d).", f.getParentPath(), f.getName(), f.getId()), ex); + return ProcessResult.ERROR; + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Error while trying to read image file '%s/%s' (id=%d).", f.getParentPath(), f.getName(), f.getId()), ex); //NON-NLS return ProcessResult.ERROR; } catch (IOException ex) { - logger.log(Level.WARNING, "IOException when parsing image file: " + f.getParentPath() + "/" + f.getName(), ex); //NON-NLS + logger.log(Level.WARNING, String.format("IOException when parsing image file '%s/%s' (id=%d).", f.getParentPath(), f.getName(), f.getId()), ex); //NON-NLS return ProcessResult.ERROR; } finally { try { diff --git a/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchSettingsPanel.form index f8ffc03428..2d4792aa7b 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchSettingsPanel.form @@ -119,11 +119,11 @@ - + - + - + @@ -165,9 +165,6 @@ - - - diff --git a/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchSettingsPanel.java index 85de3cbdb3..3306d57192 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchSettingsPanel.java @@ -175,7 +175,6 @@ final class FileExtMismatchSettingsPanel extends IngestModuleGlobalSettingsPanel newTypeButton.setText(org.openide.util.NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newTypeButton.text")); // NOI18N newTypeButton.setMaximumSize(new java.awt.Dimension(111, 25)); newTypeButton.setMinimumSize(new java.awt.Dimension(111, 25)); - newTypeButton.setPreferredSize(new java.awt.Dimension(111, 25)); newTypeButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newTypeButtonActionPerformed(evt); @@ -217,11 +216,11 @@ final class FileExtMismatchSettingsPanel extends IngestModuleGlobalSettingsPanel .addContainerGap() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 348, Short.MAX_VALUE) + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(mimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(mimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(newTypeButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(removeTypeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(removeTypeButton)) .addContainerGap()) ); diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignaturePanel.form b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignaturePanel.form index ec7f274f55..95bbf74b67 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignaturePanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignaturePanel.form @@ -22,17 +22,17 @@ - + - + - + @@ -42,7 +42,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignaturePanel.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignaturePanel.java index 69a6c8ffcc..c22ecd94a7 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignaturePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignaturePanel.java @@ -201,10 +201,10 @@ class AddFileTypeSignaturePanel extends javax.swing.JPanel { offsetLabel = new javax.swing.JLabel(); offsetTextField = new javax.swing.JTextField(); - offsetRelativeToComboBox = new javax.swing.JComboBox(); + offsetRelativeToComboBox = new javax.swing.JComboBox<>(); offsetRelativeToLabel = new javax.swing.JLabel(); hexPrefixLabel = new javax.swing.JLabel(); - signatureTypeComboBox = new javax.swing.JComboBox(); + signatureTypeComboBox = new javax.swing.JComboBox<>(); signatureLabel = new javax.swing.JLabel(); signatureTypeLabel = new javax.swing.JLabel(); signatureTextField = new javax.swing.JTextField(); @@ -254,22 +254,22 @@ class AddFileTypeSignaturePanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addComponent(signatureTypeLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(signatureTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(signatureTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() - .addComponent(signatureLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(signatureLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(hexPrefixLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(signatureTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() - .addComponent(offsetLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(offsetLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(offsetTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(offsetRelativeToLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(offsetRelativeToComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addContainerGap(26, Short.MAX_VALUE)) + .addContainerGap(46, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdGlobalSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdGlobalSettingsPanel.form index 6c43f9f929..5504213af7 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdGlobalSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdGlobalSettingsPanel.form @@ -52,7 +52,7 @@ - + @@ -144,7 +144,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdGlobalSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdGlobalSettingsPanel.java index 285482fb17..600bf48a2f 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdGlobalSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdGlobalSettingsPanel.java @@ -377,7 +377,7 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(newTypeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(newTypeButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(editTypeButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -455,7 +455,7 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(ingestRunningWarningLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 761, Short.MAX_VALUE)) + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 728, Short.MAX_VALUE)) .addContainerGap()) ); jPanel3Layout.setVerticalGroup( diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseDialog.form b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseDialog.form index 874a617ba1..da0b07d99d 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseDialog.form +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseDialog.form @@ -30,16 +30,16 @@ - - + + - - + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseDialog.java index 132bfb4d66..9f7061b618 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseDialog.java @@ -137,14 +137,14 @@ public class AddHashValuesToDatabaseDialog extends javax.swing.JDialog { .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(instructionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 41, Short.MAX_VALUE)) + .addComponent(instructionLabel) + .addGap(0, 0, Short.MAX_VALUE)) .addComponent(jScrollPane1)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(AddValuesToHashDatabaseButton, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(cancelButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(pasteFromClipboardButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(cancelButton, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(pasteFromClipboardButton, javax.swing.GroupLayout.Alignment.TRAILING)) .addContainerGap()) ); layout.setVerticalGroup( diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseProgressDialog.form b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseProgressDialog.form index 6d50bbfce6..0d27f545c0 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseProgressDialog.form +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseProgressDialog.form @@ -28,7 +28,7 @@ - + @@ -36,11 +36,11 @@ - - + + - + @@ -53,9 +53,9 @@ - - - + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseProgressDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseProgressDialog.java index 522e958530..06c584e643 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseProgressDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseProgressDialog.java @@ -216,16 +216,16 @@ public class AddHashValuesToDatabaseProgressDialog extends javax.swing.JDialog { layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(statusLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(showErrorsButton)) .addGroup(layout.createSequentialGroup() .addComponent(addingHashesToDatabaseProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addComponent(okButton, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 55, Short.MAX_VALUE) + .addComponent(okButton))) + .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -235,9 +235,9 @@ public class AddHashValuesToDatabaseProgressDialog extends javax.swing.JDialog { .addComponent(addingHashesToDatabaseProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(okButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(showErrorsButton) - .addComponent(statusLabel)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(statusLabel) + .addComponent(showErrorsButton)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties index b1600cd89d..c5f6d82425 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties @@ -135,7 +135,7 @@ The generated index will be left unusable. If you choose to continue,\n\ please delete the corresponding -md5.idx file in the hash folder.\n\ Exit indexing? ModalNoButtons.dlgTitle.unfinishedIndexing=Unfinished Indexing -ModalNoButtons.indexThis.currentlyIndexing1Db=Currently indexing 1 hash set +ModalNoButtons.indexThis.currentlyIndexing1Db=Currently indexing 1 hash set ModalNoButtons.indexThese.currentlyIndexing1OfNDbs=Currently indexing 1 of {0} ModalNoButtons.propChg.currentlyIndexingXofN=Currently indexing {0} of {1} HashDbManager.duplicateHashSetNameExceptionMsg=The hash set name ''{0}'' has already been used for another hash set. diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.form b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.form index 368903a9d6..7c74b4b583 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.form +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.form @@ -31,24 +31,15 @@ - - - - - + + - - - - - - - + - + - + @@ -56,14 +47,14 @@ - - + + - + @@ -71,16 +62,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - @@ -119,7 +129,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java index 6350de10dd..4aa976be97 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java @@ -295,44 +295,50 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog { layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(sendIngestMessagesCheckbox) - .addComponent(jLabel2) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() - .addGap(20, 20, 20) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(knownRadioButton) - .addComponent(knownBadRadioButton))) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addGroup(layout.createSequentialGroup() + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(lbOrg) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(orgComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(orgComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(orgButton, javax.swing.GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(orgButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3) .addComponent(jLabel4) .addComponent(databasePathLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(fileTypeRadioButton) .addGap(22, 22, 22) .addComponent(centralRepoRadioButton)) - .addComponent(hashSetNameTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 305, Short.MAX_VALUE) + .addComponent(hashSetNameTextField) .addComponent(databasePathTextField)))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(saveAsButton))) + .addComponent(saveAsButton)) + .addGroup(layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(okButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cancelButton))) + .addGap(88, 88, 88)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(32, 32, 32) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(knownRadioButton) + .addComponent(knownBadRadioButton))) + .addGroup(layout.createSequentialGroup() + .addGap(12, 12, 12) + .addComponent(jLabel2)) + .addGroup(layout.createSequentialGroup() + .addGap(12, 12, 12) + .addComponent(sendIngestMessagesCheckbox))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(okButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cancelButton) - .addContainerGap()) ); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {cancelButton, okButton}); @@ -369,7 +375,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(sendIngestMessagesCheckbox) - .addGap(0, 27, Short.MAX_VALUE)) + .addGap(0, 0, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.form b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.form index dbb9f7b4e3..fe5cedc889 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.form +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.form @@ -43,13 +43,12 @@ - + - @@ -57,14 +56,13 @@ - - + - - + + @@ -78,10 +76,13 @@ + + + + - @@ -95,9 +96,10 @@ - + + @@ -110,7 +112,6 @@ - @@ -144,7 +145,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java index ddbde90c60..a2d041280d 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java @@ -301,23 +301,21 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog { .addComponent(fileTypeRadioButton) .addGap(26, 26, 26) .addComponent(centralRepoRadioButton) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(0, 0, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addComponent(databasePathTextField) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(openButton) - .addContainerGap()))) + .addComponent(openButton)))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(sendIngestMessagesCheckbox) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(okButton)) + .addGap(0, 0, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(lbOrg) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(orgComboBox, 0, 121, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(orgComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(orgButton)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -326,10 +324,12 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog { .addGap(40, 40, 40) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(versionTextField) - .addComponent(hashSetNameTextField)))) + .addComponent(hashSetNameTextField))) + .addGroup(layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(okButton))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(cancelButton) - .addContainerGap()) + .addComponent(cancelButton)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) @@ -339,7 +339,8 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(knownRadioButton) .addComponent(knownBadRadioButton)))) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) ); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {cancelButton, okButton}); @@ -352,7 +353,6 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog { .addComponent(databasePathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3) .addComponent(openButton)) - .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) @@ -382,7 +382,7 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog { .addComponent(readOnlyCheckbox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(sendIngestMessagesCheckbox) - .addGap(0, 21, Short.MAX_VALUE)) + .addGap(0, 39, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchAction.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchAction.java index 61c2fe699e..7d4ec611b6 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchAction.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchAction.java @@ -24,6 +24,7 @@ import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.util.actions.CallableSystemAction; import org.openide.windows.WindowManager; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.datamodel.ContentUtils; import org.sleuthkit.autopsy.directorytree.HashSearchProvider; import org.sleuthkit.datamodel.AbstractFile; @@ -118,8 +119,12 @@ public class HashDbSearchAction extends CallableSystemAction implements HashSear * performAction. */ @Override + @NbBundle.Messages ({ + "HashDbSearchAction.noOpenCase.errMsg=No open case available." + }) public void performAction() { // Make sure at least 1 file has an md5 hash + try { if (file != null && HashDbSearcher.countFilesMd5Hashed() > 0) { doSearch(); } else { @@ -129,6 +134,12 @@ public class HashDbSearchAction extends CallableSystemAction implements HashSear NbBundle.getMessage(this.getClass(), "HashDbSearchAction.dlgMsg.title"), JOptionPane.ERROR_MESSAGE); } + } catch (NoCurrentCaseException ex) { + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), + Bundle.HashDbSearchAction_noOpenCase_errMsg(), + NbBundle.getMessage(this.getClass(), "HashDbSearchAction.dlgMsg.title"), + JOptionPane.ERROR_MESSAGE); + } } private void doSearch() { diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchPanel.form b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchPanel.form index 49ec90449b..36eb1bddc9 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchPanel.form @@ -61,7 +61,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchPanel.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchPanel.java index 9f7642c69f..a75b47646e 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchPanel.java @@ -32,6 +32,7 @@ import javax.swing.table.DefaultTableModel; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.PlainDocument; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.ingest.IngestManager; /** @@ -154,7 +155,7 @@ class HashDbSearchPanel extends javax.swing.JPanel implements ActionListener { }, new String [] { - NbBundle.getMessage(this.getClass(), "HashDbSearchPanel.hashTable.defaultModel.title.text") + "MD5 Hashes" } ) { Class[] types = new Class [] { @@ -173,7 +174,9 @@ class HashDbSearchPanel extends javax.swing.JPanel implements ActionListener { } }); jScrollPane1.setViewportView(hashTable); + if (hashTable.getColumnModel().getColumnCount() > 0) { hashTable.getColumnModel().getColumn(0).setHeaderValue(org.openide.util.NbBundle.getMessage(HashDbSearchPanel.class, "HashDbSearchPanel.hashTable.columnModel.title0")); // NOI18N + } hashField.setText(org.openide.util.NbBundle.getMessage(HashDbSearchPanel.class, "HashDbSearchPanel.hashField.text")); // NOI18N @@ -240,7 +243,7 @@ class HashDbSearchPanel extends javax.swing.JPanel implements ActionListener { .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(hashLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(hashLabel) .addComponent(hashField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) @@ -290,16 +293,27 @@ class HashDbSearchPanel extends javax.swing.JPanel implements ActionListener { * Search through all tsk_files to find ones with the same hashes as the * hashes given. */ + @NbBundle.Messages ({ + "HashDbSearchPanel.noOpenCase.errMsg=No open case available." + }) boolean search() { // Check if any hashed have been entered if (hashTable.getRowCount() != 0) { // Make sure at least 1 file has an md5 hash - if (HashDbSearcher.countFilesMd5Hashed() > 0) { - return doSearch(); - } else { + try { + if (HashDbSearcher.countFilesMd5Hashed() > 0) { + return doSearch(); + } else { + JOptionPane.showMessageDialog(this, + NbBundle.getMessage(this.getClass(), + "HashDbSearchPanel.noFilesHaveMD5HashMsg"), + NbBundle.getMessage(this.getClass(), "HashDbSearchPanel.dlgMsg.title"), + JOptionPane.ERROR_MESSAGE); + return false; + } + } catch (NoCurrentCaseException ex) { JOptionPane.showMessageDialog(this, - NbBundle.getMessage(this.getClass(), - "HashDbSearchPanel.noFilesHaveMD5HashMsg"), + Bundle.HashDbSearchPanel_noOpenCase_errMsg(), NbBundle.getMessage(this.getClass(), "HashDbSearchPanel.dlgMsg.title"), JOptionPane.ERROR_MESSAGE); return false; diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearcher.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearcher.java index 628f99f78e..213400925f 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearcher.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearcher.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,9 +22,12 @@ import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.logging.Level; import javax.swing.SwingWorker; import org.netbeans.api.progress.ProgressHandle; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; +import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.FsContent; import org.sleuthkit.datamodel.SleuthkitCase; @@ -34,7 +37,7 @@ import org.sleuthkit.datamodel.SleuthkitCase; * the same content. */ class HashDbSearcher { - + private static final Logger logger = Logger.getLogger(HashDbSearcher.class.getName()); /** * Given a string hash value, find all files with that hash. * @@ -42,8 +45,8 @@ class HashDbSearcher { * * @return a List of all FsContent with the given hash */ - static List findFilesByMd5(String md5Hash) { - final Case currentCase = Case.getCurrentCase(); + static List findFilesByMd5(String md5Hash) throws NoCurrentCaseException { + final Case currentCase = Case.getOpenCase(); final SleuthkitCase skCase = currentCase.getSleuthkitCase(); return skCase.findFilesByMd5(md5Hash); } @@ -56,7 +59,7 @@ class HashDbSearcher { * * @return a Map of md5 hashes mapped to the list of files hit */ - static Map> findFilesBymd5(List md5Hash) { + static Map> findFilesBymd5(List md5Hash) throws NoCurrentCaseException { Map> map = new LinkedHashMap>(); for (String md5 : md5Hash) { List files = findFilesByMd5(md5); @@ -69,7 +72,7 @@ class HashDbSearcher { // Same as above, but with a given ProgressHandle to accumulate and StringWorker to check if cancelled - static Map> findFilesBymd5(List md5Hash, ProgressHandle progress, SwingWorker worker) { + static Map> findFilesBymd5(List md5Hash, ProgressHandle progress, SwingWorker worker) throws NoCurrentCaseException { Map> map = new LinkedHashMap>(); if (!worker.isCancelled()) { progress.switchToDeterminate(md5Hash.size()); @@ -101,9 +104,14 @@ class HashDbSearcher { */ static List findFiles(FsContent file) { String md5; - if ((md5 = file.getMd5Hash()) != null) { - return findFilesByMd5(md5); - } else { + try { + if ((md5 = file.getMd5Hash()) != null) { + return findFilesByMd5(md5); + } else { + return Collections.emptyList(); + } + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", ex); return Collections.emptyList(); } } @@ -114,8 +122,8 @@ class HashDbSearcher { * * @return true if the search feature is ready. */ - static boolean allFilesMd5Hashed() { - final Case currentCase = Case.getCurrentCase(); + static boolean allFilesMd5Hashed() throws NoCurrentCaseException { + final Case currentCase = Case.getOpenCase(); final SleuthkitCase skCase = currentCase.getSleuthkitCase(); return skCase.allFilesMd5Hashed(); } @@ -125,8 +133,8 @@ class HashDbSearcher { * * @return the number of files with an MD5 */ - static int countFilesMd5Hashed() { - final Case currentCase = Case.getCurrentCase(); + static int countFilesMd5Hashed() throws NoCurrentCaseException { + final Case currentCase = Case.getOpenCase(); final SleuthkitCase skCase = currentCase.getSleuthkitCase(); return skCase.countFilesMd5Hashed(); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupModuleSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupModuleSettingsPanel.form index 5fd29f9482..c0a486fce9 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupModuleSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupModuleSettingsPanel.form @@ -25,10 +25,10 @@ - - + + - + @@ -48,13 +48,13 @@ - + - + - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupModuleSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupModuleSettingsPanel.java index 63d7a25bfc..fbac01235e 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupModuleSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupModuleSettingsPanel.java @@ -336,9 +336,9 @@ public final class HashLookupModuleSettingsPanel extends IngestModuleIngestJobSe .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(knownHashDbsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 272, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 18, Short.MAX_VALUE)) - .addComponent(knownBadHashDbsLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(knownHashDbsLabel) + .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(knownBadHashDbsLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 290, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -353,13 +353,13 @@ public final class HashLookupModuleSettingsPanel extends IngestModuleIngestJobSe .addGap(2, 2, 2) .addComponent(knownHashDbsLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(knownBadHashDbsLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE) + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(alwaysCalcHashesCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(alwaysCalcHashesCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0)) ); }// //GEN-END:initComponents diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.form index d32cbf57d7..aebeb35828 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.form @@ -93,48 +93,48 @@ - + - + - - + + - - - - + + + + - + - - - - - - + + + + + + - - + + @@ -162,7 +162,7 @@ - + @@ -170,11 +170,11 @@ - + - + - + @@ -337,9 +337,6 @@ - - - @@ -367,9 +364,6 @@ - - - @@ -564,9 +558,6 @@ - - - diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.java index 5c1582ee85..1b7bf461d4 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.java @@ -657,7 +657,6 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan org.openide.awt.Mnemonics.setLocalizedText(deleteDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.deleteDatabaseButton.text")); // NOI18N deleteDatabaseButton.setMaximumSize(new java.awt.Dimension(140, 25)); deleteDatabaseButton.setMinimumSize(new java.awt.Dimension(140, 25)); - deleteDatabaseButton.setPreferredSize(new java.awt.Dimension(140, 25)); deleteDatabaseButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deleteDatabaseButtonActionPerformed(evt); @@ -670,7 +669,6 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan importDatabaseButton.setToolTipText(org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.importDatabaseButton.toolTipText")); // NOI18N importDatabaseButton.setMaximumSize(new java.awt.Dimension(140, 25)); importDatabaseButton.setMinimumSize(new java.awt.Dimension(140, 25)); - importDatabaseButton.setPreferredSize(new java.awt.Dimension(140, 25)); importDatabaseButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { importDatabaseButtonActionPerformed(evt); @@ -733,7 +731,6 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan createDatabaseButton.setToolTipText(org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.createDatabaseButton.toolTipText")); // NOI18N createDatabaseButton.setMaximumSize(new java.awt.Dimension(140, 25)); createDatabaseButton.setMinimumSize(new java.awt.Dimension(140, 25)); - createDatabaseButton.setPreferredSize(new java.awt.Dimension(140, 25)); createDatabaseButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { createDatabaseButtonActionPerformed(evt); @@ -776,7 +773,7 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(1, 1, 1) - .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 395, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() @@ -789,14 +786,14 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(indexLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(indexLabel) .addComponent(indexPathLabelLabel)) - .addGap(64, 64, 64) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(indexPathLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(hashDbIndexStatusLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(55, 55, 55) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(hashDbIndexStatusLabel) + .addComponent(indexPathLabel))) .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(indexButton, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(indexButton) .addGap(10, 10, 10) .addComponent(addHashesToDatabaseButton)) .addGroup(jPanel1Layout.createSequentialGroup() @@ -810,8 +807,8 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan .addGap(55, 55, 55) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(hashDbNameLabel) - .addComponent(hashDbTypeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(hashDbLocationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(hashDbTypeLabel) + .addComponent(hashDbLocationLabel) .addComponent(hashDbVersionLabel) .addComponent(hashDbOrgLabel) .addComponent(hashDbReadOnlyLabel))))) @@ -829,18 +826,21 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan .addGroup(jPanel1Layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(ingestWarningLabel)))) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + .addContainerGap(24, Short.MAX_VALUE)))) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(hashDatabasesLabel) .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(createDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(createDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(importDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(importDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(deleteDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(deleteDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(0, 0, Short.MAX_VALUE)))) ); + + jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {indexLabel, indexPathLabelLabel, locationLabel, nameLabel, orgLabel, readOnlyLabel, typeLabel, versionLabel}); + jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.form b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.form index 4d2ada136b..23897950cd 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.form +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.form @@ -35,13 +35,13 @@ - + - + @@ -56,7 +56,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java index bbcc503b08..88251f1f6e 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java @@ -382,10 +382,10 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(lbProgress)) - .addGap(0, 172, Short.MAX_VALUE)))) + .addGap(0, 0, Short.MAX_VALUE)))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(bnOk, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(bnOk) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(bnCancel) .addContainerGap()) @@ -398,7 +398,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lbProgress) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(bnCancel) diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ModalNoButtons.form b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ModalNoButtons.form index 7b77aaf054..87f00c82dd 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ModalNoButtons.form +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ModalNoButtons.form @@ -41,11 +41,11 @@ - + - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ModalNoButtons.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ModalNoButtons.java index 41a9fe4fe8..2d0d4f9bf4 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ModalNoButtons.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ModalNoButtons.java @@ -139,10 +139,10 @@ class ModalNoButtons extends javax.swing.JDialog implements PropertyChangeListen .addComponent(CURRENTLYON_LABEL) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(CURRENTDB_LABEL))) - .addGap(0, 161, Short.MAX_VALUE)) + .addGap(0, 0, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) - .addComponent(CANCEL_BUTTON, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(CANCEL_BUTTON))) .addContainerGap()) ); layout.setVerticalGroup( diff --git a/Core/src/org/sleuthkit/autopsy/modules/iOS/CallLogAnalyzer.java b/Core/src/org/sleuthkit/autopsy/modules/iOS/CallLogAnalyzer.java index cfc7272315..c337a9efe3 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/iOS/CallLogAnalyzer.java +++ b/Core/src/org/sleuthkit/autopsy/modules/iOS/CallLogAnalyzer.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2014 Basis Technology Corp. + * Copyright 2014-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,6 +29,7 @@ import java.util.List; import java.util.logging.Level; 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; @@ -37,10 +38,14 @@ import org.sleuthkit.autopsy.ingest.IngestJobContext; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; -class CallLogAnalyzer { +/** + * Look for call logs and allow resulting blackboard artifacts to be generated. + */ +final class CallLogAnalyzer { private Connection connection = null; private ResultSet resultSet = null; @@ -48,28 +53,42 @@ class CallLogAnalyzer { private String dbPath = ""; private long fileId = 0; private java.io.File jFile = null; - private String moduleName = iOSModuleFactory.getModuleName(); + private final String moduleName = iOSModuleFactory.getModuleName(); private static final Logger logger = Logger.getLogger(CallLogAnalyzer.class.getName()); private Blackboard blackboard; + /** + * Find call logs given an ingest job context and index the results. + * + * @param context The ingest job context. + */ public void findCallLogs(IngestJobContext context) { - blackboard = Case.getCurrentCase().getServices().getBlackboard(); + Case openCase; + try { + openCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS + return; + } + blackboard = openCase.getServices().getBlackboard(); List absFiles; try { - SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase(); + SleuthkitCase skCase = openCase.getSleuthkitCase(); absFiles = skCase.findAllFilesWhere("name ='contacts2.db' OR name ='contacts.db'"); //NON-NLS //get exact file names if (absFiles.isEmpty()) { return; } - for (AbstractFile AF : absFiles) { + for (AbstractFile file : absFiles) { try { - jFile = new java.io.File(Case.getCurrentCase().getTempDirectory(), AF.getName().replaceAll("[<>%|\"/:*\\\\]", "")); - ContentUtils.writeToFile(AF, jFile, context::dataSourceIngestIsCancelled); + jFile = new java.io.File(Case.getCurrentCase().getTempDirectory(), file.getName().replaceAll("[<>%|\"/:*\\\\]", "")); dbPath = jFile.toString(); //path of file as string - fileId = AF.getId(); + fileId = file.getId(); + ContentUtils.writeToFile(file, jFile, context::dataSourceIngestIsCancelled); findCallLogsInDB(dbPath, fileId); - } catch (Exception e) { - logger.log(Level.SEVERE, "Error parsing Call logs", e); //NON-NLS + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Error reading content from file '%s' (id=%d).", file.getName(), fileId), ex); //NON-NLS + } catch (Exception ex) { + logger.log(Level.SEVERE, String.format("Error writing content from file '%s' (id=%d) to '%s'.", file.getName(), fileId, dbPath), ex); //NON-NLS } } } catch (TskCoreException e) { @@ -77,8 +96,14 @@ class CallLogAnalyzer { } } + /** + * Index results for call logs found in the database. + * + * @param DatabasePath The path to the database. + * @param fileId The ID of the file associated with artifacts. + */ @Messages({"CallLogAnalyzer.indexError.message=Failed to index call log artifact for keyword search."}) - private void findCallLogsInDB(String DatabasePath, long fId) { + private void findCallLogsInDB(String DatabasePath, long fileId) { if (DatabasePath == null || DatabasePath.isEmpty()) { return; } @@ -90,12 +115,18 @@ class CallLogAnalyzer { logger.log(Level.SEVERE, "Error opening database", e); //NON-NLS } - Case currentCase = Case.getCurrentCase(); + Case currentCase; + try { + currentCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS + return; + } SleuthkitCase skCase = currentCase.getSleuthkitCase(); try { - AbstractFile f = skCase.getAbstractFileById(fId); - if (f == null) { - logger.log(Level.SEVERE, "Error getting abstract file " + fId); //NON-NLS + AbstractFile file = skCase.getAbstractFileById(fileId); + if (file == null) { + logger.log(Level.SEVERE, "Error getting abstract file {0}", fileId); //NON-NLS return; } @@ -117,7 +148,7 @@ class CallLogAnalyzer { date = resultSet.getString("date"); //NON-NLS type = resultSet.getString("type"); //NON-NLS - bba = f.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG); //create a call log and then add attributes from result set. + bba = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG); //create a call log and then add attributes from result set. Collection attributes = new ArrayList<>(); if (type.equalsIgnoreCase("outgoing")) { //NON-NLS attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO, moduleName, number)); diff --git a/Core/src/org/sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java b/Core/src/org/sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java index efa4494f26..25020aff9c 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java +++ b/Core/src/org/sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2014 Basis Technology Corp. + * Copyright 2014-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -43,10 +43,14 @@ import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.ReadContentInputStream; +import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; -class ContactAnalyzer { +/** + * Look for call logs and allow resulting blackboard artifacts to be generated. + */ +final class ContactAnalyzer { private Connection connection = null; private ResultSet resultSet = null; @@ -54,10 +58,15 @@ class ContactAnalyzer { private String dbPath = ""; private long fileId = 0; private java.io.File jFile = null; - private String moduleName = iOSModuleFactory.getModuleName(); + private final String moduleName = iOSModuleFactory.getModuleName(); private static final Logger logger = Logger.getLogger(ContactAnalyzer.class.getName()); private Blackboard blackboard; + /** + * Find contacts given an ingest job context and index the results. + * + * @param context The ingest job context. + */ public void findContacts(IngestJobContext context) { blackboard = Case.getCurrentCase().getServices().getBlackboard(); @@ -68,18 +77,16 @@ class ContactAnalyzer { if (absFiles.isEmpty()) { return; } - for (AbstractFile AF : absFiles) { + for (AbstractFile file : absFiles) { try { - jFile = new java.io.File(Case.getCurrentCase().getTempDirectory(), AF.getName().replaceAll("[<>%|\"/:*\\\\]", "")); - //jFile = new java.io.File(Case.getCurrentCase().getTempDirectory(), i+".txt"); - ContentUtils.writeToFile(AF, jFile, context::dataSourceIngestIsCancelled); - //copyFileUsingStreams(AF,jFile); - //copyFileUsingStream(AF,jFile); + jFile = new java.io.File(Case.getCurrentCase().getTempDirectory(), file.getName().replaceAll("[<>%|\"/:*\\\\]", "")); dbPath = jFile.toString(); //path of file as string - fileId = AF.getId(); - //findContactsInDB(dbPath, fileId); - } catch (Exception e) { - logger.log(Level.SEVERE, "Error parsing Contacts", e); //NON-NLS + fileId = file.getId(); + ContentUtils.writeToFile(file, jFile, context::dataSourceIngestIsCancelled); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Error reading content from file '%s' (id=%d).", file.getName(), fileId), ex); //NON-NLS + } catch (Exception ex) { + logger.log(Level.SEVERE, String.format("Error writing content from file '%s' (id=%d) to '%s'.", file.getName(), fileId, dbPath), ex); //NON-NLS } } } catch (TskCoreException e) { @@ -88,14 +95,14 @@ class ContactAnalyzer { } /** + * Create blackboard artifacts and index results for call logs found in the + * database. * - * @param DatabasePath - * @param fId Will create artifact from a database given by the - * path The fileId will be the Abstract file associated - * with the artifacts + * @param DatabasePath The path to the database. + * @param fileId The ID of the file associated with artifacts. */ @Messages({"ContactAnalyzer.indexError.message=Failed to index contact artifact for keyword search."}) - private void findContactsInDB(String DatabasePath, long fId) { + private void findContactsInDB(String DatabasePath, long fileId) { if (DatabasePath == null || DatabasePath.isEmpty()) { return; } @@ -110,9 +117,9 @@ class ContactAnalyzer { Case currentCase = Case.getCurrentCase(); SleuthkitCase skCase = currentCase.getSleuthkitCase(); try { - AbstractFile f = skCase.getAbstractFileById(fId); - if (f == null) { - logger.log(Level.SEVERE, "Error getting abstract file " + fId); //NON-NLS + AbstractFile file = skCase.getAbstractFileById(fileId); + if (file == null) { + logger.log(Level.SEVERE, "Error getting abstract file {0}", fileId); //NON-NLS return; } @@ -129,7 +136,7 @@ class ContactAnalyzer { + "ORDER BY name_raw_contact.display_name ASC;"); //NON-NLS BlackboardArtifact bba; - bba = f.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT); + bba = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT); Collection attributes = new ArrayList<>(); String name; String oldName = ""; @@ -148,7 +155,7 @@ class ContactAnalyzer { attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL, moduleName, data1)); } oldName = name; - + bba.addAttributes(attributes); try { // index the artifact for keyword search @@ -157,7 +164,7 @@ class ContactAnalyzer { logger.log(Level.SEVERE, "Unable to index blackboard artifact " + bba.getArtifactID(), ex); //NON-NLS MessageNotifyUtil.Notify.error( Bundle.ContactAnalyzer_indexError_message(), bba.getDisplayName()); - } + } } } catch (Exception e) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/iOS/TextMessageAnalyzer.java b/Core/src/org/sleuthkit/autopsy/modules/iOS/TextMessageAnalyzer.java index d1a81663fe..0a80ce5b43 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/iOS/TextMessageAnalyzer.java +++ b/Core/src/org/sleuthkit/autopsy/modules/iOS/TextMessageAnalyzer.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2014 Basis Technology Corp. + * Copyright 2014-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -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; @@ -38,9 +39,14 @@ import org.sleuthkit.autopsy.ingest.IngestJobContext; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.ReadContentInputStream; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; +/** + * Look for text messages and allow resulting blackboard artifacts to be + * generated. + */ class TextMessageAnalyzer { private Connection connection = null; @@ -50,27 +56,41 @@ class TextMessageAnalyzer { private long fileId = 0; private java.io.File jFile = null; List absFiles; - private String moduleName = iOSModuleFactory.getModuleName(); + private final String moduleName = iOSModuleFactory.getModuleName(); private static final Logger logger = Logger.getLogger(TextMessageAnalyzer.class.getName()); private Blackboard blackboard; + /** + * Find text messages given an ingest job context and index the results. + * + * @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; } - for (AbstractFile AF : absFiles) { + for (AbstractFile file : absFiles) { try { - jFile = new java.io.File(Case.getCurrentCase().getTempDirectory(), AF.getName().replaceAll("[<>%|\"/:*\\\\]", "")); - ContentUtils.writeToFile(AF, jFile, context::dataSourceIngestIsCancelled); + jFile = new java.io.File(Case.getCurrentCase().getTempDirectory(), file.getName().replaceAll("[<>%|\"/:*\\\\]", "")); dbPath = jFile.toString(); //path of file as string - fileId = AF.getId(); + fileId = file.getId(); + ContentUtils.writeToFile(file, jFile, context::dataSourceIngestIsCancelled); findTextsInDB(dbPath, fileId); - } catch (Exception e) { - logger.log(Level.SEVERE, "Error parsing text messages", e); //NON-NLS + } catch (ReadContentInputStream.ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Error reading content from file '%s' (id=%d).", file.getName(), fileId), ex); //NON-NLS + } catch (Exception ex) { + logger.log(Level.SEVERE, String.format("Error writing content from file '%s' (id=%d) to '%s'.", file.getName(), fileId, dbPath), ex); //NON-NLS } } } catch (TskCoreException e) { @@ -78,8 +98,15 @@ class TextMessageAnalyzer { } } + /** + * Create blackboard artifacts and index results for text messages found in + * the database. + * + * @param DatabasePath The path to the database. + * @param fileId The ID of the file associated with artifacts. + */ @Messages({"TextMessageAnalyzer.indexError.message=Failed to index text message artifact for keyword search."}) - private void findTextsInDB(String DatabasePath, long fId) { + private void findTextsInDB(String DatabasePath, long fileId) { if (DatabasePath == null || DatabasePath.isEmpty()) { return; } @@ -94,9 +121,9 @@ class TextMessageAnalyzer { Case currentCase = Case.getCurrentCase(); SleuthkitCase skCase = currentCase.getSleuthkitCase(); try { - AbstractFile f = skCase.getAbstractFileById(fId); - if (f == null) { - logger.log(Level.SEVERE, "Error getting abstract file " + fId); //NON-NLS + AbstractFile file = skCase.getAbstractFileById(fileId); + if (file == null) { + logger.log(Level.SEVERE, "Error getting abstract file {0}", fileId); //NON-NLS return; } @@ -117,7 +144,7 @@ class TextMessageAnalyzer { subject = resultSet.getString("subject"); //NON-NLS body = resultSet.getString("body"); //NON-NLS - bba = f.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE); //create Message artifact and then add attributes from result set. + bba = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE); //create Message artifact and then add attributes from result set. Collection attributes = new ArrayList<>(); // @@@ NEed to put into more specific TO or FROM if (type.equals("1")) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form index 4d8f94589f..f06010a272 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form @@ -120,7 +120,6 @@ - @@ -128,12 +127,19 @@ - + + + + + + + + @@ -158,12 +164,6 @@ - - - - - - @@ -173,7 +173,7 @@ - + @@ -600,6 +600,9 @@ + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java index 8481f172e3..fc930fadd0 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java @@ -278,7 +278,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp FilesSetDefsPanel.this.newSetButton.setEnabled(canBeEnabled); FilesSetDefsPanel.this.importSetButton.setEnabled(canBeEnabled); // Get the selected interesting files set and populate the set - // components. + // components. FilesSet selectedSet = FilesSetDefsPanel.this.setsList.getSelectedValue(); if (selectedSet != null) { @@ -405,7 +405,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp // Create a files set defintion panle. FilesSetPanel panel; if (selectedSet != null) { - // Editing an existing set definition. + // Editing an existing set definition. panel = new FilesSetPanel(selectedSet, panelType); } else { // Creating a new set definition. @@ -707,6 +707,11 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp fileNameRegexCheckbox.setFont(fileNameRegexCheckbox.getFont().deriveFont(fileNameRegexCheckbox.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); org.openide.awt.Mnemonics.setLocalizedText(fileNameRegexCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameRegexCheckbox.text")); // NOI18N fileNameRegexCheckbox.setEnabled(false); + fileNameRegexCheckbox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + fileNameRegexCheckboxActionPerformed(evt); + } + }); separator.setOrientation(javax.swing.SwingConstants.VERTICAL); @@ -915,18 +920,23 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(fileNameRadioButton) .addComponent(rulePathConditionRegexCheckBox) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(daysIncludedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(daysIncludedLabel)) .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(filesRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(filesRadioButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(dirsRadioButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(allRadioButton))) + .addComponent(allRadioButton)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(fileNameRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(fileNameExtensionRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(fileNameRegexCheckbox))) .addGap(0, 0, Short.MAX_VALUE))))) .addGap(8, 8, 8)) .addGroup(jPanel1Layout.createSequentialGroup() @@ -942,11 +952,6 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp .addComponent(jLabel6)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(ingestWarningLabel)) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(174, 174, 174) - .addComponent(fileNameExtensionRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(fileNameRegexCheckbox)) .addComponent(jLabel1) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(newRuleButton) @@ -954,7 +959,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp .addComponent(editRuleButton) .addGap(18, 18, 18) .addComponent(deleteRuleButton))) - .addGap(24, 28, Short.MAX_VALUE)))) + .addGap(24, 47, Short.MAX_VALUE)))) ); jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {copySetButton, deleteSetButton, editSetButton, exportSetButton, importSetButton, newSetButton}); @@ -1141,7 +1146,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp "FilesSetDefsPanel.interesting.importButtonAction.featureName=Interesting Files Set Import" }) private void importSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importSetButtonActionPerformed - //save currently selected value as default value to select + //save currently selected value as default value to select FilesSet selectedSet = this.setsList.getSelectedValue(); JFileChooser chooser = new JFileChooser(); final String EXTENSION = "xml"; //NON-NLS @@ -1163,7 +1168,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp } Collection importedSets; try { - importedSets = InterestingItemsFilesSetSettings.readDefinitionsXML(selFile).values(); //read the xml from that path + importedSets = InterestingItemsFilesSetSettings.readDefinitionsXML(selFile).values(); //read the xml from that path if (importedSets.isEmpty()) { throw new FilesSetsManager.FilesSetsManagerException("No Files Sets were read from the xml."); } @@ -1176,7 +1181,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp return; } for (FilesSet set : importedSets) { - int choice = JOptionPane.OK_OPTION; + int choice = JOptionPane.OK_OPTION; if (filesSets.containsKey(set.getName())) { Object[] options = {NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.yesOwMsg"), NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.noSkipMsg"), @@ -1275,6 +1280,10 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp } }//GEN-LAST:event_exportSetButtonActionPerformed + private void fileNameRegexCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileNameRegexCheckboxActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_fileNameRegexCheckboxActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JRadioButton allRadioButton; private javax.swing.JButton copySetButton; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form index 7733bd3d05..efd3c1138f 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form @@ -22,7 +22,7 @@ - + @@ -49,7 +49,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java index 51539b5806..daf3bede83 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java @@ -209,7 +209,7 @@ public class FilesSetPanel extends javax.swing.JPanel { .addComponent(descPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) - .addComponent(nameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(nameLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() @@ -230,7 +230,7 @@ public class FilesSetPanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ignoreKnownFilesCheckbox) - .addComponent(ignoreUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(ignoreUnallocCheckbox)) .addContainerGap()) ); }// //GEN-END:initComponents diff --git a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java index 04f7f42355..1f0bafb892 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -37,7 +37,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicLong; import java.util.logging.Level; import org.openide.modules.InstalledFileLocator; -import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.coreutils.ExecUtil; @@ -59,6 +58,7 @@ import org.sleuthkit.autopsy.ingest.ModuleContentEvent; import org.sleuthkit.autopsy.ingest.ProcTerminationCode; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.LayoutFile; +import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; import org.sleuthkit.datamodel.TskData; /** @@ -301,9 +301,14 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { context.addFilesToJob(new ArrayList<>(carvedItems)); services.fireModuleContentEvent(new ModuleContentEvent(carvedItems.get(0))); // fire an event to update the tree } + } catch (ReadContentInputStreamException ex) { + totals.totalItemsWithErrors.incrementAndGet(); + logger.log(Level.WARNING, String.format("Error reading file '%s' (id=%d) with the PhotoRec carver.", file.getName(), file.getId()), ex); // NON-NLS + MessageNotifyUtil.Notify.error(PhotoRecCarverIngestModuleFactory.getModuleName(), NbBundle.getMessage(PhotoRecCarverFileIngestModule.class, "PhotoRecIngestModule.error.msg", file.getName())); + return IngestModule.ProcessResult.ERROR; } catch (IOException ex) { totals.totalItemsWithErrors.incrementAndGet(); - logger.log(Level.SEVERE, "Error processing " + file.getName() + " with PhotoRec carver", ex); // NON-NLS + logger.log(Level.SEVERE, String.format("Error writing file '%s' (id=%d) to '%s' with the PhotoRec carver.", file.getName(), file.getId(), tempFilePath), ex); // NON-NLS MessageNotifyUtil.Notify.error(PhotoRecCarverIngestModuleFactory.getModuleName(), NbBundle.getMessage(PhotoRecCarverFileIngestModule.class, "PhotoRecIngestModule.error.msg", file.getName())); return IngestModule.ProcessResult.ERROR; } finally { @@ -438,8 +443,8 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { * @throws IngestModuleException */ public static File locateExecutable() throws IngestModule.IngestModuleException { - File exeFile = null; - Path execName = null; + File exeFile; + Path execName; String photorec_linux_directory = "/usr/bin"; if (PlatformUtil.isWindowsOS()) { execName = Paths.get(PHOTOREC_DIRECTORY, PHOTOREC_EXECUTABLE); diff --git a/Core/src/org/sleuthkit/autopsy/modules/stix/EvalAccountObj.java b/Core/src/org/sleuthkit/autopsy/modules/stix/EvalAccountObj.java index d2a6b19551..5174e479eb 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/stix/EvalAccountObj.java +++ b/Core/src/org/sleuthkit/autopsy/modules/stix/EvalAccountObj.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013 Basis Technology Corp. + * Copyright 2013-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,6 +30,7 @@ import java.util.ArrayList; import org.mitre.cybox.objects.AccountObjectType; import org.mitre.cybox.objects.UserAccountObjectType; import org.mitre.cybox.objects.WindowsUserAccount; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; /** * @@ -104,7 +105,7 @@ class EvalAccountObj extends EvaluatableObject { try { List finalHits = new ArrayList(); - Case case1 = Case.getCurrentCase(); + Case case1 = Case.getOpenCase(); SleuthkitCase sleuthkitCase = case1.getSleuthkitCase(); List artList = sleuthkitCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_OS_ACCOUNT); @@ -150,7 +151,7 @@ class EvalAccountObj extends EvaluatableObject { // Didn't find any matches return new ObservableResult(id, "AccountObject: No matches found for " + searchString, //NON-NLS spacing, ObservableResult.ObservableState.FALSE, null); - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { return new ObservableResult(id, "AccountObject: Exception during evaluation: " + ex.getLocalizedMessage(), //NON-NLS spacing, ObservableResult.ObservableState.INDETERMINATE, null); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/stix/StixArtifactData.java b/Core/src/org/sleuthkit/autopsy/modules/stix/StixArtifactData.java index afc84d87aa..cf4c4a3aea 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/stix/StixArtifactData.java +++ b/Core/src/org/sleuthkit/autopsy/modules/stix/StixArtifactData.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013 Basis Technology Corp. + * Copyright 2013-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,6 +23,7 @@ import java.util.Collection; import java.util.logging.Level; 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; @@ -49,20 +50,28 @@ class StixArtifactData { } public StixArtifactData(long a_objId, String a_observableId, String a_objType) { - Case case1 = Case.getCurrentCase(); - SleuthkitCase sleuthkitCase = case1.getSleuthkitCase(); try { + Case case1 = Case.getOpenCase(); + SleuthkitCase sleuthkitCase = case1.getSleuthkitCase(); file = sleuthkitCase.getAbstractFileById(a_objId); - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { file = null; } observableId = a_observableId; objType = a_objType; } - @Messages({"StixArtifactData.indexError.message=Failed to index STIX interesting file hit artifact for keyword search."}) + @Messages({"StixArtifactData.indexError.message=Failed to index STIX interesting file hit artifact for keyword search.", + "StixArtifactData.noOpenCase.errMsg=No open case available."}) public void createArtifact(String a_title) throws TskCoreException { - Blackboard blackboard = Case.getCurrentCase().getServices().getBlackboard(); + Blackboard blackboard; + try { + blackboard = Case.getOpenCase().getServices().getBlackboard(); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS + MessageNotifyUtil.Notify.error(Bundle.StixArtifactData_noOpenCase_errMsg(), ex.getLocalizedMessage()); + return; + } String setName; if (a_title != null) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/vmextractor/VMExtractorIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/vmextractor/VMExtractorIngestModule.java index 35e66647d8..a6d22b4d6b 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/vmextractor/VMExtractorIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/vmextractor/VMExtractorIngestModule.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2012-2016 Basis Technology Corp. + * Copyright 2012-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -35,6 +35,7 @@ import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.GeneralFilter; import org.sleuthkit.autopsy.casemodule.ImageDSProcessor; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor; import org.sleuthkit.autopsy.coreutils.Logger; @@ -51,6 +52,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.DataSource; +import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskDataException; @@ -72,13 +74,14 @@ final class VMExtractorIngestModule extends DataSourceIngestModuleAdapter { private final HashMap imageFolderToOutputFolder = new HashMap<>(); private int folderId = 0; - @Messages({"# {0} - data source name", "deviceIdQueryErrMsg=Data source {0} missing Device ID"}) + @Messages({"# {0} - data source name", "deviceIdQueryErrMsg=Data source {0} missing Device ID", + "VMExtractorIngestModule.noOpenCase.errMsg=No open case available."}) @Override public void startUp(IngestJobContext context) throws IngestModuleException { this.context = context; long dataSourceObjId = context.getDataSource().getId(); try { - Case currentCase = Case.getCurrentCase(); + Case currentCase = Case.getOpenCase(); SleuthkitCase caseDb = currentCase.getSleuthkitCase(); DataSource dataSource = caseDb.getDataSource(dataSourceObjId); parentDeviceId = dataSource.getDeviceId(); @@ -87,13 +90,15 @@ final class VMExtractorIngestModule extends DataSourceIngestModuleAdapter { String timeStamp = dateFormat.format(Calendar.getInstance().getTime()); String ingestJobOutputDirName = context.getDataSource().getName() + "_" + context.getDataSource().getId() + "_" + timeStamp; ingestJobOutputDirName = ingestJobOutputDirName.replace(':', '_'); - ingestJobOutputDir = Paths.get(Case.getCurrentCase().getModuleDirectory(), VMExtractorIngestModuleFactory.getModuleName(), ingestJobOutputDirName); + ingestJobOutputDir = Paths.get(currentCase.getModuleDirectory(), VMExtractorIngestModuleFactory.getModuleName(), ingestJobOutputDirName); // create module output folder to write extracted virtual machine files to Files.createDirectories(ingestJobOutputDir); } catch (IOException | SecurityException | UnsupportedOperationException ex) { throw new IngestModule.IngestModuleException(Bundle.VMExtractorIngestModule_cannotCreateOutputDir_message(ex.getLocalizedMessage()), ex); } catch (TskDataException | TskCoreException ex) { throw new IngestModule.IngestModuleException(Bundle.deviceIdQueryErrMsg(context.getDataSource().getName()), ex); + } catch (NoCurrentCaseException ex) { + throw new IngestModule.IngestModuleException(Bundle.VMExtractorIngestModule_noOpenCase_errMsg(), ex); } } @@ -116,6 +121,9 @@ final class VMExtractorIngestModule extends DataSourceIngestModuleAdapter { } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Error querying case database", ex); //NON-NLS return ProcessResult.ERROR; + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS + return ProcessResult.ERROR; } if (vmFiles.isEmpty()) { @@ -154,8 +162,14 @@ final class VMExtractorIngestModule extends DataSourceIngestModuleAdapter { // write the vm file to output folder try { writeVirtualMachineToDisk(vmFile, outputFolderForThisVM); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Failed to read virtual machine file '%s' (id=%d).", + vmFile.getName(), vmFile.getId()), ex); //NON-NLS + MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "VMExtractorIngestModule.msgNotify.failedExtractVM.title.txt"), + NbBundle.getMessage(this.getClass(), "VMExtractorIngestModule.msgNotify.failedExtractVM.msg.txt", vmFile.getName())); } catch (Exception ex) { - logger.log(Level.SEVERE, "Failed to write virtual machine file " + vmFile.getName() + " to folder " + outputFolderForThisVM, ex); //NON-NLS + logger.log(Level.SEVERE, String.format("Failed to write virtual machine file '%s' (id=%d) to folder '%s'.", + vmFile.getName(), vmFile.getId(), outputFolderForThisVM), ex); //NON-NLS MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "VMExtractorIngestModule.msgNotify.failedExtractVM.title.txt"), NbBundle.getMessage(this.getClass(), "VMExtractorIngestModule.msgNotify.failedExtractVM.msg.txt", vmFile.getName())); } @@ -191,6 +205,10 @@ final class VMExtractorIngestModule extends DataSourceIngestModuleAdapter { logger.log(Level.SEVERE, "Failed to ingest virtual machine file " + file + " in folder " + folder, ex); //NON-NLS MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "VMExtractorIngestModule.msgNotify.failedIngestVM.title.txt"), NbBundle.getMessage(this.getClass(), "VMExtractorIngestModule.msgNotify.failedIngestVM.msg.txt", file)); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS + MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "VMExtractorIngestModule.msgNotify.failedIngestVM.title.txt"), + Bundle.VMExtractorIngestModule_noOpenCase_errMsg()); } } // Update progress bar @@ -212,11 +230,11 @@ final class VMExtractorIngestModule extends DataSourceIngestModuleAdapter { * @throws TskCoreException if there is a problem querying the case * database. */ - private static List findVirtualMachineFiles(Content dataSource) throws TskCoreException { + private static List findVirtualMachineFiles(Content dataSource) throws TskCoreException, NoCurrentCaseException { List vmFiles = new ArrayList<>(); for (String vmExtension : GeneralFilter.VIRTUAL_MACHINE_EXTS) { String searchString = "%" + vmExtension; // want a search string that looks like this "%.vmdk" - vmFiles.addAll(Case.getCurrentCase().getServices().getFileManager().findFiles(dataSource, searchString)); + vmFiles.addAll(Case.getOpenCase().getServices().getFileManager().findFiles(dataSource, searchString)); } return vmFiles; } @@ -227,9 +245,10 @@ final class VMExtractorIngestModule extends DataSourceIngestModuleAdapter { * @param vmFile Abstract file to write to disk. * @param outputFolderForThisVM Absolute path to output folder. * - * @throws IOException + * @throws IOException General file exception. + * @throws ReadContentInputStreamException Thrown when there's an issue reading the file. */ - private void writeVirtualMachineToDisk(AbstractFile vmFile, String outputFolderForThisVM) throws IOException { + private void writeVirtualMachineToDisk(AbstractFile vmFile, String outputFolderForThisVM) throws ReadContentInputStreamException, IOException { // TODO: check available disk space first? See IngestMonitor.getFreeSpace() // check if output folder exists @@ -250,13 +269,13 @@ final class VMExtractorIngestModule extends DataSourceIngestModuleAdapter { * * @param vmFile A virtual machine file. */ - private void ingestVirtualMachineImage(Path vmFile) throws InterruptedException, IOException { + private void ingestVirtualMachineImage(Path vmFile) throws InterruptedException, IOException, NoCurrentCaseException { /* * Try to add the virtual machine file to the case as a data source. */ UUID taskId = UUID.randomUUID(); - Case.getCurrentCase().notifyAddingDataSource(taskId); + Case.getOpenCase().notifyAddingDataSource(taskId); ImageDSProcessor dataSourceProcessor = new ImageDSProcessor(); AddDataSourceCallback dspCallback = new AddDataSourceCallback(vmFile); synchronized (this) { @@ -272,7 +291,7 @@ final class VMExtractorIngestModule extends DataSourceIngestModuleAdapter { * ingest context. */ if (!dspCallback.vmDataSources.isEmpty()) { - Case.getCurrentCase().notifyDataSourceAdded(dspCallback.vmDataSources.get(0), taskId); + Case.getOpenCase().notifyDataSourceAdded(dspCallback.vmDataSources.get(0), taskId); List dataSourceContent = new ArrayList<>(dspCallback.vmDataSources); IngestJobSettings ingestJobSettings = new IngestJobSettings(context.getExecutionContext()); for (String warning : ingestJobSettings.getWarnings()) { @@ -283,7 +302,7 @@ final class VMExtractorIngestModule extends DataSourceIngestModuleAdapter { NbBundle.getMessage(this.getClass(), "VMExtractorIngestModule.addedVirtualMachineImage.message", vmFile.toString()))); IngestManager.getInstance().queueIngestJob(dataSourceContent, ingestJobSettings); } else { - Case.getCurrentCase().notifyFailedAddingDataSource(taskId); + Case.getOpenCase().notifyFailedAddingDataSource(taskId); } } diff --git a/Core/src/org/sleuthkit/autopsy/progress/ModalDialogProgressIndicator.java b/Core/src/org/sleuthkit/autopsy/progress/ModalDialogProgressIndicator.java index d49574bf24..3273d2c5f9 100644 --- a/Core/src/org/sleuthkit/autopsy/progress/ModalDialogProgressIndicator.java +++ b/Core/src/org/sleuthkit/autopsy/progress/ModalDialogProgressIndicator.java @@ -227,6 +227,7 @@ public final class ModalDialogProgressIndicator implements ProgressIndicator { public synchronized void finish() { SwingUtilities.invokeLater(() -> { this.dialog.setVisible(false); + this.dialog.dispose(); }); } diff --git a/Core/src/org/sleuthkit/autopsy/report/ArtifactSelectionDialog.java b/Core/src/org/sleuthkit/autopsy/report/ArtifactSelectionDialog.java index 3af9d2112d..300a810def 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ArtifactSelectionDialog.java +++ b/Core/src/org/sleuthkit/autopsy/report/ArtifactSelectionDialog.java @@ -36,6 +36,7 @@ import javax.swing.ListModel; import javax.swing.event.ListDataListener; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.TskCoreException; @@ -74,7 +75,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog { BlackboardArtifact.ARTIFACT_TYPE.TSK_TOOL_OUTPUT.getLabel(), BlackboardArtifact.ARTIFACT_TYPE.TSK_TOOL_OUTPUT.getDisplayName())); // output is too unstructured for table review - artifactTypes = Case.getCurrentCase().getSleuthkitCase().getArtifactTypesInUse(); + artifactTypes = Case.getOpenCase().getSleuthkitCase().getArtifactTypesInUse(); artifactTypes.removeAll(doNotReport); Collections.sort(artifactTypes, new Comparator() { @Override @@ -89,6 +90,8 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog { } } catch (TskCoreException ex) { Logger.getLogger(ArtifactSelectionDialog.class.getName()).log(Level.SEVERE, "Error getting list of artifacts in use: {0}", ex.getLocalizedMessage()); //NON-NLS + } catch (NoCurrentCaseException ex) { + Logger.getLogger(ArtifactSelectionDialog.class.getName()).log(Level.SEVERE, "Exception while getting open case.", ex.getLocalizedMessage()); //NON-NLS } } diff --git a/Core/src/org/sleuthkit/autopsy/report/FileReportText.java b/Core/src/org/sleuthkit/autopsy/report/FileReportText.java index c9a239cf0a..71cccf96ed 100644 --- a/Core/src/org/sleuthkit/autopsy/report/FileReportText.java +++ b/Core/src/org/sleuthkit/autopsy/report/FileReportText.java @@ -31,6 +31,7 @@ import org.sleuthkit.autopsy.coreutils.Logger; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.TskCoreException; @@ -71,13 +72,15 @@ class FileReportText implements FileReportModule { if (out != null) { try { out.close(); - Case.getCurrentCase().addReport(reportPath, NbBundle.getMessage(this.getClass(), + Case.getOpenCase().addReport(reportPath, NbBundle.getMessage(this.getClass(), "FileReportText.getName.text"), ""); } catch (IOException ex) { logger.log(Level.WARNING, "Could not close output writer when ending report.", ex); //NON-NLS } catch (TskCoreException ex) { String errorMessage = String.format("Error adding %s to case as a report", reportPath); //NON-NLS logger.log(Level.SEVERE, errorMessage, ex); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", ex); } } } diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportBodyFile.java b/Core/src/org/sleuthkit/autopsy/report/ReportBodyFile.java index 33609f7333..3a601fdd7f 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportBodyFile.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportBodyFile.java @@ -31,6 +31,7 @@ import javax.swing.JPanel; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.report.ReportProgressPanel.ReportStatus; @@ -73,11 +74,17 @@ class ReportBodyFile implements GeneralReportModule { @SuppressWarnings("deprecation") public void generateReport(String baseReportDir, ReportProgressPanel progressPanel) { // Start the progress bar and setup the report + try { + currentCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", ex); + return; + } progressPanel.setIndeterminate(false); progressPanel.start(); progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "ReportBodyFile.progress.querying")); reportPath = baseReportDir + getRelativeFilePath(); //NON-NLS - currentCase = Case.getCurrentCase(); + skCase = currentCase.getSleuthkitCase(); // Run query to get all files @@ -154,14 +161,14 @@ class ReportBodyFile implements GeneralReportModule { if (out != null) { out.flush(); out.close(); - Case.getCurrentCase().addReport(reportPath, + Case.getOpenCase().addReport(reportPath, NbBundle.getMessage(this.getClass(), "ReportBodyFile.generateReport.srcModuleName.text"), ""); } } catch (IOException ex) { logger.log(Level.WARNING, "Could not flush and close the BufferedWriter.", ex); //NON-NLS - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { String errorMessage = String.format("Error adding %s to case as a report", reportPath); //NON-NLS logger.log(Level.SEVERE, errorMessage, ex); } diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportExcel.java b/Core/src/org/sleuthkit/autopsy/report/ReportExcel.java index 9158790ad6..b28ac5ade2 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportExcel.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportExcel.java @@ -27,6 +27,7 @@ import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.TskCoreException; @@ -112,13 +113,15 @@ class ReportExcel implements TableReportModule { try { out = new FileOutputStream(reportPath); wb.write(out); - Case.getCurrentCase().addReport(reportPath, NbBundle.getMessage(this.getClass(), + Case.getOpenCase().addReport(reportPath, NbBundle.getMessage(this.getClass(), "ReportExcel.endReport.srcModuleName.text"), ""); } catch (IOException ex) { logger.log(Level.SEVERE, "Failed to write Excel report.", ex); //NON-NLS } catch (TskCoreException ex) { String errorMessage = String.format("Error adding %s to case as a report", reportPath); //NON-NLS logger.log(Level.SEVERE, errorMessage, ex); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS } finally { if (out != null) { try { @@ -300,6 +303,13 @@ class ReportExcel implements TableReportModule { } private void writeSummaryWorksheet() { + Case currentCase; + try { + currentCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS + return; + } sheet = wb.createSheet(NbBundle.getMessage(this.getClass(), "ReportExcel.sheetName.text")); rowIndex = 0; @@ -311,8 +321,6 @@ class ReportExcel implements TableReportModule { sheet.createRow(rowIndex); ++rowIndex; - Case currentCase = Case.getCurrentCase(); - row = sheet.createRow(rowIndex); row.setRowStyle(setStyle); row.createCell(0).setCellValue(NbBundle.getMessage(this.getClass(), "ReportExcel.cellVal.caseName")); diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportGenerator.java b/Core/src/org/sleuthkit/autopsy/report/ReportGenerator.java index ab373e679a..127f537df4 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportGenerator.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportGenerator.java @@ -41,6 +41,7 @@ import org.openide.filesystems.FileUtil; import org.openide.util.NbBundle; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.report.ReportProgressPanel.ReportStatus; @@ -54,8 +55,6 @@ class ReportGenerator { private static final Logger logger = Logger.getLogger(ReportGenerator.class.getName()); - private Case currentCase = Case.getCurrentCase(); - /** * Progress reportGenerationPanel that can be used to check for cancellation. */ @@ -229,10 +228,10 @@ class ReportGenerator { private List getFiles() { List absFiles; try { - SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase(); + SleuthkitCase skCase = Case.getOpenCase().getSleuthkitCase(); absFiles = skCase.findAllFilesWhere("meta_type != " + TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_DIR.getValue()); //NON-NLS return absFiles; - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { MessageNotifyUtil.Notify.show( NbBundle.getMessage(this.getClass(), "ReportGenerator.errors.reportErrorTitle"), NbBundle.getMessage(this.getClass(), "ReportGenerator.errors.reportErrorText") + ex.getLocalizedMessage(), @@ -252,7 +251,12 @@ class ReportGenerator { } private static String createReportDirectory(ReportModule module) throws IOException { - Case currentCase = Case.getCurrentCase(); + Case currentCase; + try { + currentCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + throw new IOException("Exception while getting open case.", ex); + } // Create the root reports directory path of the form: /Reports/ / DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy-HH-mm-ss"); Date date = new Date(); diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java b/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java index 01a179a370..fdc0457b1c 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java @@ -49,6 +49,7 @@ import javax.imageio.ImageIO; import org.openide.filesystems.FileUtil; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.Services; import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.coreutils.EscapeUtil; @@ -102,8 +103,8 @@ class ReportHTML implements TableReportModule { } // Refesh the member variables - private void refresh() { - currentCase = Case.getCurrentCase(); + private void refresh() throws NoCurrentCaseException { + currentCase = Case.getOpenCase(); skCase = currentCase.getSleuthkitCase(); dataTypes = new TreeMap<>(); @@ -327,7 +328,12 @@ class ReportHTML implements TableReportModule { @Override public void startReport(String baseReportDir) { // Refresh the HTML report - refresh(); + try { + refresh(); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case."); //NON-NLS + return; + } // Setup the path for the HTML report this.path = baseReportDir; //NON-NLS this.subPath = this.path + HTML_SUBDIR + File.separator; @@ -882,6 +888,13 @@ class ReportHTML implements TableReportModule { private void writeIndex() { Writer indexOut = null; String indexFilePath = path + "report.html"; //NON-NLS + Case openCase; + try { + openCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS + return; + } try { indexOut = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(indexFilePath), "UTF-8")); //NON-NLS StringBuilder index = new StringBuilder(); @@ -909,7 +922,7 @@ class ReportHTML implements TableReportModule { index.append("\n"); //NON-NLS index.append(""); //NON-NLS indexOut.write(index.toString()); - Case.getCurrentCase().addReport(indexFilePath, NbBundle.getMessage(this.getClass(), + openCase.addReport(indexFilePath, NbBundle.getMessage(this.getClass(), "ReportHTML.writeIndex.srcModuleName.text"), ""); } catch (IOException ex) { logger.log(Level.SEVERE, "Error creating Writer for report.html: {0}", ex); //NON-NLS diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportKML.java b/Core/src/org/sleuthkit/autopsy/report/ReportKML.java index f089855e0c..c5c57eccb8 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportKML.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportKML.java @@ -1,16 +1,16 @@ /* * * Autopsy Forensic Browser - * + * * Copyright 2014-2018 Basis Technology Corp. * contact: carrier sleuthkit 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 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -43,6 +43,8 @@ import org.jdom2.output.Format; import org.jdom2.output.XMLOutputter; import org.jdom2.CDATA; import org.openide.filesystems.FileUtil; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; +import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; /** * Generates a KML file based on geospatial information from the BlackBoard. @@ -67,7 +69,7 @@ class ReportKML implements GeneralReportModule { PURPLE("style.kml#purpleFeature"), WHITE("style.kml#whiteFeature"), YELLOW("style.kml#yellowFeature"); - private String color; + private final String color; FeatureColor(String color) { this.color = color; @@ -98,14 +100,18 @@ class ReportKML implements GeneralReportModule { */ @Override public void generateReport(String baseReportDir, ReportProgressPanel progressPanel) { - + try { + currentCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS + return; + } // Start the progress bar and setup the report progressPanel.setIndeterminate(true); progressPanel.start(); progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "ReportKML.progress.querying")); String kmlFileFullPath = baseReportDir + REPORT_KML; //NON-NLS - currentCase = Case.getCurrentCase(); skCase = currentCase.getSleuthkitCase(); progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "ReportKML.progress.loading")); @@ -197,6 +203,8 @@ class ReportKML implements GeneralReportModule { */ try { for (BlackboardArtifact artifact : skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF)) { + String fileName = ""; + long fileId = 0; try { Long timestamp = getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED); String desc = getDescriptionFromArtifact(artifact, "EXIF Metadata With Locations"); //NON-NLS @@ -206,7 +214,9 @@ class ReportKML implements GeneralReportModule { if (lat != null && lat != 0.0 && lon != null && lon != 0.0) { AbstractFile abstractFile = artifact.getSleuthkitCase().getAbstractFileById(artifact.getObjectID()); - Path path = null; + fileName = abstractFile.getName(); + fileId = abstractFile.getId(); + Path path; copyFileUsingStream(abstractFile, Paths.get(baseReportDir, abstractFile.getName()).toFile()); try { path = Paths.get(removeLeadingImgAndVol(abstractFile.getUniquePath())); @@ -219,6 +229,8 @@ class ReportKML implements GeneralReportModule { } gpsExifMetadataFolder.addContent(makePlacemarkWithPicture(abstractFile.getName(), FeatureColor.RED, desc, timestamp, point, path, formattedCoordinates)); } + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Error reading file '%s' (id=%d).", fileName, fileId), ex); } catch (Exception ex) { logger.log(Level.SEVERE, "Could not extract photo information.", ex); //NON-NLS result = ReportProgressPanel.ReportStatus.ERROR; @@ -375,7 +387,7 @@ class ReportKML implements GeneralReportModule { if (result == ReportProgressPanel.ReportStatus.ERROR) { prependedStatus = "Incomplete "; } - Case.getCurrentCase().addReport(kmlFileFullPath, + Case.getOpenCase().addReport(kmlFileFullPath, NbBundle.getMessage(this.getClass(), "ReportKML.genReport.srcModuleName.text"), prependedStatus + NbBundle.getMessage(this.getClass(), "ReportKML.genReport.reportName")); } catch (IOException ex) { @@ -385,6 +397,9 @@ class ReportKML implements GeneralReportModule { String errorMessage = String.format("Error adding %s to case as a report", kmlFileFullPath); //NON-NLS logger.log(Level.SEVERE, errorMessage, ex); result = ReportProgressPanel.ReportStatus.ERROR; + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Exception while getting open case.", ex); + result = ReportProgressPanel.ReportStatus.ERROR; } progressPanel.complete(result); @@ -404,9 +419,7 @@ class ReportKML implements GeneralReportModule { BlackboardAttribute bba = artifact.getAttribute(new BlackboardAttribute.Type(type)); if (bba != null) { Double value = bba.getValueDouble(); - if (value != null) { - returnValue = value; - } + returnValue = value; } } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Error getting Double value: " + type.toString(), ex); //NON-NLS @@ -428,9 +441,7 @@ class ReportKML implements GeneralReportModule { BlackboardAttribute bba = artifact.getAttribute(new BlackboardAttribute.Type(type)); if (bba != null) { Long value = bba.getValueLong(); - if (value != null) { - returnValue = value; - } + returnValue = value; } } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Error getting Long value: " + type.toString(), ex); //NON-NLS @@ -452,9 +463,7 @@ class ReportKML implements GeneralReportModule { BlackboardAttribute bba = artifact.getAttribute(new BlackboardAttribute.Type(type)); if (bba != null) { Integer value = bba.getValueInt(); - if (value != null) { - returnValue = value; - } + returnValue = value; } } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Error getting Integer value: " + type.toString(), ex); //NON-NLS @@ -661,12 +670,12 @@ class ReportKML implements GeneralReportModule { Element coordinates = new Element("coordinates", ns).addContent(longitude + "," + latitude + "," + altitude); //NON-NLS if (altitude != 0) { - /* - Though we are including a non-zero altitude, clamp it to the - ground because inaccuracies from the GPS data can cause the terrain - to occlude points when zoomed in otherwise. Show the altitude, but - keep the point clamped to the ground. We may change this later for - flying GPS sensors. + /* + * Though we are including a non-zero altitude, clamp it to the + * ground because inaccuracies from the GPS data can cause the + * terrain to occlude points when zoomed in otherwise. Show the + * altitude, but keep the point clamped to the ground. We may change + * this later for flying GPS sensors. */ Element altitudeMode = new Element("altitudeMode", ns).addContent("clampToGround"); //NON-NLS point.addContent(altitudeMode); @@ -811,9 +820,11 @@ class ReportKML implements GeneralReportModule { * @param inputFile The input AbstractFile to copy * @param outputFile the output file * - * @throws IOException + * @throws ReadContentInputStreamException When a read error occurs. + * @throws IOException When a general file exception + * occurs. */ - private void copyFileUsingStream(AbstractFile inputFile, File outputFile) throws IOException { + private void copyFileUsingStream(AbstractFile inputFile, File outputFile) throws ReadContentInputStreamException, IOException { byte[] buffer = new byte[65536]; int length; outputFile.createNewFile(); diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportVisualPanel2.form b/Core/src/org/sleuthkit/autopsy/report/ReportVisualPanel2.form index 3df3f78f59..e1f23ebffc 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportVisualPanel2.form +++ b/Core/src/org/sleuthkit/autopsy/report/ReportVisualPanel2.form @@ -33,9 +33,9 @@ - - - + + + @@ -44,7 +44,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportVisualPanel2.java b/Core/src/org/sleuthkit/autopsy/report/ReportVisualPanel2.java index 53422c8f0d..5790a34de4 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportVisualPanel2.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportVisualPanel2.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013-2014 Basis Technology Corp. + * Copyright 2013-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -41,6 +41,7 @@ import javax.swing.event.ListDataListener; import org.openide.util.NbBundle; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.BlackboardArtifact; @@ -97,8 +98,8 @@ final class ReportVisualPanel2 extends JPanel { private void initTags() { List tagNamesInUse; try { - tagNamesInUse = Case.getCurrentCase().getServices().getTagsManager().getTagNamesInUse(); - } catch (TskCoreException ex) { + tagNamesInUse = Case.getOpenCase().getServices().getTagsManager().getTagNamesInUse(); + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(ReportVisualPanel2.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS return; } @@ -136,6 +137,7 @@ final class ReportVisualPanel2 extends JPanel { private void initArtifactTypes() { try { + Case openCase = Case.getOpenCase(); ArrayList doNotReport = new ArrayList<>(); doNotReport.add(new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO.getTypeID(), BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO.getLabel(), @@ -144,7 +146,7 @@ final class ReportVisualPanel2 extends JPanel { BlackboardArtifact.ARTIFACT_TYPE.TSK_TOOL_OUTPUT.getLabel(), BlackboardArtifact.ARTIFACT_TYPE.TSK_TOOL_OUTPUT.getDisplayName())); // output is too unstructured for table review - artifacts = Case.getCurrentCase().getSleuthkitCase().getArtifactTypesInUse(); + artifacts = openCase.getSleuthkitCase().getArtifactTypesInUse(); artifacts.removeAll(doNotReport); @@ -152,7 +154,7 @@ final class ReportVisualPanel2 extends JPanel { for (BlackboardArtifact.Type type : artifacts) { artifactStates.put(type, Boolean.TRUE); } - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { Logger.getLogger(ReportVisualPanel2.class.getName()).log(Level.SEVERE, "Error getting list of artifacts in use: " + ex.getLocalizedMessage(), ex); //NON-NLS } } @@ -268,7 +270,7 @@ final class ReportVisualPanel2 extends JPanel { .addComponent(tagsScrollPane) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(advancedButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 89, Short.MAX_VALUE) + .addComponent(advancedButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(deselectAllButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(selectAllButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(layout.createSequentialGroup() @@ -276,9 +278,12 @@ final class ReportVisualPanel2 extends JPanel { .addComponent(taggedResultsRadioButton) .addComponent(dataLabel) .addComponent(allResultsRadioButton)) - .addGap(0, 481, Short.MAX_VALUE))) + .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) ); + + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {advancedButton, deselectAllButton, selectAllButton}); + layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportWizardFileOptionsVisualPanel.form b/Core/src/org/sleuthkit/autopsy/report/ReportWizardFileOptionsVisualPanel.form index bc0dedd038..e7d1d1ce34 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportWizardFileOptionsVisualPanel.form +++ b/Core/src/org/sleuthkit/autopsy/report/ReportWizardFileOptionsVisualPanel.form @@ -24,7 +24,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportWizardFileOptionsVisualPanel.java b/Core/src/org/sleuthkit/autopsy/report/ReportWizardFileOptionsVisualPanel.java index 70fa0c9f3a..5dceb24650 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportWizardFileOptionsVisualPanel.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportWizardFileOptionsVisualPanel.java @@ -177,7 +177,7 @@ class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addGroup(layout.createSequentialGroup() - .addComponent(selectAllButton, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(selectAllButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(deselectAllButton))) .addGap(0, 210, Short.MAX_VALUE))) diff --git a/Core/src/org/sleuthkit/autopsy/report/TableReportGenerator.java b/Core/src/org/sleuthkit/autopsy/report/TableReportGenerator.java index 499f848d54..673d5fa3d4 100644 --- a/Core/src/org/sleuthkit/autopsy/report/TableReportGenerator.java +++ b/Core/src/org/sleuthkit/autopsy/report/TableReportGenerator.java @@ -39,6 +39,7 @@ import java.util.TreeSet; import java.util.logging.Level; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.coreutils.ImageUtils; import org.sleuthkit.autopsy.coreutils.Logger; @@ -181,11 +182,11 @@ class TableReportGenerator { String accountDisplayname = accountTypeStr; if (accountTypeStr != null) { try { - Account.Type acctType = Case.getCurrentCase().getSleuthkitCase().getCommunicationsManager().getAccountType(accountTypeStr); + Account.Type acctType = Case.getOpenCase().getSleuthkitCase().getCommunicationsManager().getAccountType(accountTypeStr); if (acctType != null) { accountDisplayname = acctType.getDisplayName(); } - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Unable to get display name for account type " + accountTypeStr, ex); } } @@ -267,8 +268,8 @@ class TableReportGenerator { // Get the content tags. List tags; try { - tags = Case.getCurrentCase().getServices().getTagsManager().getAllContentTags(); - } catch (TskCoreException ex) { + tags = Case.getOpenCase().getServices().getTagsManager().getAllContentTags(); + } catch (TskCoreException | NoCurrentCaseException ex) { errorList.add(NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.failedGetContentTags")); logger.log(Level.SEVERE, "failed to get content tags", ex); //NON-NLS return; @@ -360,8 +361,8 @@ class TableReportGenerator { List tags; try { - tags = Case.getCurrentCase().getServices().getTagsManager().getAllBlackboardArtifactTags(); - } catch (TskCoreException ex) { + tags = Case.getOpenCase().getServices().getTagsManager().getAllBlackboardArtifactTags(); + } catch (TskCoreException | NoCurrentCaseException ex) { errorList.add(NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.failedGetBBArtifactTags")); logger.log(Level.SEVERE, "failed to get blackboard artifact tags", ex); //NON-NLS return; @@ -452,8 +453,8 @@ class TableReportGenerator { private void checkIfTagHasImage(BlackboardArtifactTag artifactTag) { AbstractFile file; try { - file = Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(artifactTag.getArtifact().getObjectID()); - } catch (TskCoreException ex) { + file = Case.getOpenCase().getSleuthkitCase().getAbstractFileById(artifactTag.getArtifact().getObjectID()); + } catch (TskCoreException | NoCurrentCaseException ex) { errorList.add( NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.errGetContentFromBBArtifact")); logger.log(Level.WARNING, "Error while getting content from a blackboard artifact to report on.", ex); //NON-NLS @@ -520,6 +521,7 @@ class TableReportGenerator { * @param tableModule module to report on */ @SuppressWarnings("deprecation") + @NbBundle.Messages ({"ReportGenerator.errList.noOpenCase=No open case available."}) private void writeKeywordHits(TableReportModule tableModule, String comment, HashSet tagNamesFilter) { // Query for keyword lists-only so that we can tell modules what lists @@ -528,7 +530,15 @@ class TableReportGenerator { // so that we only report the lists that we will later provide with real // hits. If no keyord hits are tagged, then we make the page for nothing. String orderByClause; - if (Case.getCurrentCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) { + Case openCase; + try { + openCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + errorList.add(Bundle.ReportGenerator_errList_noOpenCase()); + logger.log(Level.SEVERE, "Exception while getting open case: ", ex); //NON-NLS + return; + } + if (openCase.getCaseType() == Case.CaseType.MULTI_USER_CASE) { orderByClause = "ORDER BY convert_to(att.value_text, 'SQL_ASCII') ASC NULLS FIRST"; //NON-NLS } else { orderByClause = "ORDER BY list ASC"; //NON-NLS @@ -546,7 +556,7 @@ class TableReportGenerator { + //NON-NLS "GROUP BY list " + orderByClause; //NON-NLS - try (SleuthkitCase.CaseDbQuery dbQuery = Case.getCurrentCase().getSleuthkitCase().executeQuery(keywordListQuery)) { + try (SleuthkitCase.CaseDbQuery dbQuery = openCase.getSleuthkitCase().executeQuery(keywordListQuery)) { ResultSet listsRs = dbQuery.getResultSet(); List lists = new ArrayList<>(); while (listsRs.next()) { @@ -569,7 +579,7 @@ class TableReportGenerator { return; } - if (Case.getCurrentCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) { + if (openCase.getCaseType() == Case.CaseType.MULTI_USER_CASE) { orderByClause = "ORDER BY convert_to(att3.value_text, 'SQL_ASCII') ASC NULLS FIRST, " //NON-NLS + "convert_to(att1.value_text, 'SQL_ASCII') ASC NULLS FIRST, " //NON-NLS + "convert_to(f.parent_path, 'SQL_ASCII') ASC NULLS FIRST, " //NON-NLS @@ -602,7 +612,7 @@ class TableReportGenerator { + //NON-NLS orderByClause; //NON-NLS - try (SleuthkitCase.CaseDbQuery dbQuery = Case.getCurrentCase().getSleuthkitCase().executeQuery(keywordsQuery)) { + try (SleuthkitCase.CaseDbQuery dbQuery = openCase.getSleuthkitCase().executeQuery(keywordsQuery)) { ResultSet resultSet = dbQuery.getResultSet(); String currentKeyword = ""; @@ -627,9 +637,9 @@ class TableReportGenerator { String uniquePath = ""; try { - AbstractFile f = Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(objId); + AbstractFile f = openCase.getSleuthkitCase().getAbstractFileById(objId); if (f != null) { - uniquePath = Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(objId).getUniquePath(); + uniquePath = openCase.getSleuthkitCase().getAbstractFileById(objId).getUniquePath(); } } catch (TskCoreException ex) { errorList.add( @@ -685,7 +695,15 @@ class TableReportGenerator { @SuppressWarnings("deprecation") private void writeHashsetHits(TableReportModule tableModule, String comment, HashSet tagNamesFilter) { String orderByClause; - if (Case.getCurrentCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) { + Case openCase; + try { + openCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + errorList.add(Bundle.ReportGenerator_errList_noOpenCase()); + logger.log(Level.SEVERE, "Exception while getting open case: ", ex); //NON-NLS + return; + } + if (openCase.getCaseType() == Case.CaseType.MULTI_USER_CASE) { orderByClause = "ORDER BY convert_to(att.value_text, 'SQL_ASCII') ASC NULLS FIRST"; //NON-NLS } else { orderByClause = "ORDER BY att.value_text ASC"; //NON-NLS @@ -703,7 +721,7 @@ class TableReportGenerator { + //NON-NLS "GROUP BY list " + orderByClause; //NON-NLS - try (SleuthkitCase.CaseDbQuery dbQuery = Case.getCurrentCase().getSleuthkitCase().executeQuery(hashsetsQuery)) { + try (SleuthkitCase.CaseDbQuery dbQuery = openCase.getSleuthkitCase().executeQuery(hashsetsQuery)) { // Query for hashsets ResultSet listsRs = dbQuery.getResultSet(); List lists = new ArrayList<>(); @@ -722,7 +740,7 @@ class TableReportGenerator { return; } - if (Case.getCurrentCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) { + if (openCase.getCaseType() == Case.CaseType.MULTI_USER_CASE) { orderByClause = "ORDER BY convert_to(att.value_text, 'SQL_ASCII') ASC NULLS FIRST, " //NON-NLS + "convert_to(f.parent_path, 'SQL_ASCII') ASC NULLS FIRST, " //NON-NLS + "convert_to(f.name, 'SQL_ASCII') ASC NULLS FIRST, " //NON-NLS @@ -745,7 +763,7 @@ class TableReportGenerator { + //NON-NLS orderByClause; //NON-NLS - try (SleuthkitCase.CaseDbQuery dbQuery = Case.getCurrentCase().getSleuthkitCase().executeQuery(hashsetHitsQuery)) { + try (SleuthkitCase.CaseDbQuery dbQuery = openCase.getSleuthkitCase().executeQuery(hashsetHitsQuery)) { // Query for hashset hits ResultSet resultSet = dbQuery.getResultSet(); String currentSet = ""; @@ -768,9 +786,9 @@ class TableReportGenerator { String uniquePath = ""; try { - AbstractFile f = Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(objId); + AbstractFile f = openCase.getSleuthkitCase().getAbstractFileById(objId); if (f != null) { - uniquePath = Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(objId).getUniquePath(); + uniquePath = openCase.getSleuthkitCase().getAbstractFileById(objId).getUniquePath(); } } catch (TskCoreException ex) { errorList.add( @@ -834,9 +852,9 @@ class TableReportGenerator { this.attributes = attrs; this.tags = tags; try { - this.content = Case.getCurrentCase().getSleuthkitCase().getContentById(artifact.getObjectID()); - } catch (TskCoreException ex) { - logger.log(Level.SEVERE, "Could not get content from database"); + this.content = Case.getOpenCase().getSleuthkitCase().getContentById(artifact.getObjectID()); + } catch (TskCoreException | NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Could not get content from database", ex); } } @@ -972,12 +990,12 @@ class TableReportGenerator { HashSet allTags = getTags(); try { - List contentTags = Case.getCurrentCase().getServices().getTagsManager().getContentTagsByContent(content); + List contentTags = Case.getOpenCase().getServices().getTagsManager().getContentTagsByContent(content); for (ContentTag ct : contentTags) { String notableString = ct.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; allTags.add(ct.getName().getDisplayName() + notableString); } - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { errorList.add(NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.failedGetContentTags")); logger.log(Level.SEVERE, "Failed to get content tags", ex); //NON-NLS } @@ -1008,8 +1026,8 @@ class TableReportGenerator { private List getFilteredArtifacts(BlackboardArtifact.Type type, HashSet tagNamesFilter) { List artifacts = new ArrayList<>(); try { - for (BlackboardArtifact artifact : Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifacts(type.getTypeID())) { - List tags = Case.getCurrentCase().getServices().getTagsManager().getBlackboardArtifactTagsByArtifact(artifact); + for (BlackboardArtifact artifact : Case.getOpenCase().getSleuthkitCase().getBlackboardArtifacts(type.getTypeID())) { + List tags = Case.getOpenCase().getServices().getTagsManager().getBlackboardArtifactTagsByArtifact(artifact); HashSet uniqueTagNames = new HashSet<>(); for (BlackboardArtifactTag tag : tags) { String notableString = tag.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; @@ -1019,13 +1037,13 @@ class TableReportGenerator { continue; } try { - artifacts.add(new ArtifactData(artifact, Case.getCurrentCase().getSleuthkitCase().getBlackboardAttributes(artifact), uniqueTagNames)); + artifacts.add(new ArtifactData(artifact, Case.getOpenCase().getSleuthkitCase().getBlackboardAttributes(artifact), uniqueTagNames)); } catch (TskCoreException ex) { errorList.add(NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.failedGetBBAttribs")); logger.log(Level.SEVERE, "Failed to get Blackboard Attributes when generating report.", ex); //NON-NLS } } - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { errorList.add(NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.failedGetBBArtifacts")); logger.log(Level.SEVERE, "Failed to get Blackboard Artifacts when generating report.", ex); //NON-NLS } @@ -1609,12 +1627,12 @@ class TableReportGenerator { + //NON-NLS "WHERE tn.tag_name_id = bat.tag_name_id AND bat.artifact_id = " + artifactId; //NON-NLS - try (SleuthkitCase.CaseDbQuery dbQuery = Case.getCurrentCase().getSleuthkitCase().executeQuery(query)) { + try (SleuthkitCase.CaseDbQuery dbQuery = Case.getOpenCase().getSleuthkitCase().executeQuery(query)) { ResultSet tagNameRows = dbQuery.getResultSet(); while (tagNameRows.next()) { uniqueTagNames.add(tagNameRows.getString("display_name")); //NON-NLS } - } catch (TskCoreException | SQLException ex) { + } catch (TskCoreException | SQLException | NoCurrentCaseException ex) { throw new TskCoreException("Error getting tag names for artifact: ", ex); } diff --git a/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDb.java b/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDb.java index 283425c5fc..f64a14306f 100644 --- a/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDb.java +++ b/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDb.java @@ -27,6 +27,7 @@ import javax.swing.JPanel; import org.openide.util.lookup.ServiceProvider; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb; import org.sleuthkit.autopsy.report.GeneralReportModule; @@ -66,6 +67,14 @@ public class AddTaggedHashesToHashDb implements GeneralReportModule { @Override public void generateReport(String reportPath, ReportProgressPanel progressPanel) { + Case openCase; + try { + openCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + Logger.getLogger(AddTaggedHashesToHashDb.class.getName()).log(Level.SEVERE, "Exception while getting open case.", ex); + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), "No open Case", "Exception while getting open case.", JOptionPane.ERROR_MESSAGE); + return; + } progressPanel.setIndeterminate(true); progressPanel.start(); progressPanel.updateStatusLabel("Adding hashes..."); @@ -74,7 +83,7 @@ public class AddTaggedHashesToHashDb implements GeneralReportModule { if (hashSet != null) { progressPanel.updateStatusLabel("Adding hashes to " + hashSet.getHashSetName() + " hash set..."); - TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager(); + TagsManager tagsManager = openCase.getServices().getTagsManager(); List tagNames = configPanel.getSelectedTagNames(); ArrayList failedExports = new ArrayList<>(); for (TagName tagName : tagNames) { @@ -91,7 +100,7 @@ public class AddTaggedHashesToHashDb implements GeneralReportModule { if (content instanceof AbstractFile) { if (null != ((AbstractFile) content).getMd5Hash()) { try { - hashSet.addHashes(tag.getContent(), Case.getCurrentCase().getDisplayName()); + hashSet.addHashes(tag.getContent(), openCase.getDisplayName()); } catch (TskCoreException ex) { Logger.getLogger(AddTaggedHashesToHashDb.class.getName()).log(Level.SEVERE, "Error adding hash for obj_id = " + tag.getContent().getId() + " to hash set " + hashSet.getHashSetName(), ex); failedExports.add(tag.getContent().getName()); diff --git a/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDbConfigPanel.form b/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDbConfigPanel.form index dfe9ba921e..1acd36abf4 100644 --- a/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDbConfigPanel.form +++ b/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDbConfigPanel.form @@ -32,8 +32,8 @@ - - + + diff --git a/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDbConfigPanel.java b/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDbConfigPanel.java index be89b1ea96..44e0f93d75 100644 --- a/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDbConfigPanel.java +++ b/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDbConfigPanel.java @@ -34,6 +34,7 @@ import javax.swing.ListCellRenderer; import javax.swing.ListModel; import javax.swing.event.ListDataListener; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb; import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager; @@ -67,10 +68,13 @@ class AddTaggedHashesToHashDbConfigPanel extends javax.swing.JPanel { private void populateTagNameComponents() { // Get the tag names in use for the current case. try { - tagNames = Case.getCurrentCase().getServices().getTagsManager().getTagNamesInUse(); + tagNames = Case.getOpenCase().getServices().getTagsManager().getTagNamesInUse(); } catch (TskCoreException ex) { Logger.getLogger(AddTaggedHashesToHashDbConfigPanel.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); JOptionPane.showMessageDialog(this, "Error getting tag names for case.", "Tag Names Not Found", JOptionPane.ERROR_MESSAGE); + } catch (NoCurrentCaseException ex) { + Logger.getLogger(AddTaggedHashesToHashDbConfigPanel.class.getName()).log(Level.SEVERE, "Exception while getting open case.", ex); + JOptionPane.showMessageDialog(this, "Error getting tag names for case.", "Exception while getting open case.", JOptionPane.ERROR_MESSAGE); } // Mark the tag names as unselected. Note that tagNameSelections is a @@ -256,6 +260,9 @@ class AddTaggedHashesToHashDbConfigPanel extends javax.swing.JPanel { .addComponent(selectAllButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addContainerGap()) ); + + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deselectAllButton, selectAllButton}); + layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() diff --git a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java index ed0c216ac8..adb366878c 100644 --- a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java +++ b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.List; import javax.xml.bind.DatatypeConverter; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.Blackboard; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; @@ -63,8 +64,8 @@ final class CustomArtifactType { * * @throws BlackboardException If there is an error adding any of the types. */ - static void addToCaseDatabase() throws Blackboard.BlackboardException { - Blackboard blackboard = Case.getCurrentCase().getServices().getBlackboard(); + static void addToCaseDatabase() throws Blackboard.BlackboardException, NoCurrentCaseException { + Blackboard blackboard = Case.getOpenCase().getServices().getBlackboard(); artifactType = blackboard.getOrAddArtifactType(ARTIFACT_TYPE_NAME, ARTIFACT_DISPLAY_NAME); intAttrType = blackboard.getOrAddAttributeType(INT_ATTR_TYPE_NAME, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.INTEGER, INT_ATTR_DISPLAY_NAME); doubleAttrType = blackboard.getOrAddAttributeType(DOUBLE_ATTR_TYPE_NAME, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DOUBLE, DOUBLE_ATTR_DISPLAY_NAME); diff --git a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorDataSourceIngestModule.java b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorDataSourceIngestModule.java index a6026357d1..8293ba934e 100644 --- a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorDataSourceIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorDataSourceIngestModule.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.test; import java.util.logging.Level; import org.openide.util.NbBundle; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.Blackboard; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleAdapter; @@ -53,7 +54,7 @@ public class CustomArtifactsCreatorDataSourceIngestModule extends DataSourceInge public void startUp(IngestJobContext context) throws IngestModuleException { try { CustomArtifactType.addToCaseDatabase(); - } catch (Blackboard.BlackboardException ex) { + } catch (Blackboard.BlackboardException | NoCurrentCaseException ex) { throw new IngestModuleException(Bundle.CustomArtifactsCreatorDataSourceIngestModule_exceptionMessage_errorCreatingCustomType(), ex); } } diff --git a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorFileIngestModule.java index 752b007778..abd6f0d00d 100644 --- a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorFileIngestModule.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.test; import java.util.logging.Level; import org.openide.util.NbBundle; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.Blackboard; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.FileIngestModuleAdapter; @@ -52,7 +53,7 @@ final class CustomArtifactsCreatorFileIngestModule extends FileIngestModuleAdapt public void startUp(IngestJobContext context) throws IngestModuleException { try { CustomArtifactType.addToCaseDatabase(); - } catch (Blackboard.BlackboardException ex) { + } catch (Blackboard.BlackboardException | NoCurrentCaseException ex) { throw new IngestModuleException(Bundle.CustomArtifactsCreatorFileIngestModule_exceptionMessage_errorCreatingCustomType(), ex); } } diff --git a/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java b/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java index a57623f02e..f56d4cb043 100644 --- a/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,6 +25,7 @@ import java.util.logging.Level; import org.openide.util.Exceptions; import org.openide.util.NbBundle; 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.ingest.FileIngestModuleAdapter; @@ -53,10 +54,10 @@ final class InterestingArtifactCreatorIngestModule extends FileIngestModuleAdapt @Override public void startUp(IngestJobContext context) throws IngestModuleException { - Blackboard blackboard = Case.getCurrentCase().getServices().getBlackboard(); try { + Blackboard blackboard = Case.getOpenCase().getServices().getBlackboard(); artifactType = blackboard.getOrAddArtifactType(INT_ARTIFACT_TYPE_NAME, INT_ARTIFACT_DISPLAY_NAME); - } catch (Blackboard.BlackboardException ex) { + } catch (Blackboard.BlackboardException | NoCurrentCaseException ex) { throw new IngestModuleException(Bundle.InterestingArtifactCreatorIngestModule_exceptionMessage_errorCreatingCustomType(), ex); } } @@ -76,7 +77,7 @@ final class InterestingArtifactCreatorIngestModule extends FileIngestModuleAdapt * type. */ int randomArtIndex = (int) (Math.random() * 3); - Blackboard blackboard = Case.getCurrentCase().getServices().getBlackboard(); + Blackboard blackboard = Case.getOpenCase().getServices().getBlackboard(); BlackboardArtifact.Type artifactTypeBase = blackboard.getOrAddArtifactType(ARTIFACT_TYPE_NAMES[randomArtIndex], ARTIFACT_DISPLAY_NAMES[randomArtIndex]); BlackboardArtifact artifactBase = file.newArtifact(artifactTypeBase.getTypeID()); Collection baseAttributes = new ArrayList<>(); @@ -123,7 +124,7 @@ final class InterestingArtifactCreatorIngestModule extends FileIngestModuleAdapt attributes.add(att3); attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT, MODULE_NAME, artifactBase.getArtifactID())); artifact.addAttributes(attributes); - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { logger.log(Level.SEVERE, String.format("Failed to process file (obj_id = %d)", file.getId()), ex); return ProcessResult.ERROR; } catch (Blackboard.BlackboardException ex) { diff --git a/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java b/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java index aca5c4e7f7..c6e995c195 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2014-2017 Basis Technology Corp. + * Copyright 2014-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,6 +33,7 @@ import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.util.actions.CallableSystemAction; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.core.Installer; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; @@ -80,7 +81,7 @@ public final class OpenTimelineAction extends CallableSystemAction { @Override public boolean isEnabled() { /** - * We used to also check if Case.getCurrentCase().hasData() was true. We + * We used to also check if Case.getOpenCase().hasData() was true. We * disabled that check because if it is executed while a data source is * being added, it blocks the edt. We still do that in ImageGallery. */ @@ -111,7 +112,7 @@ public final class OpenTimelineAction extends CallableSystemAction { "OpenTimeLineAction.msgdlg.text=Could not create timeline, there are no data sources."}) synchronized private void showTimeline(AbstractFile file, BlackboardArtifact artifact) { try { - Case currentCase = Case.getCurrentCase(); + Case currentCase = Case.getOpenCase(); if (currentCase.hasData() == false) { MessageNotifyUtil.Message.info(Bundle.OpenTimeLineAction_msgdlg_text()); logger.log(Level.INFO, "Could not create timeline, there are no data sources.");// NON-NLS @@ -131,7 +132,7 @@ public final class OpenTimelineAction extends CallableSystemAction { MessageNotifyUtil.Message.error(Bundle.OpenTimelineAction_settingsErrorMessage()); logger.log(Level.SEVERE, "Failed to initialize per case timeline settings.", iOException); } - } catch (IllegalStateException e) { + } catch (NoCurrentCaseException e) { //there is no case... Do nothing. } } @@ -212,8 +213,8 @@ public final class OpenTimelineAction extends CallableSystemAction { private boolean tooManyFiles() { try { - return FILE_LIMIT < Case.getCurrentCase().getSleuthkitCase().countFilesWhere("1 = 1"); - } catch (IllegalStateException ex) { + return FILE_LIMIT < Case.getOpenCase().getSleuthkitCase().countFilesWhere("1 = 1"); + } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Can not open timeline with no case open.", ex); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Error counting files in the DB.", ex); diff --git a/Core/src/org/sleuthkit/autopsy/timeline/TimeLineController.java b/Core/src/org/sleuthkit/autopsy/timeline/TimeLineController.java index 3c8062355b..b382814f0d 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/TimeLineController.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/TimeLineController.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2014-2016 Basis Technology Corp. + * Copyright 2014-2018 Basis Technology Corp. * Contact: carrier sleuthkit 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; } diff --git a/Core/src/org/sleuthkit/autopsy/timeline/TimeLineTopComponent.java b/Core/src/org/sleuthkit/autopsy/timeline/TimeLineTopComponent.java index 70933143c2..2b0bf5d383 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/TimeLineTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/TimeLineTopComponent.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -51,6 +51,7 @@ import org.openide.windows.RetainLocation; import org.openide.windows.TopComponent; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.actions.AddBookmarkTagAction; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.corecomponents.DataContentPanel; import org.sleuthkit.autopsy.corecomponents.DataResultPanel; import org.sleuthkit.autopsy.corecomponents.TableFilterNode; @@ -132,7 +133,7 @@ public final class TimeLineTopComponent extends TopComponent implements Explorer contentViewerPanel.setNode(null); } }); - } catch (IllegalStateException ex) { + } catch (NoCurrentCaseException ex) { //Since the case is closed, the user probably doesn't care about this, just log it as a precaution. LOGGER.log(Level.SEVERE, "There was no case open to lookup the Sleuthkit object backing a SingleEvent.", ex); // NON-NLS } catch (TskCoreException ex) { diff --git a/Core/src/org/sleuthkit/autopsy/timeline/actions/SaveSnapshotAsReport.java b/Core/src/org/sleuthkit/autopsy/timeline/actions/SaveSnapshotAsReport.java index d9226b587a..e0b3a3e333 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/actions/SaveSnapshotAsReport.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/actions/SaveSnapshotAsReport.java @@ -47,6 +47,7 @@ import org.controlsfx.validation.Validator; import org.openide.util.NbBundle; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.FileUtil; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.timeline.PromptDialogManager; @@ -152,12 +153,12 @@ public class SaveSnapshotAsReport extends Action { try { //add main file as report to case - Case.getCurrentCase().addReport(reportMainFilePath.toString(), Bundle.Timeline_ModuleName(), reportName); - } catch (TskCoreException ex) { + Case.getOpenCase().addReport(reportMainFilePath.toString(), Bundle.Timeline_ModuleName(), reportName); + } catch (TskCoreException | NoCurrentCaseException ex) { LOGGER.log(Level.WARNING, "Failed to add " + reportMainFilePath.toString() + " to case as a report", ex); //NON_NLS new Alert(Alert.AlertType.ERROR, Bundle.SaveSnapShotAsReport_FailedToAddReport()).show(); return; - } + } //notify user of report location final Alert alert = new Alert(Alert.AlertType.INFORMATION, null, OPEN, OK); diff --git a/Core/src/org/sleuthkit/autopsy/timeline/actions/ViewFileInTimelineAction.java b/Core/src/org/sleuthkit/autopsy/timeline/actions/ViewFileInTimelineAction.java index 75085293a2..73c511a3be 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/actions/ViewFileInTimelineAction.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/actions/ViewFileInTimelineAction.java @@ -39,9 +39,13 @@ public final class ViewFileInTimelineAction extends AbstractAction { private ViewFileInTimelineAction(AbstractFile file, String displayName) { super(displayName); this.file = file; - - if(file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK) - || file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)){ + + if (file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK) + || file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) + || (file.getCrtime() <= 0 + && file.getCtime() <= 0 + && file.getMtime() <= 0 + && file.getAtime() <= 0)) { this.setEnabled(false); } } diff --git a/Core/src/org/sleuthkit/autopsy/timeline/explorernodes/EventNode.java b/Core/src/org/sleuthkit/autopsy/timeline/explorernodes/EventNode.java index cf0524a893..d8f0bf9ac3 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/explorernodes/EventNode.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/explorernodes/EventNode.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,6 +33,7 @@ import org.openide.nodes.Sheet; 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 org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.datamodel.DataModelActionsFactory; @@ -215,14 +216,14 @@ public class EventNode extends DisplayableItemNode { * @return An EventNode with the file (and artifact) backing this event in * its lookup. */ - public static EventNode createEventNode(final Long eventID, FilteredEventsModel eventsModel) throws TskCoreException, IllegalStateException { + public static EventNode createEventNode(final Long eventID, FilteredEventsModel eventsModel) throws TskCoreException, NoCurrentCaseException { /* * Look up the event by id and creata an EventNode with the appropriate * data in the lookup. */ final SingleEvent eventById = eventsModel.getEventById(eventID); - SleuthkitCase sleuthkitCase = Case.getCurrentCase().getSleuthkitCase(); + SleuthkitCase sleuthkitCase = Case.getOpenCase().getSleuthkitCase(); AbstractFile file = sleuthkitCase.getAbstractFileById(eventById.getFileID()); if (eventById.getArtifactID().isPresent()) { diff --git a/Core/src/org/sleuthkit/autopsy/timeline/explorernodes/EventRootNode.java b/Core/src/org/sleuthkit/autopsy/timeline/explorernodes/EventRootNode.java index 1b35d90188..3924918d06 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/explorernodes/EventRootNode.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/explorernodes/EventRootNode.java @@ -29,6 +29,7 @@ import org.openide.nodes.Children; import org.openide.nodes.Node; import org.openide.util.NbBundle; import org.openide.util.lookup.Lookups; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.datamodel.DisplayableItemNode; import org.sleuthkit.autopsy.datamodel.DisplayableItemNodeVisitor; @@ -130,7 +131,7 @@ public class EventRootNode extends DisplayableItemNode { } else { try { return EventNode.createEventNode(eventID, filteredEvents); - } catch (IllegalStateException ex) { + } catch (NoCurrentCaseException ex) { //Since the case is closed, the user probably doesn't care about this, just log it as a precaution. LOGGER.log(Level.SEVERE, "There was no case open to lookup the Sleuthkit object backing a SingleEvent.", ex); // NON-NLS return null; diff --git a/Core/src/org/sleuthkit/autopsy/timeline/ui/listvew/ListTimeline.java b/Core/src/org/sleuthkit/autopsy/timeline/ui/listvew/ListTimeline.java index f7bfba4501..7515891356 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/ui/listvew/ListTimeline.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/ui/listvew/ListTimeline.java @@ -78,6 +78,7 @@ import org.controlsfx.control.action.ActionUtils; import org.openide.awt.Actions; import org.openide.util.NbBundle; import org.openide.util.actions.Presenter; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ThreadConfined; @@ -668,7 +669,7 @@ class ListTimeline extends BorderPane { //show new context menu. new ContextMenu(menuItems.toArray(new MenuItem[menuItems.size()])) .show(this, contextMenuEvent.getScreenX(), contextMenuEvent.getScreenY()); - } catch (IllegalStateException ex) { + } catch (NoCurrentCaseException ex) { //Since the case is closed, the user probably doesn't care about this, just log it as a precaution. LOGGER.log(Level.SEVERE, "There was no case open to lookup the Sleuthkit object backing a SingleEvent.", ex); //NON-NLS } catch (TskCoreException ex) { diff --git a/Core/test/qa-functional/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDatamodelTest.java b/Core/test/qa-functional/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDatamodelTest.java index cce1e807e1..105f13146a 100644 --- a/Core/test/qa-functional/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDatamodelTest.java +++ b/Core/test/qa-functional/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDatamodelTest.java @@ -41,6 +41,7 @@ import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.datamodel.TskData; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; /** * @@ -2343,9 +2344,9 @@ public class CentralRepoDatamodelTest extends TestCase { // Test creating a case from an Autopsy case // The case may already be in the database - the result is the same either way try { - caseB = EamDb.getInstance().newCase(Case.getCurrentCase()); + caseB = EamDb.getInstance().newCase(Case.getOpenCase()); assertTrue("Failed to create correlation case from Autopsy case", caseB != null); - } catch (EamDbException ex) { + } catch (EamDbException | NoCurrentCaseException ex) { Exceptions.printStackTrace(ex); Assert.fail(ex); return; @@ -2412,9 +2413,9 @@ public class CentralRepoDatamodelTest extends TestCase { // Test getting a case from an Autopsy case try { - CorrelationCase tempCase = EamDb.getInstance().getCase(Case.getCurrentCase()); + CorrelationCase tempCase = EamDb.getInstance().getCase(Case.getOpenCase()); assertTrue("getCase returned null for current Autopsy case", tempCase != null); - } catch (EamDbException ex) { + } catch (EamDbException | NoCurrentCaseException ex) { Exceptions.printStackTrace(ex); Assert.fail(ex); } diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestManager.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestManager.java index c1c766d139..c9fb9a7003 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestManager.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestManager.java @@ -97,6 +97,8 @@ import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.autopsy.ingest.IngestJobStartResult; import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.IngestModuleError; +import org.sleuthkit.autopsy.keywordsearch.KeywordSearchModuleException; +import org.sleuthkit.autopsy.keywordsearch.Server; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.DataSource; import org.sleuthkit.datamodel.SleuthkitCase; @@ -2250,6 +2252,13 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen Case.openAsCurrentCase(metadataFilePath.toString()); } else { caseDirectoryPath = PathUtils.createCaseFolderPath(rootOutputDirectory, caseName); + + // Create the case directory now in case it is needed by selectSolrServerForCase + Case.createCaseDirectory(caseDirectoryPath.toString(), CaseType.MULTI_USER_CASE); + + // If a list of servers exists, choose one to use for this case + Server.selectSolrServerForCase(rootOutputDirectory, caseDirectoryPath); + CaseDetails caseDetails = new CaseDetails(caseName); Case.createAsCurrentCase(CaseType.MULTI_USER_CASE, caseDirectoryPath.toString(), caseDetails); /* @@ -2264,6 +2273,8 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen SYS_LOGGER.log(Level.INFO, "Opened case {0} for {1}", new Object[]{caseForJob.getName(), manifest.getFilePath()}); return caseForJob; + } catch (KeywordSearchModuleException ex) { + throw new CaseManagementException(String.format("Error creating solr settings file for case %s for %s", caseName, manifest.getFilePath()), ex); } catch (CaseActionException ex) { throw new CaseManagementException(String.format("Error creating or opening case %s for %s", caseName, manifest.getFilePath()), ex); } catch (IllegalStateException ex) { diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java index af26dd2e97..671e964372 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -313,8 +313,18 @@ public abstract class DrawableFile { return this.file; } + /** + * Get the width of the visual content. + * + * @return The width. + */ abstract Double getWidth(); + /** + * Get the height of the visual content. + * + * @return The height. + */ abstract Double getHeight(); public String getDrawablePath() { diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/VideoFile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/VideoFile.java index 7e963e512b..290e5a6e75 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/VideoFile.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/VideoFile.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013-15 Basis Technology Corp. + * Copyright 2013-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,6 +23,7 @@ import java.io.File; import java.io.IOException; import java.lang.ref.SoftReference; import java.nio.file.Paths; +import java.util.logging.Level; import javafx.concurrent.Task; import javafx.scene.image.Image; import javafx.scene.media.Media; @@ -34,19 +35,31 @@ import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.VideoUtils; import org.sleuthkit.autopsy.datamodel.ContentUtils; import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; public class VideoFile extends DrawableFile { - private static final Logger LOGGER = Logger.getLogger(VideoFile.class.getName()); + private static final Logger logger = Logger.getLogger(VideoFile.class.getName()); - private static final Image VIDEO_ICON = new Image("org/sleuthkit/autopsy/imagegallery/images/Clapperboard.png"); //NON-NLS + private static final Image videoIcon = new Image("org/sleuthkit/autopsy/imagegallery/images/Clapperboard.png"); //NON-NLS + /** + * Instantiate a VideoFile object. + * + * @param file The file on which to base the object. + * @param analyzed + */ VideoFile(AbstractFile file, Boolean analyzed) { super(file, analyzed); } + /** + * Get the genereric video thumbnail. + * + * @return The thumbnail. + */ public static Image getGenericVideoThumbnail() { - return VIDEO_ICON; + return videoIcon; } @@ -63,6 +76,14 @@ public class VideoFile extends DrawableFile { private SoftReference mediaRef; + /** + * Get the media associated with the VideoFile. + * + * @return The media. + * + * @throws IOException + * @throws MediaException + */ @NbBundle.Messages({"VideoFile.getMedia.progress=writing temporary file to disk"}) public Media getMedia() throws IOException, MediaException { Media media = (mediaRef != null) ? mediaRef.get() : null; @@ -88,11 +109,19 @@ public class VideoFile extends DrawableFile { @Override Double getWidth() { + double retValue = -1.0; + try { - return (double) getMedia().getWidth(); - } catch (IOException | MediaException ex) { - return -1.0; + retValue = (double) getMedia().getWidth(); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, "Error reading video file.", ex); //NON-NLS + } catch (IOException ex) { + logger.log(Level.SEVERE, "Error writing video file to disk.", ex); //NON-NLS + } catch (MediaException ex) { + logger.log(Level.SEVERE, "Error creating media from source file.", ex); //NON-NLS } + + return retValue; } @Override @@ -102,10 +131,18 @@ public class VideoFile extends DrawableFile { @Override Double getHeight() { + double retValue = -1.0; + try { - return (double) getMedia().getHeight(); - } catch (IOException | MediaException ex) { - return -1.0; + retValue = (double) getMedia().getHeight(); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, "Error reading video file.", ex); //NON-NLS + } catch (IOException ex) { + logger.log(Level.SEVERE, "Error writing video file to disk.", ex); //NON-NLS + } catch (MediaException ex) { + logger.log(Level.SEVERE, "Error creating media from source file.", ex); //NON-NLS } + + return retValue; } } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ArtifactTextExtractor.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ArtifactTextExtractor.java index 962e5ba245..61b9bb3b20 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ArtifactTextExtractor.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ArtifactTextExtractor.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,6 +25,7 @@ import java.nio.charset.StandardCharsets; import java.util.logging.Level; import org.apache.commons.io.IOUtils; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.datamodel.ContentUtils; import org.sleuthkit.datamodel.AbstractFile; @@ -57,9 +58,9 @@ class ArtifactTextExtractor implements TextExtractor { Case currentCase; try { - currentCase = Case.getCurrentCase(); - } catch (IllegalStateException ignore) { - // thorown by Case.getCurrentCase() if currentCase is null + currentCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ignore) { + // thorown by Case.getOpenCase() if currentCase is null return null; } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/DropdownToolbar.form b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/DropdownToolbar.form index a769778ffa..5adb8e1819 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/DropdownToolbar.form +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/DropdownToolbar.form @@ -37,8 +37,8 @@ - - + + @@ -97,9 +97,6 @@ - - - diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/DropdownToolbar.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/DropdownToolbar.java index 1ad473dd01..11452e917b 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/DropdownToolbar.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/DropdownToolbar.java @@ -250,13 +250,13 @@ class DropdownToolbar extends javax.swing.JPanel { setOpaque(false); - listsButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon.png"))); // NOI18N NON-NLS + listsButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon.png"))); // NOI18N listsButton.setText(org.openide.util.NbBundle.getMessage(DropdownToolbar.class, "ListBundleName")); // NOI18N listsButton.setBorderPainted(false); listsButton.setContentAreaFilled(false); listsButton.setEnabled(false); - listsButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon-rollover.png"))); // NOI18N NON-NLS - listsButton.setRolloverSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon-pressed.png"))); // NOI18N NON-NLS + listsButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon-rollover.png"))); // NOI18N + listsButton.setRolloverSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon-pressed.png"))); // NOI18N listsButton.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { listsButtonMousePressed(evt); @@ -268,16 +268,15 @@ class DropdownToolbar extends javax.swing.JPanel { } }); - searchDropButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon.png"))); // NOI18N NON-NLS + searchDropButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon.png"))); // NOI18N searchDropButton.setText(org.openide.util.NbBundle.getMessage(DropdownToolbar.class, "KeywordSearchPanel.searchDropButton.text")); // NOI18N searchDropButton.setBorderPainted(false); searchDropButton.setContentAreaFilled(false); searchDropButton.setEnabled(false); searchDropButton.setMaximumSize(new java.awt.Dimension(146, 27)); searchDropButton.setMinimumSize(new java.awt.Dimension(146, 27)); - searchDropButton.setPreferredSize(new java.awt.Dimension(146, 27)); - searchDropButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon-rollover.png"))); // NOI18N NON-NLS - searchDropButton.setRolloverSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon-pressed.png"))); // NOI18N NON-NLS + searchDropButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon-rollover.png"))); // NOI18N + searchDropButton.setRolloverSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon-pressed.png"))); // NOI18N searchDropButton.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { searchDropButtonMousePressed(evt); @@ -294,8 +293,8 @@ class DropdownToolbar extends javax.swing.JPanel { .addComponent(listsButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 7, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, 0) - .addComponent(searchDropButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(1, 1, 1) + .addComponent(searchDropButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); layout.setVerticalGroup( diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java index 08b2d0a7bb..88163b357c 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java @@ -31,6 +31,7 @@ import org.openide.util.Lookup; import org.openide.util.NbBundle; import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.keywordsearch.KeywordSearchResultFactory.AdHocQueryResult; @@ -176,7 +177,7 @@ public class ExtractedContentViewer implements DataContentViewer { if (rawArtifactText != null) { sources.add(rawArtifactText); } - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Error creating RawText for " + file, ex); //NON-NLS } @@ -206,7 +207,7 @@ public class ExtractedContentViewer implements DataContentViewer { } - static private IndexedText getRawArtifactText(BlackboardArtifact artifact) throws TskCoreException { + static private IndexedText getRawArtifactText(BlackboardArtifact artifact) throws TskCoreException, NoCurrentCaseException { IndexedText rawArtifactText = null; if (null != artifact) { /* @@ -219,7 +220,7 @@ public class ExtractedContentViewer implements DataContentViewer { BlackboardAttribute attribute = artifact.getAttribute(TSK_ASSOCIATED_ARTIFACT_TYPE); if (attribute != null) { long artifactId = attribute.getValueLong(); - BlackboardArtifact associatedArtifact = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifact(artifactId); + BlackboardArtifact associatedArtifact = Case.getOpenCase().getSleuthkitCase().getBlackboardArtifact(artifactId); rawArtifactText = new RawText(associatedArtifact, associatedArtifact.getArtifactID()); } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalEditListPanel.form b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalEditListPanel.form index cbfad12e0b..1915d29efd 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalEditListPanel.form +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalEditListPanel.form @@ -54,16 +54,16 @@ - + - + - + - + diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalEditListPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalEditListPanel.java index 043af08692..1b55a2926c 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalEditListPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalEditListPanel.java @@ -320,16 +320,16 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis .addGroup(listEditorPanelLayout.createSequentialGroup() .addGap(10, 10, 10) .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 483, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(listEditorPanelLayout.createSequentialGroup() .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(ingestMessagesCheckbox) .addGroup(listEditorPanelLayout.createSequentialGroup() - .addComponent(newKeywordsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(newKeywordsButton) .addGap(14, 14, 14) - .addComponent(editWordButton, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(editWordButton) .addGap(14, 14, 14) - .addComponent(deleteWordButton, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(deleteWordButton))) .addGap(0, 0, Short.MAX_VALUE))))) .addContainerGap()) ); diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.form b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.form index 18c416a00f..efc030a985 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.form +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.form @@ -41,7 +41,6 @@ - @@ -63,7 +62,7 @@ - + @@ -88,7 +87,7 @@ - + diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.java index c5701d7dad..2a362dc945 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.java @@ -207,7 +207,6 @@ final class GlobalListSettingsPanel extends javax.swing.JPanel implements Option rightPanel = new javax.swing.JPanel(); mainSplitPane.setBorder(null); - mainSplitPane.setDividerLocation(361); mainSplitPane.setDividerSize(1); leftPanel.setPreferredSize(new java.awt.Dimension(309, 327)); @@ -217,7 +216,7 @@ final class GlobalListSettingsPanel extends javax.swing.JPanel implements Option leftPanel.setLayout(leftPanelLayout); leftPanelLayout.setHorizontalGroup( leftPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 361, Short.MAX_VALUE) + .addGap(0, 309, Short.MAX_VALUE) ); leftPanelLayout.setVerticalGroup( leftPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -232,7 +231,7 @@ final class GlobalListSettingsPanel extends javax.swing.JPanel implements Option rightPanel.setLayout(rightPanelLayout); rightPanelLayout.setHorizontalGroup( rightPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 311, Short.MAX_VALUE) + .addGap(0, 362, Short.MAX_VALUE) ); rightPanelLayout.setVerticalGroup( rightPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.form b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.form index 6609e672e0..630cefd77f 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.form +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.form @@ -23,8 +23,7 @@ - - + @@ -40,11 +39,11 @@ - + - + @@ -54,7 +53,7 @@ - + @@ -118,9 +117,6 @@ - - - @@ -144,9 +140,6 @@ - - - @@ -177,9 +170,6 @@ - - - @@ -203,9 +193,6 @@ - - - @@ -229,9 +216,6 @@ - - - @@ -255,9 +239,6 @@ - - - diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.java index 403ba84929..1d0dce9189 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.java @@ -217,7 +217,6 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa newListButton.setMargin(new java.awt.Insets(2, 6, 2, 6)); newListButton.setMaximumSize(new java.awt.Dimension(111, 25)); newListButton.setMinimumSize(new java.awt.Dimension(111, 25)); - newListButton.setPreferredSize(new java.awt.Dimension(111, 25)); newListButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newListButtonActionPerformed(evt); @@ -230,7 +229,6 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa importButton.setMargin(new java.awt.Insets(2, 6, 2, 6)); importButton.setMaximumSize(new java.awt.Dimension(111, 25)); importButton.setMinimumSize(new java.awt.Dimension(111, 25)); - importButton.setPreferredSize(new java.awt.Dimension(111, 25)); importButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { importButtonActionPerformed(evt); @@ -245,7 +243,6 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa exportButton.setMargin(new java.awt.Insets(2, 6, 2, 6)); exportButton.setMaximumSize(new java.awt.Dimension(111, 25)); exportButton.setMinimumSize(new java.awt.Dimension(111, 25)); - exportButton.setPreferredSize(new java.awt.Dimension(111, 25)); exportButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exportButtonActionPerformed(evt); @@ -258,7 +255,6 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa copyListButton.setMargin(new java.awt.Insets(2, 6, 2, 6)); copyListButton.setMaximumSize(new java.awt.Dimension(111, 25)); copyListButton.setMinimumSize(new java.awt.Dimension(111, 25)); - copyListButton.setPreferredSize(new java.awt.Dimension(111, 25)); copyListButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { copyListButtonActionPerformed(evt); @@ -271,7 +267,6 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa deleteListButton.setMargin(new java.awt.Insets(2, 6, 2, 6)); deleteListButton.setMaximumSize(new java.awt.Dimension(111, 25)); deleteListButton.setMinimumSize(new java.awt.Dimension(111, 25)); - deleteListButton.setPreferredSize(new java.awt.Dimension(111, 25)); deleteListButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deleteListButtonActionPerformed(evt); @@ -284,7 +279,6 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa renameListButton.setMargin(new java.awt.Insets(2, 6, 2, 6)); renameListButton.setMaximumSize(new java.awt.Dimension(111, 25)); renameListButton.setMinimumSize(new java.awt.Dimension(111, 25)); - renameListButton.setPreferredSize(new java.awt.Dimension(111, 25)); renameListButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { renameListButtonActionPerformed(evt); @@ -297,8 +291,7 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 345, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(newListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -310,10 +303,10 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa .addGap(6, 6, 6) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(exportButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(deleteListButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGap(0, 0, Short.MAX_VALUE)) - .addComponent(keywordListsLabel)) - .addGap(6, 6, 6)) + .addComponent(deleteListButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addComponent(keywordListsLabel) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) + .addGap(12, 12, Short.MAX_VALUE)) ); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {copyListButton, deleteListButton, exportButton, importButton, newListButton, renameListButton}); @@ -324,7 +317,7 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa .addGap(22, 22, 22) .addComponent(keywordListsLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 305, Short.MAX_VALUE) + .addComponent(jScrollPane1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(newListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordHit.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordHit.java index f9284e81d9..c45b70c863 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordHit.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordHit.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,6 +24,7 @@ import java.util.Comparator; import java.util.Optional; import org.apache.commons.lang3.StringUtils; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; @@ -116,7 +117,12 @@ class KeywordHit implements Comparable { long getContentID() throws TskCoreException { if (isArtifactHit()) { // If the hit was in an artifact, look up the source content for the artifact. - SleuthkitCase caseDb = Case.getCurrentCase().getSleuthkitCase(); + SleuthkitCase caseDb; + try { + caseDb = Case.getOpenCase().getSleuthkitCase(); + } catch (NoCurrentCaseException ex) { + throw new TskCoreException("Exception while getting open case.", ex); + } try (SleuthkitCase.CaseDbQuery executeQuery = caseDb.executeQuery(GET_CONTENT_ID_FROM_ARTIFACT_ID + this.solrObjectId); ResultSet resultSet = executeQuery.getResultSet();) { diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchGlobalSearchSettingsPanel.form b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchGlobalSearchSettingsPanel.form index cddda17778..b274b5b2e8 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchGlobalSearchSettingsPanel.form +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchGlobalSearchSettingsPanel.form @@ -38,10 +38,10 @@ - - - - + + + + @@ -55,9 +55,9 @@ - + - + diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchGlobalSearchSettingsPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchGlobalSearchSettingsPanel.java index 6d0a443709..e6c8a98662 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchGlobalSearchSettingsPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchGlobalSearchSettingsPanel.java @@ -190,10 +190,10 @@ class KeywordSearchGlobalSearchSettingsPanel extends javax.swing.JPanel implemen .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(skipNSRLCheckBox) .addComponent(showSnippetsCB) - .addComponent(filesIndexedLabel) .addGroup(layout.createSequentialGroup() - .addGap(141, 141, 141) - .addComponent(filesIndexedValue, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(filesIndexedLabel) + .addGap(18, 18, 18) + .addComponent(filesIndexedValue)) .addComponent(frequencyLabel) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) @@ -206,9 +206,12 @@ class KeywordSearchGlobalSearchSettingsPanel extends javax.swing.JPanel implemen .addGroup(layout.createSequentialGroup() .addComponent(chunksLabel) .addGap(18, 18, 18) - .addComponent(chunksValLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE))))) + .addComponent(chunksValLabel))))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); + + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {chunksLabel, filesIndexedLabel}); + layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestModule.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestModule.java index a767e71cee..83cdafb88a 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestModule.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestModule.java @@ -27,6 +27,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.core.UserPreferences; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; @@ -144,7 +145,8 @@ public final class KeywordSearchIngestModule implements FileIngestModule { @Messages({ "KeywordSearchIngestModule.startupMessage.failedToGetIndexSchema=Failed to get schema version for text index.", "# {0} - Solr version number", "KeywordSearchIngestModule.startupException.indexSolrVersionNotSupported=Adding text no longer supported for Solr version {0} of the text index.", - "# {0} - schema version number", "KeywordSearchIngestModule.startupException.indexSchemaNotSupported=Adding text no longer supported for schema version {0} of the text index." + "# {0} - schema version number", "KeywordSearchIngestModule.startupException.indexSchemaNotSupported=Adding text no longer supported for schema version {0} of the text index.", + "KeywordSearchIngestModule.noOpenCase.errMsg=No open case available." }) @Override public void startUp(IngestJobContext context) throws IngestModuleException { @@ -180,19 +182,26 @@ public final class KeywordSearchIngestModule implements FileIngestModule { // increment the module reference count // if first instance of this module for this job then check the server and existence of keywords + Case openCase; + try { + openCase = Case.getOpenCase(); + } catch (NoCurrentCaseException ex) { + throw new IngestModuleException(Bundle.KeywordSearchIngestModule_noOpenCase_errMsg(), ex); + } if (refCounter.incrementAndGet(jobId) == 1) { - if (Case.getCurrentCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) { + if (openCase.getCaseType() == Case.CaseType.MULTI_USER_CASE) { // for multi-user cases need to verify connection to remore SOLR server KeywordSearchService kwsService = new SolrSearchService(); + Server.IndexingServerProperties properties = Server.getMultiUserServerProperties(openCase.getCaseDirectory()); int port; try { - port = Integer.parseInt(UserPreferences.getIndexingServerPort()); + port = Integer.parseInt(properties.getPort()); } catch (NumberFormatException ex) { // if there is an error parsing the port number throw new IngestModuleException(Bundle.KeywordSearchIngestModule_init_badInitMsg() + " " + Bundle.SolrConnectionCheck_Port(), ex); } try { - kwsService.tryConnect(UserPreferences.getIndexingServerHost(), port); + kwsService.tryConnect(properties.getHost(), port); } catch (KeywordSearchServiceException ex) { throw new IngestModuleException(Bundle.KeywordSearchIngestModule_init_badInitMsg(), ex); } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchResultFactory.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchResultFactory.java index fd15fb0cf2..290fe8b086 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchResultFactory.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchResultFactory.java @@ -39,6 +39,7 @@ import org.openide.nodes.Node; 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 org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.datamodel.AbstractAbstractFileNode; @@ -147,8 +148,8 @@ class KeywordSearchResultFactory extends ChildFactory { } SleuthkitCase tskCase; try { - tskCase = Case.getCurrentCase().getSleuthkitCase(); - } catch (IllegalStateException ex) { + tskCase = Case.getOpenCase().getSleuthkitCase(); + } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "There was no case open.", ex); //NON-NLS return false; } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/QueryResults.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/QueryResults.java index 585424b3ec..b4e07d0d8a 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/QueryResults.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/QueryResults.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,6 +32,7 @@ import org.netbeans.api.progress.ProgressHandle; import org.netbeans.api.progress.aggregate.ProgressContributor; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.EscapeUtil; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.IngestMessage; @@ -212,9 +213,9 @@ class QueryResults { */ Content content = null; try { - SleuthkitCase tskCase = Case.getCurrentCase().getSleuthkitCase(); + SleuthkitCase tskCase = Case.getOpenCase().getSleuthkitCase(); content = tskCase.getContentById(hit.getContentID()); - } catch (TskCoreException | IllegalStateException tskCoreException) { + } catch (TskCoreException | NoCurrentCaseException tskCoreException) { logger.log(Level.SEVERE, "Failed to get text source object for ", tskCoreException); //NON-NLS } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RegexQuery.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RegexQuery.java index 306502603c..ad0fc0a678 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RegexQuery.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RegexQuery.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -39,6 +39,7 @@ import org.apache.solr.common.params.CursorMarkParams; import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.datamodel.CreditCards; @@ -590,11 +591,11 @@ final class RegexQuery implements KeywordSearchQuery { * Create an account instance. */ try { - AccountFileInstance ccAccountInstance = Case.getCurrentCase().getSleuthkitCase().getCommunicationsManager().createAccountFileInstance(Account.Type.CREDIT_CARD, ccnAttribute.getValueString() , MODULE_NAME, content); + AccountFileInstance ccAccountInstance = Case.getOpenCase().getSleuthkitCase().getCommunicationsManager().createAccountFileInstance(Account.Type.CREDIT_CARD, ccnAttribute.getValueString() , MODULE_NAME, content); ccAccountInstance.addAttributes(attributes); - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { LOGGER.log(Level.SEVERE, "Error creating CCN account instance", ex); //NON-NLS } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Server.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Server.java index 0e9b804757..23380b15ae 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Server.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Server.java @@ -39,7 +39,9 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Iterator; import java.util.List; +import java.util.Random; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.logging.Level; import javax.swing.AbstractAction; @@ -63,6 +65,7 @@ import org.openide.modules.Places; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case.CaseType; +import org.sleuthkit.autopsy.casemodule.CaseMetadata; import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ModuleSettings; @@ -721,16 +724,15 @@ public class Server { */ @NbBundle.Messages({ "# {0} - core name", "Server.deleteCore.exception.msg=Failed to delete Solr core {0}",}) - void deleteCore(String coreName, Case.CaseType caseType) throws KeywordSearchServiceException { + void deleteCore(String coreName, CaseMetadata metadata) throws KeywordSearchServiceException { try { HttpSolrServer solrServer; - if (caseType == CaseType.SINGLE_USER_CASE) { + if (metadata.getCaseType() == CaseType.SINGLE_USER_CASE) { Integer localSolrServerPort = Integer.decode(ModuleSettings.getConfigSetting(PROPERTIES_FILE, PROPERTIES_CURRENT_SERVER_PORT)); solrServer = new HttpSolrServer("http://localhost:" + localSolrServerPort + "/solr"); //NON-NLS } else { - String host = UserPreferences.getIndexingServerHost(); - String port = UserPreferences.getIndexingServerPort(); - solrServer = new HttpSolrServer("http://" + host + ":" + port + "/solr"); //NON-NLS + IndexingServerProperties properties = getMultiUserServerProperties(metadata.getCaseDirectory()); + solrServer = new HttpSolrServer("http://" + properties.getHost() + ":" + properties.getPort() + "/solr"); //NON-NLS } connectToSolrServer(solrServer); CoreAdminResponse response = CoreAdminRequest.getStatus(coreName, solrServer); @@ -768,9 +770,8 @@ public class Server { if (theCase.getCaseType() == CaseType.SINGLE_USER_CASE) { currentSolrServer = this.localSolrServer; } else { - String host = UserPreferences.getIndexingServerHost(); - String port = UserPreferences.getIndexingServerPort(); - currentSolrServer = new HttpSolrServer("http://" + host + ":" + port + "/solr"); //NON-NLS + IndexingServerProperties properties = getMultiUserServerProperties(theCase.getCaseDirectory()); + currentSolrServer = new HttpSolrServer("http://" + properties.getHost() + ":" + properties.getPort() + "/solr"); //NON-NLS } connectToSolrServer(currentSolrServer); @@ -829,6 +830,139 @@ public class Server { throw new KeywordSearchModuleException(NbBundle.getMessage(this.getClass(), "Server.openCore.exception.cantOpen.msg"), ex); } } + + /** + * Get the host and port for a multiuser case. + * If the file solrserver.txt exists, then use the values from that file. + * Otherwise use the settings from the properties file. + * + * @param caseDirectory Current case directory + * @return IndexingServerProperties containing the solr host/port for this case + */ + public static IndexingServerProperties getMultiUserServerProperties(String caseDirectory) { + + Path serverFilePath = Paths.get(caseDirectory, "solrserver.txt"); + if(serverFilePath.toFile().exists()){ + try{ + List lines = Files.readAllLines(serverFilePath); + if(lines.isEmpty()) { + logger.log(Level.SEVERE, "solrserver.txt file does not contain any data"); + } else if (! lines.get(0).contains(",")) { + logger.log(Level.SEVERE, "solrserver.txt file is corrupt - could not read host/port from " + lines.get(0)); + } else { + String[] parts = lines.get(0).split(","); + if(parts.length != 2) { + logger.log(Level.SEVERE, "solrserver.txt file is corrupt - could not read host/port from " + lines.get(0)); + } else { + return new IndexingServerProperties(parts[0], parts[1]); + } + } + } catch (IOException ex) { + logger.log(Level.SEVERE, "solrserver.txt file could not be read", ex); + } + } + + // Default back to the user preferences if the solrserver.txt file was not found or if an error occurred + String host = UserPreferences.getIndexingServerHost(); + String port = UserPreferences.getIndexingServerPort(); + return new IndexingServerProperties(host, port); + } + + /** + * Pick a solr server to use for this case and record it in the case directory. + * Looks for a file named "solrServerList.txt" in the root output directory - + * if this does not exist then no server is recorded. + * + * Format of solrServerList.txt: + * , + * Ex: 10.1.2.34,8983 + * + * @param rootOutputDirectory + * @param caseDirectoryPath + * @throws KeywordSearchModuleException + */ + public static void selectSolrServerForCase(Path rootOutputDirectory, Path caseDirectoryPath) throws KeywordSearchModuleException { + // Look for the solr server list file + String serverListName = "solrServerList.txt"; + Path serverListPath = Paths.get(rootOutputDirectory.toString(), serverListName); + if(serverListPath.toFile().exists()){ + + // Read the list of solr servers + List lines; + try{ + lines = Files.readAllLines(serverListPath); + } catch (IOException ex){ + throw new KeywordSearchModuleException(serverListName + " could not be read", ex); + } + + // Remove any lines that don't contain a comma (these are likely just whitespace) + for (Iterator iterator = lines.iterator(); iterator.hasNext();) { + String line = iterator.next(); + if (! line.contains(",")) { + // Remove the current element from the iterator and the list. + iterator.remove(); + } + } + if(lines.isEmpty()) { + throw new KeywordSearchModuleException(serverListName + " had no valid server information"); + } + + // Choose which server to use + int rnd = new Random().nextInt(lines.size()); + String[] parts = lines.get(rnd).split(","); + if(parts.length != 2) { + throw new KeywordSearchModuleException("Invalid server data: " + lines.get(rnd)); + } + + // Split it up just to do a sanity check on the data + String host = parts[0]; + String port = parts[1]; + if(host.isEmpty() || port.isEmpty()) { + throw new KeywordSearchModuleException("Invalid server data: " + lines.get(rnd)); + } + + // Write the server data to a file + Path serverFile = Paths.get(caseDirectoryPath.toString(), "solrserver.txt"); + try { + caseDirectoryPath.toFile().mkdirs(); + if (! caseDirectoryPath.toFile().exists()) { + throw new KeywordSearchModuleException("Case directory " + caseDirectoryPath.toString() + " does not exist"); + } + Files.write(serverFile, lines.get(rnd).getBytes()); + } catch (IOException ex){ + throw new KeywordSearchModuleException(serverFile.toString() + " could not be written", ex); + } + } + } + + /** + * Helper class to store the current server properties + */ + public static class IndexingServerProperties { + private final String host; + private final String port; + + IndexingServerProperties (String host, String port) { + this.host = host; + this.port = port; + } + + /** + * Get the host + * @return host + */ + public String getHost() { + return host; + } + + /** + * Get the port + * @return port + */ + public String getPort() { + return port; + } + } /** * Commits current core if it exists diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/SolrSearchService.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/SolrSearchService.java index 52e5da17f1..3fea1a51ee 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/SolrSearchService.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/SolrSearchService.java @@ -203,7 +203,7 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService { * Unload/delete the core on the server and then delete the text * index files. */ - KeywordSearch.getServer().deleteCore(index.getIndexName(), metadata.getCaseType()); + KeywordSearch.getServer().deleteCore(index.getIndexName(), metadata); if (!FileUtil.deleteDir(new File(index.getIndexPath()).getParentFile())) { throw new KeywordSearchServiceException(Bundle.SolrSearchService_exceptionMessage_failedToDeleteIndexFiles(index.getIndexPath())); } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/TermsComponentQuery.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/TermsComponentQuery.java index d42f0b5b64..b2d1ef37e1 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/TermsComponentQuery.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/TermsComponentQuery.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -34,6 +34,7 @@ import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.response.TermsResponse.Term; import org.openide.util.Exceptions; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Version; import org.sleuthkit.autopsy.datamodel.CreditCards; @@ -494,10 +495,9 @@ final class TermsComponentQuery implements KeywordSearchQuery { * Create an account. */ try { - AccountFileInstance ccAccountInstance = Case.getCurrentCase().getSleuthkitCase().getCommunicationsManager().createAccountFileInstance(Account.Type.CREDIT_CARD, ccnAttribute.getValueString(), MODULE_NAME, content); + AccountFileInstance ccAccountInstance = Case.getOpenCase().getSleuthkitCase().getCommunicationsManager().createAccountFileInstance(Account.Type.CREDIT_CARD, ccnAttribute.getValueString(), MODULE_NAME, content); ccAccountInstance.addAttributes(attributes); - //newArtifact = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifact(ccAccountInstance.getArtifactId()); - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { LOGGER.log(Level.SEVERE, "Error creating CCN account instance", ex); //NON-NLS } diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Chrome.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Chrome.java index a25f03f5b5..0f9a98cd88 100644 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Chrome.java +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Chrome.java @@ -2,7 +2,7 @@ * * Autopsy Forensic Browser * - * Copyright 2012-2014 Basis Technology Corp. + * Copyright 2012-2018 Basis Technology Corp. * * Copyright 2012 42six Solutions. * @@ -47,6 +47,7 @@ import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE; import org.sleuthkit.datamodel.Content; +import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskData; @@ -55,12 +56,12 @@ import org.sleuthkit.datamodel.TskData; */ class Chrome extends Extract { - private static final String historyQuery = "SELECT urls.url, urls.title, urls.visit_count, urls.typed_count, " //NON-NLS + private static final String HISTORY_QUERY = "SELECT urls.url, urls.title, urls.visit_count, urls.typed_count, " //NON-NLS + "last_visit_time, urls.hidden, visits.visit_time, (SELECT urls.url FROM urls WHERE urls.id=visits.url) AS from_visit, visits.transition FROM urls, visits WHERE urls.id = visits.url"; //NON-NLS - private static final String cookieQuery = "SELECT name, value, host_key, expires_utc,last_access_utc, creation_utc FROM cookies"; //NON-NLS - private static final String downloadQuery = "SELECT full_path, url, start_time, received_bytes FROM downloads"; //NON-NLS - private static final String downloadQueryVersion30 = "SELECT current_path AS full_path, url, start_time, received_bytes FROM downloads, downloads_url_chains WHERE downloads.id=downloads_url_chains.id"; //NON-NLS - private static final String loginQuery = "SELECT origin_url, username_value, signon_realm from logins"; //NON-NLS + private static final String COOKIE_QUERY = "SELECT name, value, host_key, expires_utc,last_access_utc, creation_utc FROM cookies"; //NON-NLS + private static final String DOWNLOAD_QUERY = "SELECT full_path, url, start_time, received_bytes FROM downloads"; //NON-NLS + private static final String DOWNLOAD_QUERY_V30 = "SELECT current_path AS full_path, url, start_time, received_bytes FROM downloads, downloads_url_chains WHERE downloads.id=downloads_url_chains.id"; //NON-NLS + private static final String LOGIN_QUERY = "SELECT origin_url, username_value, signon_realm from logins"; //NON-NLS private final Logger logger = Logger.getLogger(this.getClass().getName()); private Content dataSource; private IngestJobContext context; @@ -115,15 +116,22 @@ class Chrome extends Extract { Collection bbartifacts = new ArrayList<>(); int j = 0; while (j < historyFiles.size()) { - String temps = RAImageIngestModule.getRATempPath(currentCase, "chrome") + File.separator + historyFiles.get(j).getName().toString() + j + ".db"; //NON-NLS + String temps = RAImageIngestModule.getRATempPath(currentCase, "chrome") + File.separator + historyFiles.get(j).getName() + j + ".db"; //NON-NLS final AbstractFile historyFile = historyFiles.get(j++); if (historyFile.getSize() == 0) { continue; } try { ContentUtils.writeToFile(historyFile, new File(temps), context::dataSourceIngestIsCancelled); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Error reading Chrome web history artifacts file '%s' (id=%d).", + historyFile.getName(), historyFile.getId()), ex); //NON-NLS + this.addErrorMessage(NbBundle.getMessage(this.getClass(), "Chrome.getHistory.errMsg.errAnalyzingFile", + this.getName(), historyFile.getName())); + continue; } catch (IOException ex) { - logger.log(Level.SEVERE, "Error writing temp sqlite db for Chrome web history artifacts.{0}", ex); //NON-NLS + logger.log(Level.SEVERE, String.format("Error writing temp sqlite db file '%s' for Chrome web history artifacts file '%s' (id=%d).", + temps, historyFile.getName(), historyFile.getId()), ex); //NON-NLS this.addErrorMessage(NbBundle.getMessage(this.getClass(), "Chrome.getHistory.errMsg.errAnalyzingFile", this.getName(), historyFile.getName())); continue; @@ -134,7 +142,7 @@ class Chrome extends Extract { break; } List> tempList; - tempList = this.dbConnect(temps, historyQuery); + tempList = this.dbConnect(temps, HISTORY_QUERY); logger.log(Level.INFO, "{0}- Now getting history from {1} with {2}artifacts identified.", new Object[]{moduleName, temps, tempList.size()}); //NON-NLS for (HashMap result : tempList) { Collection bbattributes = new ArrayList(); @@ -175,7 +183,7 @@ class Chrome extends Extract { */ private void getBookmark() { FileManager fileManager = currentCase.getServices().getFileManager(); - List bookmarkFiles = null; + List bookmarkFiles; try { bookmarkFiles = fileManager.findFiles(dataSource, "Bookmarks", "Chrome"); //NON-NLS } catch (TskCoreException ex) { @@ -199,11 +207,18 @@ class Chrome extends Extract { if (bookmarkFile.getSize() == 0) { continue; } - String temps = RAImageIngestModule.getRATempPath(currentCase, "chrome") + File.separator + bookmarkFile.getName().toString() + j + ".db"; //NON-NLS + String temps = RAImageIngestModule.getRATempPath(currentCase, "chrome") + File.separator + bookmarkFile.getName() + j + ".db"; //NON-NLS try { ContentUtils.writeToFile(bookmarkFile, new File(temps), context::dataSourceIngestIsCancelled); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Error reading Chrome bookmark artifacts file '%s' (id=%d).", + bookmarkFile.getName(), bookmarkFile.getId()), ex); //NON-NLS + this.addErrorMessage(NbBundle.getMessage(this.getClass(), "Chrome.getBookmark.errMsg.errAnalyzingFile", + this.getName(), bookmarkFile.getName())); + continue; } catch (IOException ex) { - logger.log(Level.SEVERE, "Error writing temp sqlite db for Chrome bookmark artifacts.{0}", ex); //NON-NLS + logger.log(Level.SEVERE, String.format("Error writing temp sqlite db file '%s' for Chrome bookmark artifacts file '%s' (id=%d).", + temps, bookmarkFile.getName(), bookmarkFile.getId()), ex); //NON-NLS this.addErrorMessage(NbBundle.getMessage(this.getClass(), "Chrome.getBookmark.errMsg.errAnalyzingFile", this.getName(), bookmarkFile.getName())); continue; @@ -341,14 +356,20 @@ class Chrome extends Extract { if (cookiesFile.getSize() == 0) { continue; } - String temps = RAImageIngestModule.getRATempPath(currentCase, "chrome") + File.separator + cookiesFile.getName().toString() + j + ".db"; //NON-NLS + String temps = RAImageIngestModule.getRATempPath(currentCase, "chrome") + File.separator + cookiesFile.getName() + j + ".db"; //NON-NLS try { ContentUtils.writeToFile(cookiesFile, new File(temps), context::dataSourceIngestIsCancelled); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Error reading Chrome cookie artifacts file '%s' (id=%d).", + cookiesFile.getName(), cookiesFile.getId()), ex); //NON-NLS + this.addErrorMessage(NbBundle.getMessage(this.getClass(), "Chrome.getCookie.errMsg.errAnalyzeFile", + this.getName(), cookiesFile.getName())); + continue; } catch (IOException ex) { - logger.log(Level.SEVERE, "Error writing temp sqlite db for Chrome cookie artifacts.{0}", ex); //NON-NLS - this.addErrorMessage( - NbBundle.getMessage(this.getClass(), "Chrome.getCookie.errMsg.errAnalyzeFile", this.getName(), - cookiesFile.getName())); + logger.log(Level.SEVERE, String.format("Error writing temp sqlite db file '%s' for Chrome cookie artifacts file '%s' (id=%d).", + temps, cookiesFile.getName(), cookiesFile.getId()), ex); //NON-NLS + this.addErrorMessage(NbBundle.getMessage(this.getClass(), "Chrome.getCookie.errMsg.errAnalyzeFile", + this.getName(), cookiesFile.getName())); continue; } File dbFile = new File(temps); @@ -357,10 +378,10 @@ class Chrome extends Extract { break; } - List> tempList = this.dbConnect(temps, cookieQuery); + List> tempList = this.dbConnect(temps, COOKIE_QUERY); logger.log(Level.INFO, "{0}- Now getting cookies from {1} with {2}artifacts identified.", new Object[]{moduleName, temps, tempList.size()}); //NON-NLS for (HashMap result : tempList) { - Collection bbattributes = new ArrayList(); + Collection bbattributes = new ArrayList<>(); bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL, NbBundle.getMessage(this.getClass(), "Chrome.parentModuleName"), ((result.get("host_key").toString() != null) ? result.get("host_key").toString() : ""))); //NON-NLS @@ -401,7 +422,7 @@ class Chrome extends Extract { */ private void getDownload() { FileManager fileManager = currentCase.getServices().getFileManager(); - List downloadFiles = null; + List downloadFiles; try { downloadFiles = fileManager.findFiles(dataSource, "History", "Chrome"); //NON-NLS } catch (TskCoreException ex) { @@ -424,11 +445,18 @@ class Chrome extends Extract { if (downloadFile.getSize() == 0) { continue; } - String temps = RAImageIngestModule.getRATempPath(currentCase, "chrome") + File.separator + downloadFile.getName().toString() + j + ".db"; //NON-NLS + String temps = RAImageIngestModule.getRATempPath(currentCase, "chrome") + File.separator + downloadFile.getName() + j + ".db"; //NON-NLS try { ContentUtils.writeToFile(downloadFile, new File(temps), context::dataSourceIngestIsCancelled); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Error reading Chrome download artifacts file '%s' (id=%d).", + downloadFile.getName(), downloadFile.getId()), ex); //NON-NLS + this.addErrorMessage(NbBundle.getMessage(this.getClass(), "Chrome.getDownload.errMsg.errAnalyzeFiles1", + this.getName(), downloadFile.getName())); + continue; } catch (IOException ex) { - logger.log(Level.SEVERE, "Error writing temp sqlite db for Chrome download artifacts.{0}", ex); //NON-NLS + logger.log(Level.SEVERE, String.format("Error writing temp sqlite db file '%s' for Chrome download artifacts file '%s' (id=%d).", + temps, downloadFile.getName(), downloadFile.getId()), ex); //NON-NLS this.addErrorMessage(NbBundle.getMessage(this.getClass(), "Chrome.getDownload.errMsg.errAnalyzeFiles1", this.getName(), downloadFile.getName())); continue; @@ -442,14 +470,14 @@ class Chrome extends Extract { List> tempList; if (isChromePreVersion30(temps)) { - tempList = this.dbConnect(temps, downloadQuery); + tempList = this.dbConnect(temps, DOWNLOAD_QUERY); } else { - tempList = this.dbConnect(temps, downloadQueryVersion30); + tempList = this.dbConnect(temps, DOWNLOAD_QUERY_V30); } logger.log(Level.INFO, "{0}- Now getting downloads from {1} with {2}artifacts identified.", new Object[]{moduleName, temps, tempList.size()}); //NON-NLS for (HashMap result : tempList) { - Collection bbattributes = new ArrayList(); + Collection bbattributes = new ArrayList<>(); bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH, NbBundle.getMessage(this.getClass(), "Chrome.parentModuleName"), (result.get("full_path").toString()))); //NON-NLS long pathID = Util.findID(dataSource, (result.get("full_path").toString())); //NON-NLS @@ -517,14 +545,20 @@ class Chrome extends Extract { if (signonFile.getSize() == 0) { continue; } - String temps = RAImageIngestModule.getRATempPath(currentCase, "chrome") + File.separator + signonFile.getName().toString() + j + ".db"; //NON-NLS + String temps = RAImageIngestModule.getRATempPath(currentCase, "chrome") + File.separator + signonFile.getName() + j + ".db"; //NON-NLS try { ContentUtils.writeToFile(signonFile, new File(temps), context::dataSourceIngestIsCancelled); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Error reading Chrome login artifacts file '%s' (id=%d).", + signonFile.getName(), signonFile.getId()), ex); //NON-NLS + this.addErrorMessage(NbBundle.getMessage(this.getClass(), "Chrome.getLogin.errMsg.errAnalyzingFiles", + this.getName(), signonFile.getName())); + continue; } catch (IOException ex) { - logger.log(Level.SEVERE, "Error writing temp sqlite db for Chrome login artifacts.{0}", ex); //NON-NLS - this.addErrorMessage( - NbBundle.getMessage(this.getClass(), "Chrome.getLogin.errMsg.errAnalyzingFiles", this.getName(), - signonFile.getName())); + logger.log(Level.SEVERE, String.format("Error writing temp sqlite db file '%s' for Chrome login artifacts file '%s' (id=%d).", + temps, signonFile.getName(), signonFile.getId()), ex); //NON-NLS + this.addErrorMessage(NbBundle.getMessage(this.getClass(), "Chrome.getLogin.errMsg.errAnalyzingFiles", + this.getName(), signonFile.getName())); continue; } File dbFile = new File(temps); @@ -532,7 +566,7 @@ class Chrome extends Extract { dbFile.delete(); break; } - List> tempList = this.dbConnect(temps, loginQuery); + List> tempList = this.dbConnect(temps, LOGIN_QUERY); logger.log(Level.INFO, "{0}- Now getting login information from {1} with {2}artifacts identified.", new Object[]{moduleName, temps, tempList.size()}); //NON-NLS for (HashMap result : tempList) { Collection bbattributes = new ArrayList<>(); diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java index 0759f17c7e..51f34cfa5c 100644 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java @@ -55,6 +55,7 @@ import org.sleuthkit.autopsy.ingest.IngestModule.IngestModuleException; import org.sleuthkit.autopsy.ingest.IngestServices; import org.sleuthkit.autopsy.ingest.ModuleDataEvent; import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchService; +import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; /** * Extract windows registry data using regripper. Runs two versions of @@ -78,8 +79,8 @@ class ExtractRegistry extends Extract { final private static UsbDeviceIdMapper USB_MAPPER = new UsbDeviceIdMapper(); final private static String RIP_EXE = "rip.exe"; final private static String RIP_PL = "rip.pl"; - private List rrCmd = new ArrayList<>(); - private List rrFullCmd= new ArrayList<>(); + private final List rrCmd = new ArrayList<>(); + private final List rrFullCmd= new ArrayList<>(); ExtractRegistry() throws IngestModuleException { @@ -182,8 +183,16 @@ class ExtractRegistry extends Extract { File regFileNameLocalFile = new File(regFileNameLocal); try { ContentUtils.writeToFile(regFile, regFileNameLocalFile, context::dataSourceIngestIsCancelled); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Error reading registry file '%s' (id=%d).", + regFile.getName(), regFile.getId()), ex); //NON-NLS + this.addErrorMessage( + NbBundle.getMessage(this.getClass(), "ExtractRegistry.analyzeRegFiles.errMsg.errWritingTemp", + this.getName(), regFileName)); + continue; } catch (IOException ex) { - logger.log(Level.SEVERE, "Error writing the temp registry file. {0}", ex); //NON-NLS + logger.log(Level.SEVERE, String.format("Error writing temp registry file '%s' for registry file '%s' (id=%d).", + regFileNameLocal, regFile.getName(), regFile.getId()), ex); //NON-NLS this.addErrorMessage( NbBundle.getMessage(this.getClass(), "ExtractRegistry.analyzeRegFiles.errMsg.errWritingTemp", this.getName(), regFileName)); diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Firefox.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Firefox.java index 34dfc24733..22459f4cf6 100644 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Firefox.java +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Firefox.java @@ -2,7 +2,7 @@ * * Autopsy Forensic Browser * - * Copyright 2012-2014 Basis Technology Corp. + * Copyright 2012-2018 Basis Technology Corp. * * Copyright 2012 42six Solutions. * Contact: aebadirad 42six com @@ -45,6 +45,7 @@ import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE; import org.sleuthkit.datamodel.Content; +import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; import org.sleuthkit.datamodel.TskCoreException; /** @@ -53,12 +54,12 @@ import org.sleuthkit.datamodel.TskCoreException; class Firefox extends Extract { private static final Logger logger = Logger.getLogger(Firefox.class.getName()); - private static final String historyQuery = "SELECT moz_historyvisits.id,url,title,visit_count,(visit_date/1000000) AS visit_date,from_visit,(SELECT url FROM moz_places WHERE id=moz_historyvisits.from_visit) as ref FROM moz_places, moz_historyvisits WHERE moz_places.id = moz_historyvisits.place_id AND hidden = 0"; //NON-NLS - private static final String cookieQuery = "SELECT name,value,host,expiry,(lastAccessed/1000000) AS lastAccessed,(creationTime/1000000) AS creationTime FROM moz_cookies"; //NON-NLS - private static final String cookieQueryV3 = "SELECT name,value,host,expiry,(lastAccessed/1000000) AS lastAccessed FROM moz_cookies"; //NON-NLS - private static final String bookmarkQuery = "SELECT fk, moz_bookmarks.title, url, (moz_bookmarks.dateAdded/1000000) AS dateAdded FROM moz_bookmarks INNER JOIN moz_places ON moz_bookmarks.fk=moz_places.id"; //NON-NLS - private static final String downloadQuery = "SELECT target, source,(startTime/1000000) AS startTime, maxBytes FROM moz_downloads"; //NON-NLS - private static final String downloadQueryVersion24 = "SELECT url, content AS target, (lastModified/1000000) AS lastModified FROM moz_places, moz_annos WHERE moz_places.id = moz_annos.place_id AND moz_annos.anno_attribute_id = 3"; //NON-NLS + private static final String HISTORY_QUERY = "SELECT moz_historyvisits.id,url,title,visit_count,(visit_date/1000000) AS visit_date,from_visit,(SELECT url FROM moz_places WHERE id=moz_historyvisits.from_visit) as ref FROM moz_places, moz_historyvisits WHERE moz_places.id = moz_historyvisits.place_id AND hidden = 0"; //NON-NLS + private static final String COOKIE_QUERY = "SELECT name,value,host,expiry,(lastAccessed/1000000) AS lastAccessed,(creationTime/1000000) AS creationTime FROM moz_cookies"; //NON-NLS + private static final String COOKIE_QUERY_V3 = "SELECT name,value,host,expiry,(lastAccessed/1000000) AS lastAccessed FROM moz_cookies"; //NON-NLS + private static final String BOOKMARK_QUERY = "SELECT fk, moz_bookmarks.title, url, (moz_bookmarks.dateAdded/1000000) AS dateAdded FROM moz_bookmarks INNER JOIN moz_places ON moz_bookmarks.fk=moz_places.id"; //NON-NLS + private static final String DOWNLOAD_QUERY = "SELECT target, source,(startTime/1000000) AS startTime, maxBytes FROM moz_downloads"; //NON-NLS + private static final String DOWNLOAD_QUERY_V24 = "SELECT url, content AS target, (lastModified/1000000) AS lastModified FROM moz_places, moz_annos WHERE moz_places.id = moz_annos.place_id AND moz_annos.anno_attribute_id = 3"; //NON-NLS private final IngestServices services = IngestServices.getInstance(); private Content dataSource; private IngestJobContext context; @@ -108,8 +109,16 @@ class Firefox extends Extract { String temps = RAImageIngestModule.getRATempPath(currentCase, "firefox") + File.separator + fileName + j + ".db"; //NON-NLS try { ContentUtils.writeToFile(historyFile, new File(temps), context::dataSourceIngestIsCancelled); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Error reading Firefox web history artifacts file '%s' (id=%d).", + fileName, historyFile.getId()), ex); //NON-NLS + this.addErrorMessage( + NbBundle.getMessage(this.getClass(), "Firefox.getHistory.errMsg.errAnalyzeFile", this.getName(), + fileName)); + continue; } catch (IOException ex) { - logger.log(Level.SEVERE, "Error writing the sqlite db for firefox web history artifacts.{0}", ex); //NON-NLS + logger.log(Level.SEVERE, String.format("Error writing temp sqlite db file '%s' for Firefox web history artifacts file '%s' (id=%d).", + temps, fileName, historyFile.getId()), ex); //NON-NLS this.addErrorMessage( NbBundle.getMessage(this.getClass(), "Firefox.getHistory.errMsg.errAnalyzeFile", this.getName(), fileName)); @@ -120,7 +129,7 @@ class Firefox extends Extract { dbFile.delete(); break; } - List> tempList = this.dbConnect(temps, historyQuery); + List> tempList = this.dbConnect(temps, HISTORY_QUERY); logger.log(Level.INFO, "{0} - Now getting history from {1} with {2} artifacts identified.", new Object[]{moduleName, temps, tempList.size()}); //NON-NLS for (HashMap result : tempList) { Collection bbattributes = new ArrayList<>(); @@ -195,8 +204,16 @@ class Firefox extends Extract { String temps = RAImageIngestModule.getRATempPath(currentCase, "firefox") + File.separator + fileName + j + ".db"; //NON-NLS try { ContentUtils.writeToFile(bookmarkFile, new File(temps), context::dataSourceIngestIsCancelled); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Error reading Firefox bookmark artifacts file '%s' (id=%d).", + fileName, bookmarkFile.getId()), ex); //NON-NLS + this.addErrorMessage( + NbBundle.getMessage(this.getClass(), "Firefox.getHistory.errMsg.errAnalyzeFile", this.getName(), + fileName)); + continue; } catch (IOException ex) { - logger.log(Level.SEVERE, "Error writing the sqlite db for firefox bookmark artifacts.{0}", ex); //NON-NLS + logger.log(Level.SEVERE, String.format("Error writing temp sqlite db file '%s' for Firefox bookmark artifacts file '%s' (id=%d).", + temps, fileName, bookmarkFile.getId()), ex); //NON-NLS this.addErrorMessage(NbBundle.getMessage(this.getClass(), "Firefox.getBookmark.errMsg.errAnalyzeFile", this.getName(), fileName)); continue; @@ -206,7 +223,7 @@ class Firefox extends Extract { dbFile.delete(); break; } - List> tempList = this.dbConnect(temps, bookmarkQuery); + List> tempList = this.dbConnect(temps, BOOKMARK_QUERY); logger.log(Level.INFO, "{0} - Now getting bookmarks from {1} with {2} artifacts identified.", new Object[]{moduleName, temps, tempList.size()}); //NON-NLS for (HashMap result : tempList) { @@ -279,8 +296,16 @@ class Firefox extends Extract { String temps = RAImageIngestModule.getRATempPath(currentCase, "firefox") + File.separator + fileName + j + ".db"; //NON-NLS try { ContentUtils.writeToFile(cookiesFile, new File(temps), context::dataSourceIngestIsCancelled); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Error reading Firefox cookie artifacts file '%s' (id=%d).", + fileName, cookiesFile.getId()), ex); //NON-NLS + this.addErrorMessage( + NbBundle.getMessage(this.getClass(), "Firefox.getHistory.errMsg.errAnalyzeFile", this.getName(), + fileName)); + continue; } catch (IOException ex) { - logger.log(Level.SEVERE, "Error writing the sqlite db for firefox cookie artifacts.{0}", ex); //NON-NLS + logger.log(Level.SEVERE, String.format("Error writing temp sqlite db file '%s' for Firefox cookie artifacts file '%s' (id=%d).", + temps, fileName, cookiesFile.getId()), ex); //NON-NLS this.addErrorMessage( NbBundle.getMessage(this.getClass(), "Firefox.getCookie.errMsg.errAnalyzeFile", this.getName(), fileName)); @@ -294,9 +319,9 @@ class Firefox extends Extract { boolean checkColumn = Util.checkColumn("creationTime", "moz_cookies", temps); //NON-NLS String query; if (checkColumn) { - query = cookieQuery; + query = COOKIE_QUERY; } else { - query = cookieQueryV3; + query = COOKIE_QUERY_V3; } List> tempList = this.dbConnect(temps, query); @@ -394,8 +419,16 @@ class Firefox extends Extract { int errors = 0; try { ContentUtils.writeToFile(downloadsFile, new File(temps), context::dataSourceIngestIsCancelled); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Error reading Firefox download artifacts file '%s' (id=%d).", + fileName, downloadsFile.getId()), ex); //NON-NLS + this.addErrorMessage( + NbBundle.getMessage(this.getClass(), "Firefox.getHistory.errMsg.errAnalyzeFile", this.getName(), + fileName)); + continue; } catch (IOException ex) { - logger.log(Level.SEVERE, "Error writing the sqlite db for firefox download artifacts.{0}", ex); //NON-NLS + logger.log(Level.SEVERE, String.format("Error writing temp sqlite db file '%s' for Firefox download artifacts file '%s' (id=%d).", + temps, fileName, downloadsFile.getId()), ex); //NON-NLS this.addErrorMessage(NbBundle.getMessage(this.getClass(), "Firefox.getDlPre24.errMsg.errAnalyzeFiles", this.getName(), fileName)); continue; @@ -406,7 +439,7 @@ class Firefox extends Extract { break; } - List> tempList = this.dbConnect(temps, downloadQuery); + List> tempList = this.dbConnect(temps, DOWNLOAD_QUERY); logger.log(Level.INFO, "{0}- Now getting downloads from {1} with {2} artifacts identified.", new Object[]{moduleName, temps, tempList.size()}); //NON-NLS for (HashMap result : tempList) { @@ -426,7 +459,7 @@ class Firefox extends Extract { if (target != null) { try { - String decodedTarget = URLDecoder.decode(target.toString().replaceAll("file:///", ""), "UTF-8"); //NON-NLS + String decodedTarget = URLDecoder.decode(target.replaceAll("file:///", ""), "UTF-8"); //NON-NLS bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH, NbBundle.getMessage(this.getClass(), "Firefox.parentModuleName.noSpace"), @@ -507,8 +540,16 @@ class Firefox extends Extract { int errors = 0; try { ContentUtils.writeToFile(downloadsFile, new File(temps), context::dataSourceIngestIsCancelled); + } catch (ReadContentInputStreamException ex) { + logger.log(Level.WARNING, String.format("Error reading Firefox download artifacts file '%s' (id=%d).", + fileName, downloadsFile.getId()), ex); //NON-NLS + this.addErrorMessage( + NbBundle.getMessage(this.getClass(), "Firefox.getHistory.errMsg.errAnalyzeFile", this.getName(), + fileName)); + continue; } catch (IOException ex) { - logger.log(Level.SEVERE, "Error writing the sqlite db for firefox download artifacts.{0}", ex); //NON-NLS + logger.log(Level.SEVERE, String.format("Error writing temp sqlite db file '%s' for Firefox download artifacts file '%s' (id=%d).", + temps, fileName, downloadsFile.getId()), ex); //NON-NLS this.addErrorMessage( NbBundle.getMessage(this.getClass(), "Firefox.getDlV24.errMsg.errAnalyzeFile", this.getName(), fileName)); @@ -520,7 +561,7 @@ class Firefox extends Extract { break; } - List> tempList = this.dbConnect(temps, downloadQueryVersion24); + List> tempList = this.dbConnect(temps, DOWNLOAD_QUERY_V24); logger.log(Level.INFO, "{0} - Now getting downloads from {1} with {2} artifacts identified.", new Object[]{moduleName, temps, tempList.size()}); //NON-NLS for (HashMap result : tempList) { @@ -538,7 +579,7 @@ class Firefox extends Extract { String target = result.get("target").toString(); //NON-NLS if (target != null) { try { - String decodedTarget = URLDecoder.decode(target.toString().replaceAll("file:///", ""), "UTF-8"); //NON-NLS + String decodedTarget = URLDecoder.decode(target.replaceAll("file:///", ""), "UTF-8"); //NON-NLS bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH, NbBundle.getMessage(this.getClass(), "Firefox.parentModuleName.noSpace"), diff --git a/ruleset.xml b/ruleset.xml index b97681d624..07a44a73c9 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -114,7 +114,8 @@ - + @@ -178,7 +179,10 @@ - + diff --git a/test/script/tskdbdiff.py b/test/script/tskdbdiff.py index 66d8340078..c52c8f14fb 100644 --- a/test/script/tskdbdiff.py +++ b/test/script/tskdbdiff.py @@ -489,7 +489,7 @@ def normalize_db_entry(line, files_table, vs_parts_table, vs_info_table, fs_info if 'BulkExtractor' in path or 'Smirk' in path: # chop off the last folder (which contains a date/time) path = path[:path.rfind('\\')] - if '\\Reports\\AutopsyTestCase HTML Report' in path: + if 'Reports\\AutopsyTestCase HTML Report' in path: path = 'Reports\\AutopsyTestCase HTML Report' if parent_id in files_table.keys():