From 5d656fb76042d69b87301c345e4469ae92331f42 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Mon, 7 Oct 2013 14:40:33 -0400 Subject: [PATCH 1/2] Initial fix for stale data model problem when processing logical files --- .../casemodule/services/FileManager.java | 2 ++ .../DirectoryTreeTopComponent.java | 23 ++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/FileManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/FileManager.java index 56ed85bf12..192632eecf 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/FileManager.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/FileManager.java @@ -280,6 +280,8 @@ public class FileManager implements Closeable { //added.add(localFileAdded); //send new content event //for now reusing ingest events, in future this will be replaced by datamodel / observer sending out events + // @@@ Is this the right place for this? A directory tree refresh will be triggered, so this may be creating a race condition + // since the transaction is not yet committed. IngestServices.getDefault().fireModuleContentEvent(new ModuleContentEvent(localFileAdded)); } } diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java index 05ae16d893..8728ec8e16 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java @@ -528,9 +528,26 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat } } // changed current case else if (changed.equals(Case.CASE_CURRENT_CASE)) { - - // case opened - if (newValue != null) { + // When a case is closed, the old value of this property is the + // closed Case object and the new value is null. When a case is + // opened, the old value is null and the new value the new Case + // object. + // @@@ This needs to be revisited. Perhaps case closed and case + // opened events instead of property change events would be a better + // solution. Either way, more probably needs to be done to clean up + // data model objects when a case is closed. + if (oldValue != null && newValue == null) { + // The current case has been closed. Reset the ExplorerManager. + Node emptyNode = new AbstractNode(Children.LEAF); + em.setRootContext(emptyNode); + } + else if (newValue != null) { + // A new case has been opened. Reset the forward and back + // buttons. Note that a call to CoreComponentControl.openCoreWindows() + // by the new Case object will lead to a componentOpened() call + // that will repopulate the tree. + // @@@ The repopulation of the tree in this fashion also merits + // reconsideration. resetHistory(); } } // if the image is added to the case From bb18ea13b33c5a1c0faf89270fa3165208a4c097 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Mon, 7 Oct 2013 14:46:58 -0400 Subject: [PATCH 2/2] Fixed grammatical error in DirectoryTreeTopComponent comment --- .../autopsy/directorytree/DirectoryTreeTopComponent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java index 8728ec8e16..8f9ec67a99 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java @@ -530,7 +530,7 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat else if (changed.equals(Case.CASE_CURRENT_CASE)) { // When a case is closed, the old value of this property is the // closed Case object and the new value is null. When a case is - // opened, the old value is null and the new value the new Case + // opened, the old value is null and the new value is the new Case // object. // @@@ This needs to be revisited. Perhaps case closed and case // opened events instead of property change events would be a better