All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rx.marble.ExceptionHelper Maven / Gradle / Ivy

There is a newer version: 1.3
Show newest version
package rx.marble;


public class ExceptionHelper {


    public static String findCallerInStackTrace(Class callee) {
        StackTraceElement[] stackTrace = new Exception().getStackTrace();
        StackTraceElement current = null;
        for (StackTraceElement element : stackTrace) {
            current = element;
            if (!element.getClassName().endsWith(callee.getSimpleName())
                    && !element.getClassName().endsWith(ExceptionHelper.class.getSimpleName())) {
                break;
            }
        }
        return current.getClassName()
                + "." + current.getMethodName()
                + "(" + current.getFileName() + ":" + current.getLineNumber() + ")";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy