From 1b1ef37288d06ca2c7623d11e98bc8c44c07d236 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 12 Apr 2017 12:51:05 -0400 Subject: [PATCH] 2541 trim trailing and leading spaces from list names to avoid visual dupes --- .../keywordsearch/GlobalListSettingsPanel.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.java index cbe6bd54c4..d0fe1682c0 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.java @@ -114,11 +114,16 @@ final class GlobalListSettingsPanel extends javax.swing.JPanel implements Option null, null, currentKeywordList.getName()); - //if the name is null, empty, or unchanged return without changing anything - if (listName == null || listName.trim().equals("") || listName.equals(currentKeywordList.getName())) { + + if (listName == null ) { + return shouldAdd; + } + //remove trailing and leading spaces so lists can't have visually identical names + listName = listName.trim(); + //if the name is empty or unchanged return without changing anything + if (listName.equals("") || listName.equals(currentKeywordList.getName())) { return shouldAdd; } - XmlKeywordSearchList writer = XmlKeywordSearchList.getCurrent(); if (writer.listExists(listName) && writer.getList(listName).isEditable()) { KeywordSearchUtil.displayDialog(FEATURE_NAME, NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel1.customizeComponents.noOwDefaultMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);