public static String printStackTraceElement(StackTraceElement stackTraceElement) {
        final String toString;
        if (stackTraceElement == null) {
            toString = "at null";
        }
        // Look for our eyecatcher representing a truncation
        else if (TRIMMED_STACK_TRACE_ELEMENT.equals(stackTraceElement)) {
            // Use only the class name, which is actually [internal classes]
            toString = "at " + stackTraceElement.getClassName();
            // Look for our eyecatcher representing a the stripping of redundant cause frames
        } else if (DUPLICATE_FRAMES_EYECATCHER.equals(stackTraceElement.getMethodName())) {
            // Use only the class name, which will include the ... - we don't want a "at " in this case
            toString = stackTraceElement.getClassName();
        } else {
            // The 'at' is a non-internationalised string in what we're trying to imitate   
            toString = "at " + stackTraceElement.toString();
        }
        return toString;
    }
public static String printStackTraceElement ( StackTraceElement stackTraceElement ) { final String toString ; if ( stackTraceElement == null ) { toString = "at null" ; } else if ( TRIMMED_STACK_TRACE_ELEMENT . equals ( stackTraceElement ) ) { toString = "at " + stackTraceElement . getClassName ( ) ; } else if ( DUPLICATE_FRAMES_EYECATCHER . equals ( stackTraceElement . getMethodName ( ) ) ) { toString = stackTraceElement . getClassName ( ) ; } else { toString = "at " + stackTraceElement . toString ( ) ; } return toString ; }
Unfortunately, toString() isn't good enough since we may have elements in the stack representing
internal classes, and they don't toString() well.