Package org.scijava.util
Class DebugUtils
- java.lang.Object
-
- org.scijava.util.DebugUtils
-
public final class DebugUtils extends Object
Useful methods for debugging programs.- Author:
- Curtis Rueden
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetFieldName(Class<?> c, int value)This method uses reflection to scan the values of the given class's static fields, returning the first matching field's name.static StringgetMainClassName()Get the class whose main method launched the application.static StringgetStackDump()Provides a complete stack dump of all threads.static StringgetStackDump(Thread thread)Provides a stack dump of the given thread.static StringgetStackDump(Thread thread, StackTraceElement[] stackTrace)Provides a stack dump of the given thread + call stack.static StringgetStackTrace(Throwable t)Extracts the given exception's corresponding stack trace to a string.
-
-
-
Method Detail
-
getStackTrace
public static String getStackTrace(Throwable t)
Extracts the given exception's corresponding stack trace to a string.
-
getStackDump
public static String getStackDump(Thread thread)
Provides a stack dump of the given thread.The output is similar to a subset of that given when Ctrl+\ (or Ctrl+Pause on Windows) is pressed from the console.
-
getStackDump
public static String getStackDump(Thread thread, StackTraceElement[] stackTrace)
Provides a stack dump of the given thread + call stack.The output is similar to a subset of that given when Ctrl+\ (or Ctrl+Pause on Windows) is pressed from the console.
-
getStackDump
public static String getStackDump()
Provides a complete stack dump of all threads.The output is similar to a subset of that given when Ctrl+\ (or Ctrl+Pause on Windows) is pressed from the console.
-
getFieldName
public static String getFieldName(Class<?> c, int value)
This method uses reflection to scan the values of the given class's static fields, returning the first matching field's name.
-
getMainClassName
public static String getMainClassName()
Get the class whose main method launched the application. The heuristic will fail if the main thread has terminated before this method is called.
-
-