Skip to content

Commit

Permalink
YARN-1556. NPE getting application report with a null appId. Contribu…
Browse files Browse the repository at this point in the history
…ted by Weiwei Yang.
  • Loading branch information
JunpingDu committed Aug 28, 2015
1 parent e166c03 commit beb65c9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hadoop-yarn-project/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,15 @@ Release 2.8.0 - UNRELEASED
YARN-4026. Refactored ContainerAllocator to accept a list of priorites
rather than a single priority. (Wangda Tan via jianhe)

YARN-4031. Add JvmPauseMonitor to ApplicationHistoryServer and
WebAppProxyServer (djp via rkanter)
YARN-4031. Add JvmPauseMonitor to ApplicationHistoryServer and
WebAppProxyServer (djp via rkanter)

YARN-4057. If ContainersMonitor is not enabled, only print
related log info one time. (Jun Gong via zxu)

YARN-1556. NPE getting application report with a null appId. (Weiwei Yang via
junping_du)

OPTIMIZATIONS

YARN-3339. TestDockerContainerExecutor should pull a single image and not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ public GetNewApplicationResponse getNewApplication(
public GetApplicationReportResponse getApplicationReport(
GetApplicationReportRequest request) throws YarnException {
ApplicationId applicationId = request.getApplicationId();
if (applicationId == null) {
throw new ApplicationNotFoundException("Invalid application id: null");
}

UserGroupInformation callerUGI;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,18 @@ public void testGetApplicationReport() throws Exception {
report.getApplicationResourceUsageReport();
Assert.assertEquals(10, usageReport.getMemorySeconds());
Assert.assertEquals(3, usageReport.getVcoreSeconds());

// if application id is null
GetApplicationReportRequest invalidRequest = recordFactory
.newRecordInstance(GetApplicationReportRequest.class);
invalidRequest.setApplicationId(null);
try {
rmService.getApplicationReport(invalidRequest);
} catch (YarnException e) {
// rmService should return a ApplicationNotFoundException
// when a null application id is provided
Assert.assertTrue(e instanceof ApplicationNotFoundException);
}
} finally {
rmService.close();
}
Expand Down

0 comments on commit beb65c9

Please sign in to comment.