From 67817c4b98da915021db90ea55ddf73e7b28e731 Mon Sep 17 00:00:00 2001 From: Eugene Livis Date: Fri, 17 Jul 2020 16:56:06 -0400 Subject: [PATCH] Bug fix for SU mode --- .../autopsy/keywordsearch/Server.java | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Server.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Server.java index 2c6724847e..925be227cd 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Server.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Server.java @@ -1062,23 +1062,25 @@ public class Server { } } } else { - // In single user mode, the index is stored in case output directory - File dataDir = new File(new File(index.getIndexPath()).getParent()); // "data dir" is the parent of the index directory - if (!dataDir.exists()) { - dataDir.mkdirs(); - } + if (!coreIsLoaded(collectionName)) { + // In single user mode, the index is stored in case output directory + File dataDir = new File(new File(index.getIndexPath()).getParent()); // "data dir" is the parent of the index directory + if (!dataDir.exists()) { + dataDir.mkdirs(); + } - // for single user cases, we unload the core when we close the case. So we have to load the core again. - CoreAdminRequest.Create createCoreRequest = new CoreAdminRequest.Create(); - createCoreRequest.setDataDir(dataDir.getAbsolutePath()); - createCoreRequest.setCoreName(collectionName); - createCoreRequest.setConfigSet("AutopsyConfig"); //NON-NLS - createCoreRequest.setIsLoadOnStartup(false); - createCoreRequest.setIsTransient(true); - localSolrServer.request(createCoreRequest); + // for single user cases, we unload the core when we close the case. So we have to load the core again. + CoreAdminRequest.Create createCoreRequest = new CoreAdminRequest.Create(); + createCoreRequest.setDataDir(dataDir.getAbsolutePath()); + createCoreRequest.setCoreName(collectionName); + createCoreRequest.setConfigSet("AutopsyConfig"); //NON-NLS + createCoreRequest.setIsLoadOnStartup(false); + createCoreRequest.setIsTransient(true); + localSolrServer.request(createCoreRequest); - if (!coreIndexFolderExists(collectionName)) { - throw new KeywordSearchModuleException(NbBundle.getMessage(this.getClass(), "Server.openCore.exception.noIndexDir.msg")); + if (!coreIndexFolderExists(collectionName)) { + throw new KeywordSearchModuleException(NbBundle.getMessage(this.getClass(), "Server.openCore.exception.noIndexDir.msg")); + } } }