mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 02:07:42 +00:00
Bug fix
This commit is contained in:
parent
fd19c4f712
commit
18b301394a
@ -44,30 +44,37 @@ class IndexUpgrader {
|
||||
JAVA_PATH = PlatformUtil.getJavaPath();
|
||||
}
|
||||
|
||||
void performIndexUpgrade(String newIndexDir, Index indexToUpgrade, String tempResultsDir) throws AutopsyService.AutopsyServiceException {
|
||||
Index performIndexUpgrade(String newIndexDir, Index indexToUpgrade, String tempResultsDir) throws AutopsyService.AutopsyServiceException {
|
||||
// ELTODO Check for cancellation at whatever points are feasible
|
||||
|
||||
// Run the upgrade tools on the contents (core) in ModuleOutput/keywordsearch/data/solrX_schema_Y/index
|
||||
File tmpDir = Paths.get(tempResultsDir, "IndexUpgrade").toFile(); //NON-NLS
|
||||
tmpDir.mkdirs();
|
||||
|
||||
Index upgradedIndex;
|
||||
double currentSolrVersion = NumberUtils.toDouble(indexToUpgrade.getSolrVersion());
|
||||
try {
|
||||
// upgrade from Solr 4 to 5
|
||||
currentSolrVersion = upgradeSolrIndexVersion4to5(currentSolrVersion, newIndexDir, tempResultsDir);
|
||||
// upgrade from Solr 5 to 6
|
||||
currentSolrVersion = upgradeSolrIndexVersion5to6(currentSolrVersion, newIndexDir, tempResultsDir);
|
||||
|
||||
// create upgraded index object
|
||||
upgradedIndex = new Index(newIndexDir, Double.toString(currentSolrVersion), indexToUpgrade.getSchemaVersion());
|
||||
upgradedIndex.setNewIndex(true);
|
||||
} catch (Exception ex) {
|
||||
// catch-all firewall for exceptions thrown by Solr upgrade tools
|
||||
throw new AutopsyService.AutopsyServiceException("Exception while running Solr index upgrade in " + newIndexDir, ex); //NON-NLS
|
||||
} finally {
|
||||
if (currentSolrVersion != NumberUtils.toDouble(IndexFinder.getCurrentSolrVersion())) {
|
||||
// upgrade did not complete, delete the new index directories
|
||||
upgradedIndex = null;
|
||||
if (!new File(newIndexDir).delete()) {
|
||||
logger.log(Level.SEVERE, "Unable to delete folder {0}", newIndexDir); //NON-NLS
|
||||
}
|
||||
}
|
||||
}
|
||||
return upgradedIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -216,11 +216,10 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService
|
||||
|
||||
// upgrade the existing index to the latest supported Solr version
|
||||
IndexUpgrader indexUpgrader = new IndexUpgrader();
|
||||
indexUpgrader.performIndexUpgrade(newIndexDir, indexToUpgrade, context.getCase().getTempDirectory());
|
||||
|
||||
// set the upgraded index as the index to be used for this case
|
||||
currentVersionIndex = new Index(newIndexDir, IndexFinder.getCurrentSolrVersion(), indexToUpgrade.getSchemaVersion());
|
||||
currentVersionIndex.setNewIndex(true);
|
||||
currentVersionIndex = indexUpgrader.performIndexUpgrade(newIndexDir, indexToUpgrade, context.getCase().getTempDirectory());
|
||||
if (currentVersionIndex == null) {
|
||||
throw new AutopsyServiceException("Unable to upgrade index to the latest version of Solr");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user