Java Utililty Methods Throwable to StackTrace

List of utility methods to do Throwable to StackTrace

Description

The list of methods to do Throwable to StackTrace are organized into topic(s).

Method

Listcleanup(StackTraceElement[] stack)
Removes the '__M_' iPOJO trace from the stack trace.
List<StackTraceElement> elements = new ArrayList<>();
if (stack == null) {
    return elements;
} else {
    for (StackTraceElement element : stack) {
        if (element.getMethodName().startsWith("__M_")) {
            String newMethodName = element.getMethodName().substring("__M_".length());
            elements.add(new StackTraceElement(element.getClassName(), newMethodName, element.getFileName(),
...
StackTraceElement[]getStackTrace(Throwable t, String[] allow, String[] deny)
Returns stack trace filtered by class names.
StackTraceElement[] st = t.getStackTrace();
ArrayList<StackTraceElement> result = new ArrayList<>(st.length);
elementLoop: for (StackTraceElement element : st) {
    String className = element.getClassName();
    if (allow != null) {
        boolean validElemenet = false;
        for (String filter : allow) {
            if (className.indexOf(filter) != -1) {
...
StackTraceElement[][]getStackTraceChain(Throwable t, String[] allow, String[] deny)
Returns stack trace chain filtered by class names.
ArrayList<StackTraceElement[]> result = new ArrayList<StackTraceElement[]>();
while (t != null) {
    StackTraceElement[] stack = getStackTrace(t, allow, deny);
    result.add(stack);
    t = t.getCause();
StackTraceElement[][] allStacks = new StackTraceElement[result.size()][];
for (int i = 0; i < allStacks.length; i++) {
...
ListgetStackTraces(Throwable throwable)
get Stack Traces
StackTraceElement[] stElements = throwable.getStackTrace();
if (stElements == null)
    return null;
List<String> stList = new ArrayList<String>(stElements.length);
for (StackTraceElement stElement : stElements)
    stList.add(stElement.toString());
return stList;