vsop-479 commented on PR #15823:
URL: https://github.com/apache/lucene/pull/15823#issuecomment-4141188984

   > To prevent an ArrayIndexOutOfBounds we could also apply a 
.limit(remaining) to the stream
   
   > Alternatively maybe add a test for the new method to verify heap keeps 
intact when adding too many elements.
   
   Current implementation will throw an `ArrayIndexOutOfBoundsException` when 
elements's size exceeds, and tested by 
`TestPriorityQueue#testAddAllWithStreamNotFitIntoQueue`.
   
   > Maybe add a try/catch around the stream consumer to transform the 
exception to something more meaningful with a good error message.
   
   The original error message is `Index $maxsize out of bounds for length 
$maxsize`. 
   Since we can't get size from stream (right?), how about `no remaining 
capacity, but $(maxSize - size) elements were added into the queue`?


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to