Add a cause to the backtrace.

@param cause
the cause
@param bTrace
the backtrace list
346305
private static void addCauseToBacktrace(final Throwable cause, final List<String> bTrace) {
        if (cause.getMessage() == null) {
            bTrace.add(BT_CAUSED_BY_PREFIX + cause.getClass().getName());
        } else {
            bTrace.add(BT_CAUSED_BY_PREFIX + cause.getClass().getName() + ": " + cause.getMessage());
        }
        for (final StackTraceElement ste : cause.getStackTrace()) {
            bTrace.add(BT_PREFIX + ste.toString());
        }
        if (cause.getCause() != null) {
            addCauseToBacktrace(cause.getCause(), bTrace);
        }
    }
416068
public static void exception(TraceComponent tc, Throwable t) {
    if(isTracing()) SibTr.exception(tc, t);

  }
704207
@Override
    public final void setForwardRoutingPath(List<SIDestinationAddress> value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setForwardRoutingPath", value);
        /* It is OK to pass in null for the List */
        if (value != null) {
            for (int i = 0; i < value.size(); i++) {
                /* It is not valid to have a null entry in the List */
                if (value.get(i) == null) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                        SibTr.exit(this, tc, "setForwardRoutingPath", "NullPointerException");
                    throw new NullPointerException();
                }
                /* All values must be instances of SIDestinationAddress */
                if (!(value.get(i) instanceof SIDestinationAddress)) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                        SibTr.exit(this, tc, "setForwardRoutingPath", "IllegalArgumentException");
                    throw new IllegalArgumentException(value.toString());
                }
            }
        }
        setFRP(value);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setForwardRoutingPath");
    }
1064831
public final void errorDebug(final Throwable cause, final String message)
    {
        logDebug(Level.ERROR, cause, message);
    }
516832
public void addTrace(LogTrace<E> trace) throws ParameterException {
                Validate.notNull(trace);
                trace.setCaseNumber(traces.size() + 1);
                traces.add(trace);
                summary.addTrace(trace);
                if (!distinctTraces.add(trace)) {
                        for (LogTrace<E> storedTrace : traces) {
                                if (storedTrace.equals(trace)) {
                                        storedTrace.addSimilarInstance(trace.getCaseNumber());
                                        trace.addSimilarInstance(storedTrace.getCaseNumber());
                                }
                        }
                }
        }
751804
@SuppressWarnings("unchecked")
    public <T extends Throwable> T causeOfType(Class<T> type)
    {
        IdentityHashMap<Throwable, Throwable> seen =
            new IdentityHashMap<Throwable, Throwable>();

        Throwable cause = getCause();
        while (cause != null && ! type.isInstance(cause))
        {
            if (seen.put(cause, cause) != null)  // cycle check
            {
                return null;
            }
            cause = cause.getCause();
        }
        return (T) cause;
    }
255836
static void logCurrentThreadTrace() {
    ThreadTrace trace = getThreadTrace();

    // New threads must call Tracer.initCurrentThreadTrace() before Tracer
    // statistics are gathered. This is a recent change (Jun 2007) that
    // prevents spurious Third Eye messages when an application uses a class in
    // a different package that happens to call Tracer without knowledge of the
    // application authors.
    if (!trace.isInitialized()) {
      logger.log(
          Level.INFO,
          "Tracer log requested for this thread but was not "
              + "initialized using Tracer.initCurrentThreadTrace().",
          new Throwable());
      return;
    }

    if (!trace.isEmpty()) {
      logger.log(Level.INFO, "timers:\n{0}", getCurrentThreadTraceReport());
    }
  }
293153
private void bodyConsumerError(Throwable cause) {
    BodyConsumer consumer = bodyConsumer;
    bodyConsumer = null;
    consumer.handleError(cause);
  }
391076
public void failUnacknowledgedPendingCheckpointsFor(ExecutionAttemptID executionAttemptId, Throwable cause) {
		synchronized (lock) {
			Iterator<PendingCheckpoint> pendingCheckpointIterator = pendingCheckpoints.values().iterator();

			while (pendingCheckpointIterator.hasNext()) {
				final PendingCheckpoint pendingCheckpoint = pendingCheckpointIterator.next();

				if (!pendingCheckpoint.isAcknowledgedBy(executionAttemptId)) {
					pendingCheckpointIterator.remove();
					discardCheckpoint(pendingCheckpoint, cause);
				}
			}
		}
	}
373565
public void runCommit(boolean forceRollback) throws HeuristicMixedException, HeuristicRollbackException, RollbackException {
      if (trace) {
         log.tracef("runCommit(forceRollback=%b) invoked in transaction with Xid=%s", forceRollback, xid);
      }
      if (forceRollback) {
         markRollbackOnly(new RollbackException(FORCE_ROLLBACK_MESSAGE));
      }

      int notifyAfterStatus = 0;

      try {
         if (status == Status.STATUS_MARKED_ROLLBACK) {
            notifyAfterStatus = Status.STATUS_ROLLEDBACK;
            rollbackResources();
         } else {
            notifyAfterStatus = Status.STATUS_COMMITTED;
            commitResources();
         }
      } finally {
         notifyAfterCompletion(notifyAfterStatus);
         DummyBaseTransactionManager.setTransaction(null);
      }
      throwRollbackExceptionIfAny(forceRollback);
   }
538140
public void onFailure (Throwable cause)
    {
        Console.log("Callback failure", "for", _trigger, cause);
        setEnabled(true);
        reportFailure(cause);
    }
24945
public void addTraces(List<LogTrace<E>> traces) throws ParameterException {
                Validate.notNull(traces);
                for (LogTrace<E> trace : traces) {
                        addTrace(trace);
                }
        }
1364696
public static String stackTraceToString(Throwable cause) {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        PrintStream pout = new PrintStream(out);
        cause.printStackTrace(pout);
        pout.flush();
        try {
            return new String(out.toByteArray());
        } finally {
            try {
                out.close();
            } catch (IOException ignore) {
                // ignore as should never happen
            }
        }
    }
548046
public void onThrowable(Throwable cause) {
        this.cause = cause;
        getSelf().tell(RequestWorkerMsgType.PROCESS_ON_EXCEPTION, getSelf());

    }
777476
static <T extends Throwable> T unknownStackTrace(T cause, Class<?> clazz, String method) {
        cause.setStackTrace(new StackTraceElement[] { new StackTraceElement(clazz.getName(), method, null, -1) });
        return cause;
    }
92630
public RuntimeException traceError( Object value, RuntimeException cause ) {
        getLogger().log( Level.SEVERE, "Error during serialization", cause );
        if ( wrapExceptions ) {
            return new JsonSerializationException( cause );
        } else {
            return cause;
        }
    }
21141
public void requestFailed (Exception cause)
    {
        _error = cause;
        ResultListener<T> list = _list;
        _list = null;

        list.requestFailed(cause);
    }