I just committed a fix 5 minutes ago :)

Sorry my bad.

On Thu, Dec 18, 2008 at 11:35 PM, Ryan McKinley <[email protected]> wrote:

> I'm messing with the tests for SOLR-680.  For some reason, the test for
> ChacheHeaderTest and NoCacheHeaderTest fail.
>
> When I dig into it, it looks like it fails because the DirectoryFactory
> returns null.  If I add some code to make sure the directory is not null,
> then everything works fine.
>
> Obviously it works somehow, because the tests work.  But I don't understand
> it and am not sure why we keep using the deprecated calls:
>
> SolrCore#initIndex()
> {
>  if(  index exist ) {
>    directory = SolrIndexWriter.getDirectory(getIndexDir(),...
>  }
>  stuff
>
>  THEN:
>  initDirectoryFactory();
> }
>
> 1. Why are we using the deprecated calls?
> 2. Why isn't the directory factory initialized first?
>
>
> Here is where things fail:
>        at org.apache.solr.core.SolrCore.initIndex(SolrCore.java:363)
>        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:527)
>        at
> org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:120)
>        at
> org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:69)
>
>
> Index: src/java/org/apache/solr/core/SolrCore.java
> ===================================================================
> --- src/java/org/apache/solr/core/SolrCore.java (revision 727778)
> +++ src/java/org/apache/solr/core/SolrCore.java (working copy)
> @@ -358,9 +358,17 @@
>       boolean firstTime = dirs.add(dirFile.getCanonicalPath());
>       boolean removeLocks = solrConfig.getBool("mainIndex/unlockOnStartup",
> false);
>       if (indexExists && firstTime && removeLocks) {
> +        DirectoryFactory f = getDirectoryFactory();
> +        if( f == null ) {
> +          Throwable t = new Throwable();
> +          t.printStackTrace();
> +
> +          initDirectoryFactory();
> +          f = getDirectoryFactory();
> +        }
>         // to remove locks, the directory must already exist... so we
> create it
>         // if it didn't exist already...
> -        Directory dir = SolrIndexWriter.getDirectory(getIndexDir(),
> getDirectoryFactory(), solrConfig.mainIndexConfig);
> +        Directory dir = SolrIndexWriter.getDirectory(getIndexDir(), f,
> solrConfig.mainIndexConfig);
>         if (dir != null)  {
>           if (IndexWriter.isLocked(dir)) {
>             log.warn(logid+"WARNING: Solr index directory '" +
> getIndexDir() + "' is locked.  Unlocking...");
>
>


-- 
Regards,
Shalin Shekhar Mangar.

Reply via email to