lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jamie Johnson (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (SOLR-3117) CoreDescriptor attempts to use the name before checking if it is null
Date Thu, 09 Feb 2012 16:07:59 GMT
CoreDescriptor attempts to use the name before checking if it is null
---------------------------------------------------------------------

                 Key: SOLR-3117
                 URL: https://issues.apache.org/jira/browse/SOLR-3117
             Project: Solr
          Issue Type: Improvement
          Components: SolrCloud
    Affects Versions: 4.0
            Reporter: Jamie Johnson
            Priority: Minor


in CoreDescriptor when creating the cloudDesc the name is accessed before checking if it is
null 

I believe it should be the following instead

{code}
  public CoreDescriptor(CoreContainer coreContainer, String name, String instanceDir) {
    this.coreContainer = coreContainer;
    this.name = name;
    
    if (name == null) {
        throw new RuntimeException("Core needs a name");
      }
    
    if(coreContainer != null && coreContainer.getZkController() != null) {
      this.cloudDesc = new CloudDescriptor();
      // cloud collection defaults to core name
      cloudDesc.setCollectionName(name.isEmpty() ? coreContainer.getDefaultCoreName() : name);
    }
    
    if (instanceDir == null) {
      throw new NullPointerException("Missing required \'instanceDir\'");
    }
    instanceDir = SolrResourceLoader.normalizeDir(instanceDir);
    this.instanceDir = instanceDir;
    this.configName = getDefaultConfigName();
    this.schemaName = getDefaultSchemaName();
  }
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message