Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Get a Frame from a StackTraceElement
- * @param stackTraceElement the StackTraceElement (a.k.a.: stack frame)
- * @return the Frame representing the StackTraceElement
- * @throws ArgumentNullException if stackTraceElement is null
- */
- public static Frame fromStackTraceElement(StackTraceElement stackTraceElement) throws ArgumentNullException {
- String filename = stackTraceElement.getFileName(); //THIS RETURNS NULL FOR SOME FRAME(S) OF THE STACKTRACE ABOVE
- Integer lineNumber = stackTraceElement.getLineNumber();
- String method = stackTraceElement.getMethodName();
- String className = stackTraceElement.getClassName();
- //Since filename is null Frame's constructor will throw the ArgumentNullException
- return new Frame(filename, lineNumber, null, method, null, className, null, null, null);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement