static public String getSourceCodeRelativePathForStackTraceElement(StackTraceElement ste) {
        String packageName = ste.getClassName();
        // e.g. com.fizzed.test.Application$1 for an internal class
        int pos = packageName.lastIndexOf('.');
        if (pos > 0) {
            packageName = packageName.substring(0, pos);
            return
                packageName.replace(".", File.separator)
                + File.separator
                + ste.getFileName();
        } else {
            // must be in default package
            return
                ste.getFileName();
        }
    }
static public String getSourceCodeRelativePathForStackTraceElement(StackTraceElement ste) {
        String packageName = ste.getClassName();
        
        int pos = packageName.lastIndexOf('.');
        if (pos > 0) {
            packageName = packageName.substring(0, pos);
            return
                packageName.replace(".", File.separator)
                + File.separator
                + ste.getFileName();
        } else {
            
            return
                ste.getFileName();
        }
    }
static public String getSourceCodeRelativePathForStackTraceElement ( StackTraceElement ste ) { String packageName = ste . getClassName ( ) ; // e.g. com.fizzed.test.Application$1 for an internal class int pos = packageName . lastIndexOf ( ' ' ) ; if ( pos > 0 ) { packageName = packageName . substring ( 0 , pos ) ; return packageName . replace ( "." , File . separator ) + File . separator + ste . getFileName ( ) ; } else { // must be in default package return ste . getFileName ( ) ; } }
Calculates the relative path of the source code file of a StackTrace
element if its available. Uses the packageName of the class to create a relative path
and appends the "filename" included with the stack trace element.
@param ste The stack trace element
@return The relative path of the source code file or null if the information
wasn't available in the stack trace element.
Calculates the relative path of the source code file of a StackTrace element if its available . Uses the packageName of the class to create a relative path and appends the filename included with the stack trace element .