You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by GitBox <gi...@apache.org> on 2019/07/26 11:30:36 UTC

[GitHub] [lucene-solr] atris commented on a change in pull request #769: LUCENE-8905: Better Error Handling For Illegal Arguments

atris commented on a change in pull request #769: LUCENE-8905: Better Error Handling For Illegal Arguments
URL: https://github.com/apache/lucene-solr/pull/769#discussion_r307702699
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/search/TopDocsCollector.java
 ##########
 @@ -136,14 +136,21 @@ public TopDocs topDocs(int start, int howMany) {
     // pq.size() or totalHits.
     int size = topDocsSize();
 
-    // Don't bother to throw an exception, just return an empty TopDocs in case
-    // the parameters are invalid or out of range.
-    // TODO: shouldn't we throw IAE if apps give bad params here so they dont
-    // have sneaky silent bugs?
-    if (start < 0 || start >= size || howMany <= 0) {
+
+    if (start < 0 || start > size) {
 
 Review comment:
   @jpountz That can allow potential abuse by passing in Integer.MAX_VALUE for numHits, and a value of start > size. With this check gone, we would not be able to detect the case.
   
   Should we keep the existing one and add the one you proposed?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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