From 792388e1c0ebaeb01db194412e30c08c0144b77c Mon Sep 17 00:00:00 2001 From: Sunil G Date: Fri, 27 Oct 2017 20:53:57 +0530 Subject: [PATCH] YARN-7375. Possible NPE in RMWebapp when HA is enabled and the active RM fails. Contributed by Chandni Singh. --- .../yarn/server/resourcemanager/webapp/dao/AppInfo.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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/dao/AppInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/AppInfo.java index 40d7b4c003e..0711b457a5e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/AppInfo.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/AppInfo.java @@ -304,19 +304,19 @@ public class AppInfo { if (!deSelects.contains(DeSelectType.TIMEOUTS)) { Map applicationTimeouts = app.getApplicationTimeouts(); + timeouts = new AppTimeoutsInfo(); if (applicationTimeouts.isEmpty()) { // If application is not set timeout, lifetime should be sent // as default with expiryTime=UNLIMITED and remainingTime=-1 AppTimeoutInfo timeoutInfo = new AppTimeoutInfo(); timeoutInfo.setTimeoutType(ApplicationTimeoutType.LIFETIME); - timeouts = new AppTimeoutsInfo(); timeouts.add(timeoutInfo); } else { for (Map.Entry entry : app .getApplicationTimeouts().entrySet()) { AppTimeoutInfo timeout = new AppTimeoutInfo(); timeout.setTimeoutType(entry.getKey()); - long timeoutInMillis = entry.getValue().longValue(); + long timeoutInMillis = entry.getValue(); timeout.setExpiryTime(Times.formatISO8601(timeoutInMillis)); if (app.isAppInCompletedStates()) { timeout.setRemainingTime(0);