mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix NullPointerException in IndexInfo unit tests
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12514 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -394,6 +394,16 @@ public class IndexInfo implements IndexMonitor
|
||||
this.mergerMaxMergeDocs = config.getMergerMaxMergeDocs();
|
||||
this.termIndexInterval = config.getTermIndexInterval();
|
||||
this.mergerTargetOverlays = config.getMergerTargetOverlayCount();
|
||||
// Work out the relative path of the index
|
||||
try
|
||||
{
|
||||
String indexRoot = new File(config.getIndexRootLocation()).getCanonicalPath();
|
||||
this.relativePath = this.indexDirectory.getCanonicalPath().substring(indexRoot.length() + 1);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Failed to determine index relative path", e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -403,6 +413,29 @@ public class IndexInfo implements IndexMonitor
|
||||
threadFactory.setThreadPriority(5);
|
||||
|
||||
threadPoolExecutor = new ThreadPoolExecutor(10, 10, 90, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), threadFactory, new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
|
||||
// Create a 'fake' relative path
|
||||
try
|
||||
{
|
||||
this.relativePath = this.indexDirectory.getCanonicalPath();
|
||||
int sepIndex = this.relativePath.indexOf(File.separator);
|
||||
if (sepIndex != -1)
|
||||
{
|
||||
if (this.relativePath.length() > sepIndex + 1)
|
||||
{
|
||||
this.relativePath = this.relativePath.substring(sepIndex + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.relativePath = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Failed to determine index relative path", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Create an empty in memory index
|
||||
@@ -439,17 +472,6 @@ public class IndexInfo implements IndexMonitor
|
||||
throw new AlfrescoRuntimeException("The index must be held in a directory");
|
||||
}
|
||||
|
||||
// Work out the relative path of the index
|
||||
try
|
||||
{
|
||||
String indexRoot = new File(config.getIndexRootLocation()).getCanonicalPath();
|
||||
this.relativePath = this.indexDirectory.getCanonicalPath().substring(indexRoot.length() + 1);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Failed to determine index relative path", e);
|
||||
}
|
||||
|
||||
// Create the info files.
|
||||
File indexInfoFile = new File(this.indexDirectory, INDEX_INFO);
|
||||
File indexInfoBackupFile = new File(this.indexDirectory, INDEX_INFO_BACKUP);
|
||||
|
Reference in New Issue
Block a user