GitHub user yew1eb opened a pull request:
https://github.com/apache/flink/pull/4753
[FLINK-7741][build] Fix NPE when throw new SlotNotFoundException
if taskSlot is null then **throw new
SlotNotFoundException(taskSlot.getAllocationId());** will have NPE.
the code segment in
**org.apache.flink.runtime.taskexecutor.slot.TaskSlotTable** classï¼
```
public boolean addTask(Task task) throws SlotNotFoundException,
SlotNotActiveException {
Preconditions.checkNotNull(task);
TaskSlot taskSlot = getTaskSlot(task.getAllocationId());
if (taskSlot != null) {
if (taskSlot.isActive(task.getJobID(),
task.getAllocationId())) {
if (taskSlot.add(task)) {
taskSlotMappings.put(task.getExecutionId(), new TaskSlotMapping(task,
taskSlot));
return true;
} else {
return false;
}
} else {
throw new
SlotNotActiveException(task.getJobID(), task.getAllocationId());
}
} else {
throw new
SlotNotFoundException(taskSlot.getAllocationId());
}
}
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/yew1eb/flink FLINK-7741
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/4753.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #4753
----
commit 3c0da5b5ab1855c97b4663f86a173d820f85959f
Author: yew1eb <[email protected]>
Date: 2017-09-30T06:18:14Z
Fix NPE when throw new SlotNotFoundException
----
---