From 7ca7fdadc491290abb0949dbb56cba8e66de9862 Mon Sep 17 00:00:00 2001 From: Arun Murthy Date: Wed, 19 Oct 2011 22:38:17 +0000 Subject: [PATCH] MAPREDUCE-3208. Fix NPE task/container log appenders. Contributed by liangzhwa. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1186542 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../main/java/org/apache/hadoop/mapred/TaskLogAppender.java | 4 +++- .../java/org/apache/hadoop/yarn/ContainerLogAppender.java | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 22917ec8c83..cf1c7d1696a 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -1697,6 +1697,9 @@ Release 0.23.0 - Unreleased MAPREDUCE-2693. Fix NPE in job-blacklisting. (Hitesh Shah via acmurthy) + MAPREDUCE-3208. Fix NPE task/container log appenders. (liangzhwa via + acmurthy) + Release 0.22.0 - Unreleased INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLogAppender.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLogAppender.java index d60b64a4097..0b79837f62d 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLogAppender.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLogAppender.java @@ -93,7 +93,9 @@ public class TaskLogAppender extends FileAppender { } public void flush() { - qw.flush(); + if (qw != null) { + qw.flush(); + } } @Override diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ContainerLogAppender.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ContainerLogAppender.java index ac4a61f934f..7f09c175b6b 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ContainerLogAppender.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ContainerLogAppender.java @@ -65,7 +65,9 @@ public class ContainerLogAppender extends FileAppender { } public void flush() { - qw.flush(); + if (qw != null) { + qw.flush(); + } } @Override