YARN-4729. SchedulerApplicationAttempt#getTotalRequiredResources can throw an NPE. (kasha)

This commit is contained in:
Karthik Kambatla 2016-02-24 18:33:57 -08:00
parent dbbfc58c33
commit c684f2b007
2 changed files with 5 additions and 1 deletions

View File

@ -227,6 +227,9 @@ Release 2.9.0 - UNRELEASED
YARN-4651. Document movetoqueue option in 'YARN Commands' YARN-4651. Document movetoqueue option in 'YARN Commands'
(Takashi Ohnishi via rohithsharmaks) (Takashi Ohnishi via rohithsharmaks)
YARN-4729. SchedulerApplicationAttempt#getTotalRequiredResources can throw
an NPE. (kasha)
Release 2.8.0 - UNRELEASED Release 2.8.0 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -244,7 +244,8 @@ public synchronized ResourceRequest getResourceRequest(Priority priority,
} }
public synchronized int getTotalRequiredResources(Priority priority) { public synchronized int getTotalRequiredResources(Priority priority) {
return getResourceRequest(priority, ResourceRequest.ANY).getNumContainers(); ResourceRequest request = getResourceRequest(priority, ResourceRequest.ANY);
return request == null ? 0 : request.getNumContainers();
} }
public synchronized Resource getResource(Priority priority) { public synchronized Resource getResource(Priority priority) {