TEZ-2749. TaskInfo in history parser should not depend on the apache
directory project. Fix master build against hadoop-2.4. (sseth)
diff --git a/CHANGES.txt b/CHANGES.txt
index f91df1b..0c15c1f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -17,6 +17,7 @@
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.
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.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 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 @@
* @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 @@
sb.append("]");
return sb.toString();
}
+
+ private static boolean isNotNullOrEmpty(String str) {
+ return str != null && !str.isEmpty();
+ }
}