private static void setStackTrace(Throwable error) {
    StackTraceElement[] localStackTrace = Thread.currentThread().getStackTrace();
    StackTraceElement[] originalStackTrace = error.getStackTrace();
    StackTraceElement[] newStackTrace =
      new StackTraceElement[localStackTrace.length + originalStackTrace.length + 1];
    System.arraycopy(localStackTrace, 0, newStackTrace, 0, localStackTrace.length);
    newStackTrace[localStackTrace.length] =
      new StackTraceElement("--------Future", "get--------", null, -1);
    System.arraycopy(originalStackTrace, 0, newStackTrace, localStackTrace.length + 1,
      originalStackTrace.length);
    error.setStackTrace(newStackTrace);
  }
Get the cause of the {@link Throwable} if it is a {@link CompletionException}.
hbase-common/src/main/java/org/apache/hadoop/hbase/util/FutureUtils.java