Apache Solr open-source search software
improved exception messages in IndexSearcher
Simon Willnauer0169bc707ded
diff --git a/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java b/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.javaindex bf0f3dabeb9..80af68472b9 100644--- a/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java+++ b/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java@@ -501,7 +501,7 @@ public class IndexSearcher {boolean doDocScores, boolean doMaxScore)throws IOException {- if (sort == null) throw new NullPointerException();+ if (sort == null) throw new NullPointerException("Sort must not be null");if (executor == null) {// use all leaves here!@@ -749,7 +749,7 @@ public class IndexSearcher {@Overridepublic int advance(int target) {- throw new UnsupportedOperationException();+ throw new UnsupportedOperationException("FakeScorer doesn't support advance(int)");}@Override@@ -759,12 +759,12 @@ public class IndexSearcher {@Overridepublic int freq() {- throw new UnsupportedOperationException();+ throw new UnsupportedOperationException("FakeScorer doesn't support freq()");}@Overridepublic int nextDoc() {- throw new UnsupportedOperationException();+ throw new UnsupportedOperationException("FakeScorer doesn't support nextDoc()");}@Override@@ -827,8 +827,8 @@ public class IndexSearcher {}public T next() {- if(!this.hasNext())- throw new NoSuchElementException();+ if(!this.hasNext())+ throw new NoSuchElementException("next() is called but hasNext() returned false");try {return service.take().get();} catch (InterruptedException e) {