[Java] Fix the issue when waiting an empty list or a null pointer (#3632)

This commit is contained in:
Wang Qing
2018-12-26 11:29:29 +08:00
committed by Hao Chen
parent f4011754d6
commit a971b73bbe
2 changed files with 20 additions and 0 deletions
@@ -50,6 +50,11 @@ public class RayletClientImpl implements RayletClient {
@Override
public <T> WaitResult<T> wait(List<RayObject<T>> waitFor, int numReturns, int
timeoutMs, UniqueId currentTaskId) {
Preconditions.checkNotNull(waitFor);
if (waitFor.isEmpty()) {
return new WaitResult<>(new ArrayList<>(), new ArrayList<>());
}
List<UniqueId> ids = new ArrayList<>();
for (RayObject<T> element : waitFor) {
ids.add(element.getId());