Here you can find the source of cloneStackTrace(Throwable aException)
private static StackTraceElement[] cloneStackTrace(Throwable aException)
//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; } }