You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Furkan KAMACI (JIRA)" <ji...@apache.org> on 2015/05/19 19:56:00 UTC
[jira] [Commented] (SOLR-5841) getSolrConfigFromZk May Not Work As
Intended also May Produce a Null Pointer Exception
[ https://issues.apache.org/jira/browse/SOLR-5841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14550880#comment-14550880 ]
Furkan KAMACI commented on SOLR-5841:
-------------------------------------
[~thetaphi] could you check my patch?
> 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.9, Trunk
>
> Attachments: SOLR-5841.patch
>
>
> 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.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org