SOLR-863 -- Fixing NPE. DirectoryFactory should be created before calling SolrIndexWriter.getDirectory.

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@727779 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2008-12-18 18:00:06 +00:00
parent 82279f712f
commit 328cacec62
1 changed files with 3 additions and 2 deletions

View File

@ -357,6 +357,9 @@ public final class SolrCore implements SolrInfoMBean {
boolean indexExists = dirFile.canRead(); boolean indexExists = dirFile.canRead();
boolean firstTime = dirs.add(dirFile.getCanonicalPath()); boolean firstTime = dirs.add(dirFile.getCanonicalPath());
boolean removeLocks = solrConfig.getBool("mainIndex/unlockOnStartup", false); boolean removeLocks = solrConfig.getBool("mainIndex/unlockOnStartup", false);
initDirectoryFactory();
if (indexExists && firstTime && removeLocks) { if (indexExists && firstTime && removeLocks) {
// to remove locks, the directory must already exist... so we create it // to remove locks, the directory must already exist... so we create it
// if it didn't exist already... // if it didn't exist already...
@ -378,8 +381,6 @@ public final class SolrCore implements SolrInfoMBean {
SolrIndexWriter writer = new SolrIndexWriter("SolrCore.initIndex",getIndexDir(), true, schema, solrConfig.mainIndexConfig); SolrIndexWriter writer = new SolrIndexWriter("SolrCore.initIndex",getIndexDir(), true, schema, solrConfig.mainIndexConfig);
writer.close(); writer.close();
} }
initDirectoryFactory();
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);