TEZ-2749. TaskInfo in history parser should not depend on the apache directory project. Fix master build against hadoop-2.4. (sseth)
Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/6098f1bb Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/6098f1bb Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/6098f1bb Branch: refs/heads/master Commit: 6098f1bb9cb8b03a0340ec6edc244a1f1e022440 Parents: de751ec Author: Siddharth Seth <[email protected]> Authored: Wed Aug 26 15:45:28 2015 -0700 Committer: Siddharth Seth <[email protected]> Committed: Wed Aug 26 15:45:28 2015 -0700 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../org/apache/tez/history/parser/datamodel/TaskInfo.java | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tez/blob/6098f1bb/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index f91df1b..0c15c1f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -17,6 +17,7 @@ INCOMPATIBLE CHANGES TEZ-2468. Change the minimum Java version to Java 7. ALL CHANGES: + TEZ-2749. TaskInfo in history parser should not depend on the apache directory project. Fix master build against hadoop-2.4 TEZ-2748. Fix master build against hadoop-2.2. TEZ-2743. Fix TezContainerLauncher logging tokens. TEZ-2708. Rename classes and variables post TEZ-2003 changes. http://git-wip-us.apache.org/repos/asf/tez/blob/6098f1bb/tez-plugins/tez-history-parser/src/main/java/org/apache/tez/history/parser/datamodel/TaskInfo.java ---------------------------------------------------------------------- diff --git a/tez-plugins/tez-history-parser/src/main/java/org/apache/tez/history/parser/datamodel/TaskInfo.java b/tez-plugins/tez-history-parser/src/main/java/org/apache/tez/history/parser/datamodel/TaskInfo.java index a30d311..7a89166 100644 --- a/tez-plugins/tez-history-parser/src/main/java/org/apache/tez/history/parser/datamodel/TaskInfo.java +++ b/tez-plugins/tez-history-parser/src/main/java/org/apache/tez/history/parser/datamodel/TaskInfo.java @@ -28,7 +28,6 @@ import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; import com.google.common.collect.Ordering; -import org.apache.directory.api.util.Strings; import org.apache.hadoop.util.StringInterner; import org.apache.tez.dag.api.oldrecords.TaskAttemptState; import org.codehaus.jettison.json.JSONException; @@ -177,7 +176,8 @@ public class TaskInfo extends BaseInfo { public final List<TaskAttemptInfo> getTaskAttempts(final TaskAttemptState state) { return Collections.unmodifiableList(Lists.newLinkedList(Iterables.filter(Lists.newLinkedList (attemptInfoMap.values()), new Predicate<TaskAttemptInfo>() { - @Override public boolean apply(TaskAttemptInfo input) { + @Override + public boolean apply(TaskAttemptInfo input) { return input.getStatus() != null && input.getStatus().equals(state.toString()); } } @@ -205,7 +205,7 @@ public class TaskInfo extends BaseInfo { * @return TaskAttemptInfo */ public final TaskAttemptInfo getSuccessfulTaskAttempt() { - if (Strings.isNotEmpty(getSuccessfulAttemptId())) { + if (isNotNullOrEmpty(getSuccessfulAttemptId())) { for (TaskAttemptInfo attemptInfo : getTaskAttempts()) { if (attemptInfo.getTaskAttemptId().equals(getSuccessfulAttemptId())) { return attemptInfo; @@ -350,4 +350,8 @@ public class TaskInfo extends BaseInfo { sb.append("]"); return sb.toString(); } + + private static boolean isNotNullOrEmpty(String str) { + return str != null && !str.isEmpty(); + } }
