Java Object Clone cloneStackTrace(Throwable aException)

Here you can find the source of cloneStackTrace(Throwable aException)

Description

clone Stack Trace

License

Apache License

Declaration

private static StackTraceElement[] cloneStackTrace(Throwable aException) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    private static StackTraceElement[] cloneStackTrace(Throwable aException) {
        StackTraceElement[] stack = aException.getStackTrace();
        StackTraceElement[] newStack = new StackTraceElement[stack.length];
        for (int i = 0; i < newStack.length; i++) {
            StackTraceElement element = stack[i];
            newStack[i] = new StackTraceElement(element.getClassName(), element.getMethodName(),
                    element.getFileName(), element.getLineNumber());
        }//from w  ww .  j  a va  2 s .  c  om
        return newStack;
    }
}

Related

  1. clone(T array)
  2. clone_obj_array(Object source)
  3. cloneClass(Class clazz)
  4. cloneCloneNotSupportedObject(final T obj, final boolean deep)
  5. cloneShort(Short sOriginal)
  6. copyIfNecessary(final Object val)