tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeag...@apache.org
Subject git commit: TEZ-1463. Remove dependency on private class org.apache.hadoop.util.StringUtils (Alexander Pivovarov via jeagles)
Date Sat, 23 Aug 2014 02:48:58 GMT
Repository: tez
Updated Branches:
  refs/heads/master b00bde76c -> d489dcfc3


TEZ-1463. Remove dependency on private class org.apache.hadoop.util.StringUtils (Alexander
Pivovarov via jeagles)


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/d489dcfc
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/d489dcfc
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/d489dcfc

Branch: refs/heads/master
Commit: d489dcfc34454c4a487ce13a3c91140d712fdba1
Parents: b00bde7
Author: Jonathan Eagles <jeagles@gmail.com>
Authored: Fri Aug 22 21:48:50 2014 -0500
Committer: Jonathan Eagles <jeagles@gmail.com>
Committed: Fri Aug 22 21:48:50 2014 -0500

----------------------------------------------------------------------
 CHANGES.txt                                           |  7 +++++++
 .../java/org/apache/tez/common/TezCommonUtils.java    | 14 ++++++++++++++
 .../tez/common/security/ACLConfigurationParser.java   |  7 ++++---
 .../java/org/apache/tez/dag/api/client/DAGStatus.java |  4 ++--
 .../java/org/apache/tez/common/TezUtilsInternal.java  |  2 +-
 .../java/org/apache/tez/dag/app/dag/impl/DAGImpl.java |  4 ++--
 .../apache/tez/dag/app/dag/impl/TaskAttemptImpl.java  |  8 ++++----
 .../org/apache/tez/dag/app/dag/impl/TaskImpl.java     |  4 ++--
 .../org/apache/tez/dag/app/dag/impl/VertexImpl.java   |  9 +++++----
 .../tez/dag/app/launcher/ContainerLauncherImpl.java   |  6 +++---
 .../tez/dag/app/launcher/LocalContainerLauncher.java  |  7 +++----
 .../org/apache/tez/runtime/task/TaskReporter.java     |  6 +++---
 .../java/org/apache/tez/runtime/task/TezChild.java    |  5 +++--
 .../org/apache/tez/runtime/task/TezTaskRunner.java    |  6 +++---
 .../apache/tez/dag/app/dag/impl/TestVertexImpl.java   |  9 +++++----
 .../org/apache/tez/mapreduce/processor/MRTask.java    | 14 +++++++-------
 .../tez/runtime/LogicalIOProcessorRuntimeTask.java    |  4 ++--
 .../library/common/sort/impl/dflt/DefaultSorter.java  |  4 ++--
 .../mapreduce/examples/terasort/TeraInputFormat.java  |  4 ++--
 19 files changed, 74 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 243b055..073f665 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,13 @@
 Apache Tez Change Log
 =====================
 
+Release 0.6.0: Unreleased
+
+Release 0.5.1: Unreleased
+
+INCOMPATIBLE CHANGES
+  TEZ-1463. Remove dependency on private class org.apache.hadoop.util.StringUtils
+
 Release 0.5.0: Unreleased
 
 INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-api/src/main/java/org/apache/tez/common/TezCommonUtils.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/common/TezCommonUtils.java b/tez-api/src/main/java/org/apache/tez/common/TezCommonUtils.java
index 5148770..3d56b7b 100644
--- a/tez-api/src/main/java/org/apache/tez/common/TezCommonUtils.java
+++ b/tez-api/src/main/java/org/apache/tez/common/TezCommonUtils.java
@@ -29,6 +29,7 @@ import java.util.zip.DeflaterOutputStream;
 import java.util.zip.InflaterInputStream;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
@@ -353,4 +354,17 @@ public class TezCommonUtils {
     }
     return values;
   }
+
+  /**
+   * Splits a comma separated value <code>String</code>, trimming leading and
trailing whitespace on each value.
+   * @param str a comma separated <String> with values
+   * @return an array of <code>String</code> values
+   */
+  public static String[] getTrimmedStrings(String str) {
+    if (null == str || (str = str.trim()).isEmpty()) {
+      return ArrayUtils.EMPTY_STRING_ARRAY;
+    }
+
+    return str.split("\\s*,\\s*");
+  }
 }

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-api/src/main/java/org/apache/tez/common/security/ACLConfigurationParser.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/common/security/ACLConfigurationParser.java
b/tez-api/src/main/java/org/apache/tez/common/security/ACLConfigurationParser.java
index 6ad87fa..ff35af8 100644
--- a/tez-api/src/main/java/org/apache/tez/common/security/ACLConfigurationParser.java
+++ b/tez-api/src/main/java/org/apache/tez/common/security/ACLConfigurationParser.java
@@ -18,6 +18,7 @@
 
 package org.apache.tez.common.security;
 
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -28,7 +29,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.util.StringUtils;
+import org.apache.tez.common.TezCommonUtils;
 import org.apache.tez.dag.api.TezConfiguration;
 import org.apache.tez.dag.api.TezConstants;
 
@@ -110,11 +111,11 @@ public class ACLConfigurationParser {
     }
     if (userListStr.length() >= 1) {
       allowedUsers.put(aclType,
-          Sets.newHashSet(StringUtils.getTrimmedStringCollection(userListStr)));
+          Sets.newLinkedHashSet(Arrays.asList(TezCommonUtils.getTrimmedStrings(userListStr))));
     }
     if (groupListStr != null && groupListStr.length() >= 1) {
       allowedGroups.put(aclType,
-          Sets.newHashSet(StringUtils.getTrimmedStringCollection(groupListStr)));
+          Sets.newLinkedHashSet(Arrays.asList(TezCommonUtils.getTrimmedStrings(groupListStr))));
     }
 
   }

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-api/src/main/java/org/apache/tez/dag/api/client/DAGStatus.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/dag/api/client/DAGStatus.java b/tez-api/src/main/java/org/apache/tez/dag/api/client/DAGStatus.java
index e9ab0dd..297c6f2 100644
--- a/tez-api/src/main/java/org/apache/tez/dag/api/client/DAGStatus.java
+++ b/tez-api/src/main/java/org/apache/tez/dag/api/client/DAGStatus.java
@@ -23,8 +23,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.classification.InterfaceAudience.Public;
-import org.apache.hadoop.util.StringUtils;
 import org.apache.tez.common.counters.TezCounters;
 import org.apache.tez.dag.api.DAG;
 import org.apache.tez.dag.api.DagTypeConverters;
@@ -168,7 +168,7 @@ public class DAGStatus {
     sb.append("status=" + getState()
       + ", progress=" + getDAGProgress()
       + ", diagnostics="
-      + StringUtils.join(LINE_SEPARATOR, getDiagnostics())
+      + StringUtils.join(getDiagnostics(), LINE_SEPARATOR)
       + ", counters="
       + (dagCounters == null ? "null" : dagCounters.toString()));
     return sb.toString();

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-common/src/main/java/org/apache/tez/common/TezUtilsInternal.java
----------------------------------------------------------------------
diff --git a/tez-common/src/main/java/org/apache/tez/common/TezUtilsInternal.java b/tez-common/src/main/java/org/apache/tez/common/TezUtilsInternal.java
index add8d92..e2010b9 100644
--- a/tez-common/src/main/java/org/apache/tez/common/TezUtilsInternal.java
+++ b/tez-common/src/main/java/org/apache/tez/common/TezUtilsInternal.java
@@ -31,11 +31,11 @@ import java.util.zip.DataFormatException;
 import java.util.zip.Deflater;
 import java.util.zip.Inflater;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.yarn.api.ApplicationConstants.Environment;
 import org.apache.log4j.Appender;
 import org.apache.log4j.Logger;

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java
index e13bc6f..24b41a5 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java
@@ -37,13 +37,13 @@ import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.security.Credentials;
 import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.yarn.event.EventHandler;
 import org.apache.hadoop.yarn.state.InvalidStateTransitonException;
 import org.apache.hadoop.yarn.state.MultipleArcTransition;
@@ -919,7 +919,7 @@ public class DAGImpl implements org.apache.tez.dag.app.dag.DAG,
   void logJobHistoryUnsuccesfulEvent(DAGState state) throws IOException {
     DAGFinishedEvent finishEvt = new DAGFinishedEvent(dagId, startTime,
         clock.getTime(), state,
-        StringUtils.join(LINE_SEPARATOR, getDiagnostics()),
+        StringUtils.join(getDiagnostics(), LINE_SEPARATOR),
         getAllCounters(), this.userName, this.dagName);
     this.appContext.getHistoryHandler().handleCriticalEvent(
         new DAGHistoryEvent(dagId, finishEvt));

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskAttemptImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskAttemptImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskAttemptImpl.java
index 22cbda3..9545f48 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskAttemptImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskAttemptImpl.java
@@ -29,12 +29,12 @@ import java.util.Set;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.util.StringInterner;
-import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.NodeId;
@@ -525,7 +525,7 @@ public class TaskAttemptImpl implements TaskAttempt,
       result.setStartTime(launchTime);
       result.setFinishTime(finishTime);
       //result.setShuffleFinishTime(this.reportedStatus.shuffleFinishTime);
-      result.setDiagnosticInfo(StringUtils.join(LINE_SEPARATOR, getDiagnostics()));
+      result.setDiagnosticInfo(StringUtils.join(getDiagnostics(), LINE_SEPARATOR));
       //result.setPhase(reportedStatus.phase);
       //result.setStateString(reportedStatus.statef);
       result.setCounters(getCounters());
@@ -910,7 +910,7 @@ public class TaskAttemptImpl implements TaskAttempt,
         taskAttempt.nodeRackName == null ? "UNKNOWN"
             : taskAttempt.nodeRackName,
         StringUtils.join(
-            LINE_SEPARATOR, taskAttempt.getDiagnostics()), taskAttempt
+            taskAttempt.getDiagnostics(), LINE_SEPARATOR), taskAttempt
             .getProgressSplitBlock().burst());
     return tauce;
   }
@@ -1047,7 +1047,7 @@ public class TaskAttemptImpl implements TaskAttempt,
         attemptId, getTask().getVertex().getName(), getLaunchTime(),
         clock.getTime(), state,
         StringUtils.join(
-            LINE_SEPARATOR, getDiagnostics()),
+            getDiagnostics(), LINE_SEPARATOR),
         getCounters());
     // FIXME how do we store information regd completion events
     this.appContext.getHistoryHandler().handle(

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java
index 595c9f9..10a6846 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java
@@ -29,10 +29,10 @@ import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.event.EventHandler;
@@ -959,7 +959,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
     TaskFinishedEvent finishEvt = new TaskFinishedEvent(taskId,
         getVertex().getName(), getLaunchTime(), clock.getTime(), null,
         finalState, 
-        StringUtils.join(LINE_SEPARATOR, getDiagnostics()),
+        StringUtils.join(getDiagnostics(), LINE_SEPARATOR),
         getCounters());
     this.appContext.getHistoryHandler().handle(
         new DAGHistoryEvent(taskId.getVertexID().getDAGId(), finishEvt));

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
index 1fb40a0..045c56b 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
@@ -38,13 +38,14 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import javax.annotation.Nullable;
 
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.util.StringInterner;
-import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.yarn.api.records.LocalResource;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.event.EventHandler;
@@ -1432,8 +1433,8 @@ public class VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
   void logJobHistoryVertexFailedEvent(VertexState state) throws IOException {
     VertexFinishedEvent finishEvt = new VertexFinishedEvent(vertexId,
         vertexName, initTimeRequested, initedTime, startTimeRequested,
-        startedTime, clock.getTime(), state, StringUtils.join(LINE_SEPARATOR,
-            getDiagnostics()), getAllCounters(), getVertexStats());
+        startedTime, clock.getTime(), state, StringUtils.join(getDiagnostics(),
+            LINE_SEPARATOR), getAllCounters(), getVertexStats());
     this.appContext.getHistoryHandler().handleCriticalEvent(
         new DAGHistoryEvent(getDAGId(), finishEvt));
   }
@@ -1693,7 +1694,7 @@ public class VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
     } catch (Exception e) {
       LOG.warn("Vertex Committer init failed, vertexId=" + logIdentifier, e);
       addDiagnostic("Vertex init failed : "
-          + StringUtils.stringifyException(e));
+          + ExceptionUtils.getStackTrace(e));
       trySetTerminationCause(VertexTerminationCause.INIT_FAILURE);
       abortVertex(VertexStatus.State.FAILED);
       finished(VertexState.FAILED);

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-dag/src/main/java/org/apache/tez/dag/app/launcher/ContainerLauncherImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/launcher/ContainerLauncherImpl.java
b/tez-dag/src/main/java/org/apache/tez/dag/app/launcher/ContainerLauncherImpl.java
index 8ea7c8c..0093d22 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/launcher/ContainerLauncherImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/launcher/ContainerLauncherImpl.java
@@ -28,12 +28,12 @@ import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
 import org.apache.hadoop.service.AbstractService;
-import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.StartContainersResponse;
@@ -179,7 +179,7 @@ public class ContainerLauncherImpl extends AbstractService implements
         this.state = ContainerState.RUNNING;
       } catch (Throwable t) {
         String message = "Container launch failed for " + containerID + " : "
-            + StringUtils.stringifyException(t);
+            + ExceptionUtils.getStackTrace(t);
         this.state = ContainerState.FAILED;
         sendContainerLaunchFailedMsg(containerID, message);
       } finally {
@@ -222,7 +222,7 @@ public class ContainerLauncherImpl extends AbstractService implements
           // ignore the cleanup failure
           String message = "cleanup failed for container "
             + this.containerID + " : "
-            + StringUtils.stringifyException(t);
+            + ExceptionUtils.getStackTrace(t);
           context.getEventHandler().handle(
               new AMContainerEventStopFailed(containerID, message));
           LOG.warn(message);

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-dag/src/main/java/org/apache/tez/dag/app/launcher/LocalContainerLauncher.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/launcher/LocalContainerLauncher.java
b/tez-dag/src/main/java/org/apache/tez/dag/app/launcher/LocalContainerLauncher.java
index 1185dcc..7407544 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/launcher/LocalContainerLauncher.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/launcher/LocalContainerLauncher.java
@@ -20,7 +20,6 @@ package org.apache.tez.dag.app.launcher;
 
 
 import java.io.IOException;
-
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.nio.ByteBuffer;
@@ -41,15 +40,15 @@ import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
+
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.service.AbstractService;
-import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.yarn.api.ApplicationConstants.Environment;
 import org.apache.hadoop.yarn.api.records.ContainerId;
-
+import org.apache.tez.common.TezCommonUtils;
 import org.apache.tez.common.TezTaskUmbilicalProtocol;
 import org.apache.tez.dag.api.TezConfiguration;
 import org.apache.tez.dag.api.TezException;
@@ -184,7 +183,7 @@ public class LocalContainerLauncher extends AbstractService implements
     String tokenIdentifier = context.getApplicationID().toString();
 
     String[] localDirs =
-        StringUtils.getTrimmedStrings(System.getenv(Environment.LOCAL_DIRS.name()));
+        TezCommonUtils.getTrimmedStrings(System.getenv(Environment.LOCAL_DIRS.name()));
 
     try {
       ListenableFuture<TezChild.ContainerExecutionResult> runningTaskFuture =

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-dag/src/main/java/org/apache/tez/runtime/task/TaskReporter.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/runtime/task/TaskReporter.java b/tez-dag/src/main/java/org/apache/tez/runtime/task/TaskReporter.java
index f6b20dc..fcb8778 100644
--- a/tez-dag/src/main/java/org/apache/tez/runtime/task/TaskReporter.java
+++ b/tez-dag/src/main/java/org/apache/tez/runtime/task/TaskReporter.java
@@ -31,7 +31,7 @@ import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.ReentrantLock;
 
-import org.apache.hadoop.util.StringUtils;
+import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.log4j.Logger;
 import org.apache.tez.common.TezTaskUmbilicalProtocol;
 import org.apache.tez.common.counters.TezCounters;
@@ -328,9 +328,9 @@ public class TaskReporter {
       TezEvent statusUpdateEvent = new TezEvent(new TaskStatusUpdateEvent(task.getCounters(),
           task.getProgress()), updateEventMetadata);
       if (diagnostics == null) {
-        diagnostics = StringUtils.stringifyException(t);
+        diagnostics = ExceptionUtils.getStackTrace(t);
       } else {
-        diagnostics = diagnostics + ":" + StringUtils.stringifyException(t);
+        diagnostics = diagnostics + ":" + ExceptionUtils.getStackTrace(t);
       }
       TezEvent taskAttemptFailedEvent = new TezEvent(new TaskAttemptFailedEvent(diagnostics),
           srcMeta == null ? updateEventMetadata : srcMeta);

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-dag/src/main/java/org/apache/tez/runtime/task/TezChild.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/runtime/task/TezChild.java b/tez-dag/src/main/java/org/apache/tez/runtime/task/TezChild.java
index 1ff393b..5ec6208 100644
--- a/tez-dag/src/main/java/org/apache/tez/runtime/task/TezChild.java
+++ b/tez-dag/src/main/java/org/apache/tez/runtime/task/TezChild.java
@@ -19,6 +19,7 @@
 package org.apache.tez.runtime.task;
 
 import javax.annotation.Nullable;
+
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.URI;
@@ -42,7 +43,6 @@ import org.apache.hadoop.security.Credentials;
 import org.apache.hadoop.security.SecurityUtil;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.token.Token;
-import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.yarn.YarnUncaughtExceptionHandler;
 import org.apache.hadoop.yarn.api.ApplicationConstants;
 import org.apache.hadoop.yarn.api.ApplicationConstants.Environment;
@@ -50,6 +50,7 @@ import org.apache.log4j.LogManager;
 import org.apache.log4j.Logger;
 import org.apache.tez.common.ContainerContext;
 import org.apache.tez.common.ContainerTask;
+import org.apache.tez.common.TezCommonUtils;
 import org.apache.tez.common.TezLocalResource;
 import org.apache.tez.common.TezTaskUmbilicalProtocol;
 import org.apache.tez.common.TezUtilsInternal;
@@ -425,7 +426,7 @@ public class TezChild {
     final String containerIdentifier = args[2];
     final String tokenIdentifier = args[3];
     final int attemptNumber = Integer.parseInt(args[4]);
-    final String[] localDirs = StringUtils.getTrimmedStrings(System.getenv(Environment.LOCAL_DIRS
+    final String[] localDirs = TezCommonUtils.getTrimmedStrings(System.getenv(Environment.LOCAL_DIRS
         .name()));
     TezChild tezChild = newTezChild(defaultConf, host, port, containerIdentifier,
         tokenIdentifier, attemptNumber, localDirs, System.getenv(Environment.PWD.name()));

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-dag/src/main/java/org/apache/tez/runtime/task/TezTaskRunner.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/runtime/task/TezTaskRunner.java b/tez-dag/src/main/java/org/apache/tez/runtime/task/TezTaskRunner.java
index 7fa3798..c87e2ce 100644
--- a/tez-dag/src/main/java/org/apache/tez/runtime/task/TezTaskRunner.java
+++ b/tez-dag/src/main/java/org/apache/tez/runtime/task/TezTaskRunner.java
@@ -28,11 +28,11 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSError;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.util.ExitUtil;
-import org.apache.hadoop.util.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.tez.common.TezTaskUmbilicalProtocol;
 import org.apache.tez.dag.api.TezException;
@@ -357,12 +357,12 @@ public class TezTaskRunner implements TezUmbilical, ErrorReporter {
   private String getTaskDiagnosticsString(Throwable t, String message) {
     String diagnostics;
     if (t != null && message != null) {
-      diagnostics = "exceptionThrown=" + StringUtils.stringifyException(t) + ", errorMessage="
+      diagnostics = "exceptionThrown=" + ExceptionUtils.getStackTrace(t) + ", errorMessage="
           + message;
     } else if (t == null && message == null) {
       diagnostics = "Unknown error";
     } else {
-      diagnostics = t != null ? "exceptionThrown=" + StringUtils.stringifyException(t)
+      diagnostics = t != null ? "exceptionThrown=" + ExceptionUtils.getStackTrace(t)
           : " errorMessage=" + message;
     }
     return diagnostics;

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java
index 75d0fff..5e74c84 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java
@@ -19,6 +19,7 @@
 package org.apache.tez.dag.app.dag.impl;
 
 import java.nio.ByteBuffer;
+
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyInt;
 import static org.mockito.Mockito.doReturn;
@@ -44,6 +45,7 @@ import java.util.concurrent.locks.ReentrantLock;
 
 import com.google.protobuf.ByteString;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience;
@@ -53,7 +55,6 @@ import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.security.Credentials;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.service.Service.STATE;
-import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.Resource;
@@ -2020,7 +2021,7 @@ public class TestVertexImpl {
     Assert.assertEquals(VertexState.FAILED, v.getState());
     Assert.assertEquals(VertexTerminationCause.OWN_TASK_FAILURE, v.getTerminationCause());
     String diagnostics =
-        StringUtils.join(",", v.getDiagnostics()).toLowerCase();
+        StringUtils.join(v.getDiagnostics(), ",").toLowerCase();
     Assert.assertTrue(diagnostics.contains("task failed"
         + ", taskid=" + t1.toString()));
   }
@@ -2031,7 +2032,7 @@ public class TestVertexImpl {
     VertexImpl v2 = vertices.get("vertex4");
     killVertex(v2);
     String diagnostics =
-        StringUtils.join(",", v2.getDiagnostics()).toLowerCase();
+        StringUtils.join(v2.getDiagnostics(), ",").toLowerCase();
     LOG.info("diagnostics v2: " + diagnostics);
     Assert.assertTrue(diagnostics.contains(
         "vertex received kill in inited state"));
@@ -2046,7 +2047,7 @@ public class TestVertexImpl {
     startVertex(vertices.get("vertex2"));
     killVertex(v3);
     String diagnostics =
-        StringUtils.join(",", v3.getDiagnostics()).toLowerCase();
+        StringUtils.join(v3.getDiagnostics(), ",").toLowerCase();
     Assert.assertTrue(diagnostics.contains(
         "vertex received kill while in running state"));
   }

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/processor/MRTask.java
----------------------------------------------------------------------
diff --git a/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/processor/MRTask.java b/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/processor/MRTask.java
index 2ed1ee4..5c27ce2 100644
--- a/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/processor/MRTask.java
+++ b/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/processor/MRTask.java
@@ -29,6 +29,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.crypto.SecretKey;
 
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
@@ -59,7 +61,6 @@ import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.util.DiskChecker.DiskErrorException;
 import org.apache.hadoop.util.Progress;
-import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.yarn.api.ApplicationConstants.Environment;
 import org.apache.tez.common.MRFrameworkConfigs;
 import org.apache.tez.common.TezUtils;
@@ -285,8 +286,7 @@ public abstract class MRTask extends AbstractLogicalIOProcessor {
       }
       if (!localArchives.isEmpty()) {
         job.set(MRJobConfig.CACHE_LOCALARCHIVES, StringUtils
-            .arrayToString(localArchives.toArray(new String[localArchives
-                .size()])));
+            .join(localArchives, ','));
       }
     }
 
@@ -304,7 +304,7 @@ public abstract class MRTask extends AbstractLogicalIOProcessor {
       }
       if (!localFiles.isEmpty()) {
         job.set(MRJobConfig.CACHE_LOCALFILES, StringUtils
-            .arrayToString(localFiles.toArray(new String[localFiles.size()])));
+            .join(localFiles, ','));
       }
     }
   }
@@ -441,7 +441,7 @@ public abstract class MRTask extends AbstractLogicalIOProcessor {
         //ignore
       } catch (IOException ie) {
         LOG.warn("Failure sending canCommit: "
-            + StringUtils.stringifyException(ie));
+            + ExceptionUtils.getStackTrace(ie));
         if (--retries == 0) {
           throw ie;
         }
@@ -458,7 +458,7 @@ public abstract class MRTask extends AbstractLogicalIOProcessor {
       return;
     } catch (IOException iee) {
       LOG.warn("Failure committing: " +
-          StringUtils.stringifyException(iee));
+          ExceptionUtils.getStackTrace(iee));
       //if it couldn't commit a successfully then delete the output
       discardOutput(output);
       throw iee;
@@ -471,7 +471,7 @@ public abstract class MRTask extends AbstractLogicalIOProcessor {
       output.abort();
     } catch (IOException ioe)  {
       LOG.warn("Failure cleaning up: " +
-               StringUtils.stringifyException(ioe));
+               ExceptionUtils.getStackTrace(ioe));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-runtime-internals/src/main/java/org/apache/tez/runtime/LogicalIOProcessorRuntimeTask.java
----------------------------------------------------------------------
diff --git a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/LogicalIOProcessorRuntimeTask.java
b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/LogicalIOProcessorRuntimeTask.java
index 64018fc..a72555d 100644
--- a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/LogicalIOProcessorRuntimeTask.java
+++ b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/LogicalIOProcessorRuntimeTask.java
@@ -37,11 +37,11 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.LinkedBlockingQueue;
 
+import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.util.StringUtils;
 import org.apache.tez.common.ReflectionUtils;
 import org.apache.tez.dag.api.InputDescriptor;
 import org.apache.tez.dag.api.OutputDescriptor;
@@ -634,7 +634,7 @@ public class LogicalIOProcessorRuntimeTask extends RuntimeTask {
           getTaskAttemptID());
       setFrameworkCounters();
       tezUmbilical.signalFatalError(getTaskAttemptID(),
-          t, StringUtils.stringifyException(t), sourceInfo);
+          t, ExceptionUtils.getStackTrace(t), sourceInfo);
       return false;
     }
     return true;

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/dflt/DefaultSorter.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/dflt/DefaultSorter.java
b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/dflt/DefaultSorter.java
index da070a0..9e74515 100644
--- a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/dflt/DefaultSorter.java
+++ b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/dflt/DefaultSorter.java
@@ -29,6 +29,7 @@ import java.util.List;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.ReentrantLock;
 
+import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -38,7 +39,6 @@ import org.apache.hadoop.io.DataInputBuffer;
 import org.apache.hadoop.io.RawComparator;
 import org.apache.hadoop.util.IndexedSortable;
 import org.apache.hadoop.util.Progress;
-import org.apache.hadoop.util.StringUtils;
 import org.apache.tez.common.TezUtilsInternal;
 import org.apache.tez.runtime.api.OutputContext;
 import org.apache.tez.runtime.library.api.TezRuntimeConfiguration;
@@ -680,7 +680,7 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable
{
     if (lspillException != null) {
       if (lspillException instanceof Error) {
         final String logMsg = "Task " + outputContext.getUniqueIdentifier()
-            + " failed : " + StringUtils.stringifyException(lspillException);
+            + " failed : " + ExceptionUtils.getStackTrace(lspillException);
         outputContext.fatalError(lspillException, logMsg);
       }
       throw new IOException("Spill failed", lspillException);

http://git-wip-us.apache.org/repos/asf/tez/blob/d489dcfc/tez-tests/src/main/java/org/apache/tez/mapreduce/examples/terasort/TeraInputFormat.java
----------------------------------------------------------------------
diff --git a/tez-tests/src/main/java/org/apache/tez/mapreduce/examples/terasort/TeraInputFormat.java
b/tez-tests/src/main/java/org/apache/tez/mapreduce/examples/terasort/TeraInputFormat.java
index 94ee340..6c9b201 100644
--- a/tez-tests/src/main/java/org/apache/tez/mapreduce/examples/terasort/TeraInputFormat.java
+++ b/tez-tests/src/main/java/org/apache/tez/mapreduce/examples/terasort/TeraInputFormat.java
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FileSystem;
@@ -40,7 +41,6 @@ import org.apache.hadoop.mapreduce.lib.input.FileSplit;
 import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl;
 import org.apache.hadoop.util.IndexedSortable;
 import org.apache.hadoop.util.QuickSort;
-import org.apache.hadoop.util.StringUtils;
 
 /**
  * An input format that reads the first 10 characters of each line as the key
@@ -201,7 +201,7 @@ public class TeraInputFormat extends FileInputFormat<Text,Text>
{
             }
           } catch (IOException ie){
             System.err.println("Got an exception while reading splits " +
-                StringUtils.stringifyException(ie));
+                ExceptionUtils.getStackTrace(ie));
             throw new RuntimeException(ie);
           } catch (InterruptedException e) {
         	  


Mime
View raw message