You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2012/11/02 22:21:35 UTC

svn commit: r1405171 - /lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java

Author: simonw
Date: Fri Nov  2 21:21:34 2012
New Revision: 1405171

URL: http://svn.apache.org/viewvc?rev=1405171&view=rev
Log:
improved exception messages in IndexSearcher

Modified:
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java?rev=1405171&r1=1405170&r2=1405171&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java Fri Nov  2 21:21:34 2012
@@ -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 {
     
       @Override
       public int advance(int target) {
-        throw new UnsupportedOperationException();
+        throw new UnsupportedOperationException("FakeScorer doesn't support advance(int)");
       }
 
       @Override
@@ -759,12 +759,12 @@ public class IndexSearcher {
 
       @Override
       public int freq() {
-        throw new UnsupportedOperationException();
+        throw new UnsupportedOperationException("FakeScorer doesn't support freq()");
       }
 
       @Override
       public 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) {