Source:
private void appendTaskStackTrace(final Throwable error) { if (!ParSeqGlobalConfiguration.getInstance().isCrossThreadStackTracesEnabled() || error == null || _taskStackTrace == null || _taskStackTrace.length <= 2) { return; } StackTraceElement[] errorStackTrace = error.getStackTrace(); if (errorStackTrace.length <= 2) { return; } int skipErrorFrames = 1; while (skipErrorFrames < errorStackTrace.length) { int index = errorStackTrace.length - 1 - skipErrorFrames; if (!errorStackTrace[index].getClassName().equals(CANONICAL_NAME) && errorStackTrace[index + 1].getClassName().equals(CANONICAL_NAME)) { break; } skipErrorFrames++; } if (skipErrorFrames == errorStackTrace.length) { skipErrorFrames = 0; } int skipTaskFrames = 1; while (skipTaskFrames < _taskStackTrace.length) { if (!_taskStackTrace[skipTaskFrames].getClassName().equals(CANONICAL_NAME) && _taskStackTrace[skipTaskFrames - 1].getClassName().equals(CANONICAL_NAME)) { break; } skipTaskFrames++; } if (skipTaskFrames == _taskStackTrace.length) { skipTaskFrames = 0; } int combinedLength = errorStackTrace.length - skipErrorFrames + _taskStackTrace.length - skipTaskFrames; if (combinedLength <= 0) { return; } StackTraceElement[] concatenatedStackTrace = new StackTraceElement[combinedLength + 1]; System.arraycopy(errorStackTrace, 0, concatenatedStackTrace, 0, errorStackTrace.length - skipErrorFrames); concatenatedStackTrace[errorStackTrace.length - skipErrorFrames] = new StackTraceElement("********** Task \"" + getName() + "\" (above) was instantiated as following (below): **********", "",null, 0); System.arraycopy(_taskStackTrace, skipTaskFrames, concatenatedStackTrace, errorStackTrace.length - skipErrorFrames + 1, _taskStackTrace.length - skipTaskFrames); error.setStackTrace(concatenatedStackTrace); }

Target:
private void appendTaskStackTrace(final Throwable error) { if (!ParSeqGlobalConfiguration.isCrossThreadStackTracesEnabled() || error == null || _taskStackTrace == null || _taskStackTrace.length <= 2) { return; } StackTraceElement[] errorStackTrace = error.getStackTrace(); if (errorStackTrace.length <= 2) { return; } int skipErrorFrames = 1; while (skipErrorFrames < errorStackTrace.length) { int index = errorStackTrace.length - 1 - skipErrorFrames; if (!errorStackTrace[index].getClassName().equals(CANONICAL_NAME) && errorStackTrace[index + 1].getClassName().equals(CANONICAL_NAME)) { break; } skipErrorFrames++; } if (skipErrorFrames == errorStackTrace.length) { skipErrorFrames = 0; } int skipTaskFrames = 1; while (skipTaskFrames < _taskStackTrace.length) { if (!_taskStackTrace[skipTaskFrames].getClassName().equals(CANONICAL_NAME) && _taskStackTrace[skipTaskFrames - 1].getClassName().equals(CANONICAL_NAME)) { break; } skipTaskFrames++; } if (skipTaskFrames == _taskStackTrace.length) { skipTaskFrames = 0; } int combinedLength = errorStackTrace.length - skipErrorFrames + _taskStackTrace.length - skipTaskFrames; if (combinedLength <= 0) { return; } StackTraceElement[] concatenatedStackTrace = new StackTraceElement[combinedLength + 1]; System.arraycopy(errorStackTrace, 0, concatenatedStackTrace, 0, errorStackTrace.length - skipErrorFrames); concatenatedStackTrace[errorStackTrace.length - skipErrorFrames] = new StackTraceElement("********** Task \"" + getName() + "\" (above) was instantiated as following (below): **********", "",null, 0); System.arraycopy(_taskStackTrace, skipTaskFrames, concatenatedStackTrace, errorStackTrace.length - skipErrorFrames + 1, _taskStackTrace.length - skipTaskFrames); error.setStackTrace(concatenatedStackTrace); }