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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to