From f1cb56d8454cfcddbaec5166c5076b4b05518f0f Mon Sep 17 00:00:00 2001 From: Greg DiCristofaro Date: Tue, 24 Nov 2020 07:32:24 -0500 Subject: [PATCH 1/4] invokeLater used to allow explored context to be set up --- .../corecomponents/DataResultViewerTable.java | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java index c79c8e613c..d1b8a90f72 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java @@ -434,7 +434,7 @@ public class DataResultViewerTable extends AbstractDataResultViewer { } setColumnWidths(); - + /* * Load column sorting information from preferences file and apply it to * columns. @@ -468,11 +468,14 @@ public class DataResultViewerTable extends AbstractDataResultViewer { for (int i = 0; i < childNodes.length; ++i) { Node childNode = childNodes[i]; if (selectedChildInfo.matches(childNode)) { - try { - this.getExplorerManager().setSelectedNodes(new Node[]{childNode}); - } catch (PropertyVetoException ex) { - LOGGER.log(Level.SEVERE, "Failed to select node specified by selected child info", ex); - } + SwingUtilities.invokeLater(() -> { + try { + this.getExplorerManager().setExploredContextAndSelection(this.rootNode, new Node[]{childNode}); + } catch (PropertyVetoException ex) { + LOGGER.log(Level.SEVERE, "Failed to select node specified by selected child info", ex); + } + }); + break; } } @@ -516,7 +519,7 @@ public class DataResultViewerTable extends AbstractDataResultViewer { protected void setColumnWidths() { if (rootNode.getChildren().getNodesCount() != 0) { final Graphics graphics = outlineView.getGraphics(); - + if (graphics != null) { // Current width of the outlineView double outlineViewWidth = outlineView.getSize().getWidth(); @@ -526,10 +529,10 @@ public class DataResultViewerTable extends AbstractDataResultViewer { int margin = 4; int padding = 8; - + int totalColumnWidth = 0; - int cntMaxSizeColumns =0; - + int cntMaxSizeColumns = 0; + // Calulate the width for each column keeping track of the number // of columns that were set to columnwidthLimit. for (int column = 0; column < outline.getModel().getColumnCount(); column++) { @@ -552,40 +555,40 @@ public class DataResultViewerTable extends AbstractDataResultViewer { columnWidth = Math.min(columnWidth, columnWidthLimit); columnWidths.add(columnWidth); - + totalColumnWidth += columnWidth; - - if( columnWidth == columnWidthLimit) { + + if (columnWidth == columnWidthLimit) { cntMaxSizeColumns++; } } - + // Figure out how much extra, if any can be given to the columns // so that the table is as wide as outlineViewWidth. If cntMaxSizeColumns // is greater than 0 divide the extra space between the columns // that could use more space. Otherwise divide evenly amoung // all columns. int extraWidth = 0; - + if (totalColumnWidth < outlineViewWidth) { - if (cntMaxSizeColumns > 0) { - extraWidth = (int) ((outlineViewWidth - totalColumnWidth)/cntMaxSizeColumns); + if (cntMaxSizeColumns > 0) { + extraWidth = (int) ((outlineViewWidth - totalColumnWidth) / cntMaxSizeColumns); } else { - extraWidth = (int) ((outlineViewWidth - totalColumnWidth)/columnWidths.size()); + extraWidth = (int) ((outlineViewWidth - totalColumnWidth) / columnWidths.size()); } } - - for(int column = 0; column < columnWidths.size(); column++) { + + for (int column = 0; column < columnWidths.size(); column++) { int columnWidth = columnWidths.get(column); - - if(cntMaxSizeColumns > 0) { - if(columnWidth >= ((column == 0) ? 350 : 300)) { + + if (cntMaxSizeColumns > 0) { + if (columnWidth >= ((column == 0) ? 350 : 300)) { columnWidth += extraWidth; } } else { columnWidth += extraWidth; } - + outline.getColumnModel().getColumn(column).setPreferredWidth(columnWidth); } } From 7a2cb82b1a52c65c804008dc86ebb5fb9c0f18b1 Mon Sep 17 00:00:00 2001 From: Greg DiCristofaro Date: Tue, 24 Nov 2020 11:08:57 -0500 Subject: [PATCH 2/4] remove outer invokeLater --- .../corecomponents/DataResultViewerTable.java | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java index d1b8a90f72..48e7427172 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java @@ -460,29 +460,27 @@ public class DataResultViewerTable extends AbstractDataResultViewer { * If one of the child nodes of the root node is to be selected, select * it. */ - SwingUtilities.invokeLater(() -> { - if (rootNode instanceof TableFilterNode) { - NodeSelectionInfo selectedChildInfo = ((TableFilterNode) rootNode).getChildNodeSelectionInfo(); - if (null != selectedChildInfo) { - Node[] childNodes = rootNode.getChildren().getNodes(true); - for (int i = 0; i < childNodes.length; ++i) { - Node childNode = childNodes[i]; - if (selectedChildInfo.matches(childNode)) { - SwingUtilities.invokeLater(() -> { - try { - this.getExplorerManager().setExploredContextAndSelection(this.rootNode, new Node[]{childNode}); - } catch (PropertyVetoException ex) { - LOGGER.log(Level.SEVERE, "Failed to select node specified by selected child info", ex); - } - }); + if (rootNode instanceof TableFilterNode) { + NodeSelectionInfo selectedChildInfo = ((TableFilterNode) rootNode).getChildNodeSelectionInfo(); + if (null != selectedChildInfo) { + Node[] childNodes = rootNode.getChildren().getNodes(true); + for (int i = 0; i < childNodes.length; ++i) { + Node childNode = childNodes[i]; + if (selectedChildInfo.matches(childNode)) { + SwingUtilities.invokeLater(() -> { + try { + this.getExplorerManager().setExploredContextAndSelection(this.rootNode, new Node[]{childNode}); + } catch (PropertyVetoException ex) { + LOGGER.log(Level.SEVERE, "Failed to select node specified by selected child info", ex); + } + }); - break; - } + break; } - ((TableFilterNode) rootNode).setChildNodeSelectionInfo(null); } + ((TableFilterNode) rootNode).setChildNodeSelectionInfo(null); } - }); + } /* * The table setup is done, so any added/removed events can now be From ab65734000f89f5bc790188d326286cbfbff9d46 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Tue, 24 Nov 2020 14:40:16 -0500 Subject: [PATCH 3/4] Changed cr notable items flag --- .../centralrepository/ingestmodule/CentralRepoIngestModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/CentralRepoIngestModule.java b/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/CentralRepoIngestModule.java index a7c3bd41e0..210e361261 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/CentralRepoIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/CentralRepoIngestModule.java @@ -67,7 +67,7 @@ final class CentralRepoIngestModule implements FileIngestModule { private static final String MODULE_NAME = CentralRepoIngestModuleFactory.getModuleName(); - static final boolean DEFAULT_FLAG_TAGGED_NOTABLE_ITEMS = true; + static final boolean DEFAULT_FLAG_TAGGED_NOTABLE_ITEMS = false; static final boolean DEFAULT_FLAG_PREVIOUS_DEVICES = false; static final boolean DEFAULT_CREATE_CR_PROPERTIES = true; From 5636ca570d433ba8f2866d1e8fa75c63a6edd1c7 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Tue, 24 Nov 2020 15:44:49 -0500 Subject: [PATCH 4/4] Changed the locking in connect() to also protect the getConnection() call --- .../datamodel/PostgresCentralRepo.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepo.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepo.java index f1afb941bc..e72bfa9359 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepo.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepo.java @@ -198,11 +198,11 @@ final class PostgresCentralRepo extends RdbmsCentralRepo { if (connectionPool == null) { setupConnectionPool(); } - } - try { - return connectionPool.getConnection(); - } catch (SQLException ex) { - throw new CentralRepoException("Error getting connection from connection pool.", Bundle.PostgresEamDb_connectionFailed_message(), ex); // NON-NLS + try { + return connectionPool.getConnection(); + } catch (SQLException ex) { + throw new CentralRepoException("Error getting connection from connection pool.", Bundle.PostgresEamDb_connectionFailed_message(), ex); // NON-NLS + } } }