mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Bug fix
This commit is contained in:
parent
fd19c4f712
commit
18b301394a
@ -44,30 +44,37 @@ class IndexUpgrader {
|
|||||||
JAVA_PATH = PlatformUtil.getJavaPath();
|
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
|
// 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
|
// 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
|
File tmpDir = Paths.get(tempResultsDir, "IndexUpgrade").toFile(); //NON-NLS
|
||||||
tmpDir.mkdirs();
|
tmpDir.mkdirs();
|
||||||
|
|
||||||
|
Index upgradedIndex;
|
||||||
double currentSolrVersion = NumberUtils.toDouble(indexToUpgrade.getSolrVersion());
|
double currentSolrVersion = NumberUtils.toDouble(indexToUpgrade.getSolrVersion());
|
||||||
try {
|
try {
|
||||||
// upgrade from Solr 4 to 5
|
// upgrade from Solr 4 to 5
|
||||||
currentSolrVersion = upgradeSolrIndexVersion4to5(currentSolrVersion, newIndexDir, tempResultsDir);
|
currentSolrVersion = upgradeSolrIndexVersion4to5(currentSolrVersion, newIndexDir, tempResultsDir);
|
||||||
// upgrade from Solr 5 to 6
|
// upgrade from Solr 5 to 6
|
||||||
currentSolrVersion = upgradeSolrIndexVersion5to6(currentSolrVersion, newIndexDir, tempResultsDir);
|
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 (Exception ex) {
|
||||||
// catch-all firewall for exceptions thrown by Solr upgrade tools
|
// 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
|
throw new AutopsyService.AutopsyServiceException("Exception while running Solr index upgrade in " + newIndexDir, ex); //NON-NLS
|
||||||
} finally {
|
} finally {
|
||||||
if (currentSolrVersion != NumberUtils.toDouble(IndexFinder.getCurrentSolrVersion())) {
|
if (currentSolrVersion != NumberUtils.toDouble(IndexFinder.getCurrentSolrVersion())) {
|
||||||
// upgrade did not complete, delete the new index directories
|
// upgrade did not complete, delete the new index directories
|
||||||
|
upgradedIndex = null;
|
||||||
if (!new File(newIndexDir).delete()) {
|
if (!new File(newIndexDir).delete()) {
|
||||||
logger.log(Level.SEVERE, "Unable to delete folder {0}", newIndexDir); //NON-NLS
|
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
|
// upgrade the existing index to the latest supported Solr version
|
||||||
IndexUpgrader indexUpgrader = new IndexUpgrader();
|
IndexUpgrader indexUpgrader = new IndexUpgrader();
|
||||||
indexUpgrader.performIndexUpgrade(newIndexDir, indexToUpgrade, context.getCase().getTempDirectory());
|
currentVersionIndex = indexUpgrader.performIndexUpgrade(newIndexDir, indexToUpgrade, context.getCase().getTempDirectory());
|
||||||
|
if (currentVersionIndex == null) {
|
||||||
// set the upgraded index as the index to be used for this case
|
throw new AutopsyServiceException("Unable to upgrade index to the latest version of Solr");
|
||||||
currentVersionIndex = new Index(newIndexDir, IndexFinder.getCurrentSolrVersion(), indexToUpgrade.getSchemaVersion());
|
}
|
||||||
currentVersionIndex.setNewIndex(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user