diff --git a/solr/core/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java b/solr/core/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java index 57692e845c0..21de0db6009 100644 --- a/solr/core/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java +++ b/solr/core/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java @@ -237,7 +237,9 @@ public final class IndexDeletionPolicyWrapper extends IndexDeletionPolicy { map.put(wrapper.delegate.getGeneration(), wrapper.delegate); } solrVersionVsCommits = map; - latestCommit = ((list.get(list.size() - 1)).delegate); + if (!list.isEmpty()) { + latestCommit = ((list.get(list.size() - 1)).delegate); + } } public static long getCommitTimestamp(IndexCommit commit) throws IOException { diff --git a/solr/core/src/java/org/apache/solr/core/SolrDeletionPolicy.java b/solr/core/src/java/org/apache/solr/core/SolrDeletionPolicy.java index bdfc8f3950e..3702d4b9b00 100644 --- a/solr/core/src/java/org/apache/solr/core/SolrDeletionPolicy.java +++ b/solr/core/src/java/org/apache/solr/core/SolrDeletionPolicy.java @@ -79,6 +79,9 @@ public class SolrDeletionPolicy extends IndexDeletionPolicy implements NamedList @Override public void onInit(List commits) throws IOException { // SOLR-4547: log basic data at INFO, add filenames at DEBUG. + if (commits.isEmpty()) { + return; + } log.info("SolrDeletionPolicy.onInit: commits: {}", new CommitsLoggingInfo(commits)); log.debug("SolrDeletionPolicy.onInit: commits: {}",