You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Erick Erickson (Jira)" <ji...@apache.org> on 2020/09/10 20:44:00 UTC

[jira] [Created] (SOLR-14852) SolrZkResourceLoader.openResource should not throw an NPE for empty znodes

Erick Erickson created SOLR-14852:
-------------------------------------

             Summary: SolrZkResourceLoader.openResource should not throw an NPE for empty znodes
                 Key: SOLR-14852
                 URL: https://issues.apache.org/jira/browse/SOLR-14852
             Project: Solr
          Issue Type: Improvement
      Security Level: Public (Default Security Level. Issues are Public)
            Reporter: Erick Erickson


I'm looking at why TestBulkSchemaConcurrent fails so often lately and ran across this.

SolrZkResourceLoader.openResource has this code:
{code:java}
      try {
        if (zkController.pathExists(file)) {
          Stat stat = new Stat();
          byte[] bytes = zkController.getZkClient().getData(file, null, stat, true);
          return new ZkByteArrayInputStream(bytes, stat);    
{code}
new ZkByteArrayInputStream eventually winds up at:
{code:java}
    public ByteArrayInputStream(byte buf[]) {
        this.buf = buf;
        this.pos = 0;
        this.count = buf.length; // throws an NPE
    }
{code}
I don't think this is the root cause of the test failure at all since this is caught like this:
{code:java}
  protected NamedList loadConfigSetFlags(CoreDescriptor cd, SolrResourceLoader loader) {
    try {
      return ConfigSetProperties.readFromResourceLoader(loader, ".");
    } catch (Exception ex) {
      log.debug("No configSet flags", ex);
      return null;
    }
  }
{code}
That said, it seems wrong to count on an obscure constructor to generate an NPE, then catch all exceptions and return null...



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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