You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Cassandra Targett (JIRA)" <ji...@apache.org> on 2018/01/11 19:40:00 UTC

[jira] [Closed] (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:all-tabpanel ]

Cassandra Targett closed SOLR-5841.
-----------------------------------

> 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
>         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.4.14#64029)

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