Exceptions do happen, especially during development or the period of software stabilization. But in a big complex system, the chance of getting an exception is possible even in production, especially when several third-party systems are brought together and the need arises to analyze the stack trace programmatically in order to apply an automatic correction. In this section, we will discuss how it can be done.
Stack-walking APIs
Stack analysis before Java 9
The traditional reading of the stack trace, using objects of the java.lang.Thread and java.lang.Throwable classes, was accomplished by capturing it from the standard output. For example, we can include this line in any section of the code:
Thread.currentThread().dumpStack...