Skip to content

Commit

Permalink
Prevent IllegalArgumentException if no pending node acquires
Browse files Browse the repository at this point in the history
We could get java.lang.IllegalArgumentException: bound must be positive
when pendingAcquires was empty
  • Loading branch information
losipiuk committed Nov 8, 2024
1 parent 1410f56 commit 57e4c7f
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
Expand Down Expand Up @@ -351,6 +352,10 @@ private Iterator<PendingAcquire> pendingAcquiresIterator(Optional<QueryId> start
.map(entry -> new QueryPendingAcquires(entry.getKey(), entry.getValue().iterator()))
.collect(toCollection(ArrayList::new));

if (iterators.isEmpty()) {
return ImmutableList.<PendingAcquire>of().iterator();
}

int startingIteratorIndex = 0;
if (startingQueryId.isPresent()) {
startingIteratorIndex = -1;
Expand Down

0 comments on commit 57e4c7f

Please sign in to comment.