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

This commit is contained in:
Wang Qing authored and Hao Chen committed 2018-12-26 11:29:29 +08:00
1 parent f4011754d6
commit a971b73bbe
2 files changed
+20

No files matched your search

@@ -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());