lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Miller <markrmil...@gmail.com>
Subject Funny Null checking in ReplicationHandler
Date Sun, 25 Oct 2009 12:28:16 GMT

        RefCounted<SolrIndexSearcher> s = core.getNewestSearcher(false);
        try {
          IndexReader reader = s==null ? null : s.get().getReader();
          if (reader!=null && reader.getIndexCommit() != null &&
reader.getIndexCommit().getGeneration() != 1L) {

If getNewestSearcher(false) happens to return null, we are in for a
nasty surprise when it next trys to decref the null Searcher:

  } catch (IOException e) {
          LOG.warn("Unable to get IndexCommit on startup", e);
  } finally {
          s.decref();
  }

Some internal disagreement in that code...

-- 
- Mark

http://www.lucidimagination.com




Mime
View raw message