Furkan KAMACI created SOLR-5841:
-----------------------------------
Summary: getSolrConfigFromZk May Not Work As Intended also May
Produce a Null Pointer Exception
Key: SOLR-5841
URL: https://issues.apache.org/jira/browse/SOLR-5841
Project: Solr
Issue Type: Bug
Affects Versions: 4.6.1, 4.7
Reporter: Furkan KAMACI
Fix For: 4.8
getSolrConfigFromZk method at ZkContainer is as follows:
{code}
public SolrConfig getSolrConfigFromZk(String zkConfigName, String
solrConfigFileName,
SolrResourceLoader resourceLoader) {
SolrConfig cfg = null;
try {
byte[] config = zkController.getConfigFileData(zkConfigName,
solrConfigFileName);
InputSource is = new InputSource(new ByteArrayInputStream(config));
is.setSystemId(SystemIdResolver
.createSystemIdFromResourceName(solrConfigFileName));
cfg = solrConfigFileName == null ? new SolrConfig(resourceLoader,
SolrConfig.DEFAULT_CONF_FILE, is) : new SolrConfig(resourceLoader,
solrConfigFileName, is);
} catch (Exception e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"getSolrConfigFromZK failed for " + zkConfigName + " "
+ solrConfigFileName, e);
}
return cfg;
}
{code}
createSystemIdFromResourceName method has that line:
{code}
name = name.replace(File.separatorChar, '/');
{code}
and there is a check condition for solrConfigFileName getSolrConfigFromZk so
createSystemIdFromResourceName may throw a null pointer exception. On the other
hand if solrConfigFileName is null this line will not work as expected:
{code}
byte[] config = zkController.getConfigFileData(zkConfigName,
solrConfigFileName);
{code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]