diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerAppsBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerAppsBlock.java
index f6202cbcc5..c74e2ae3e1 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerAppsBlock.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerAppsBlock.java
@@ -129,6 +129,12 @@ protected Boolean hasAccess(RMApp app, HttpServletRequest hsr) {
return true;
}
+ private static String printAppInfo(long value) {
+ if (value == -1) {
+ return "N/A";
+ }
+ return String.valueOf(value);
+ }
@Override public void render(Block html) {
TBODY
> tbody = html.
@@ -193,16 +199,16 @@ protected Boolean hasAccess(RMApp app, HttpServletRequest hsr) {
.append(appInfo.getFinishTime()).append("\",\"")
.append(appInfo.getState()).append("\",\"")
.append(appInfo.getFinalStatus()).append("\",\"")
- .append(appInfo.getRunningContainers() == -1 ? "N/A" : String
- .valueOf(appInfo.getRunningContainers())).append("\",\"")
- .append(appInfo.getAllocatedVCores() == -1 ? "N/A" : String
- .valueOf(appInfo.getAllocatedVCores())).append("\",\"")
- .append(appInfo.getAllocatedMB() == -1 ? "N/A" : String
- .valueOf(appInfo.getAllocatedMB())).append("\",\"")
- .append(appInfo.getReservedVCores() == -1 ? "N/A" : String
- .valueOf(appInfo.getReservedVCores())).append("\",\"")
- .append(appInfo.getReservedMB() == -1 ? "N/A" : String
- .valueOf(appInfo.getReservedMB())).append("\",\"")
+ .append(printAppInfo(appInfo.getRunningContainers()))
+ .append("\",\"")
+ .append(printAppInfo(appInfo.getAllocatedVCores()))
+ .append("\",\"")
+ .append(printAppInfo(appInfo.getAllocatedMB()))
+ .append("\",\"")
+ .append(printAppInfo(appInfo.getReservedVCores()))
+ .append("\",\"")
+ .append(printAppInfo(appInfo.getReservedMB()))
+ .append("\",\"")
// Progress bar
.append("