We have a third party java library; Inside which the exceptions are not properly handled.
Like this below:
public class UserClass {
public static void main(String[] args) {
try {
// Do something and a exception gets thrown
} catch (Exception e) {
StupidLogger.debug("Exception Occured"); // Here as the exception is not logged we don't know what has actually happened.
}
}
}
As I do not have access to the code of the UserClass
, I cannot change the code inside.
I have access to the StupidLogger
class code. So, is it possible to get access to the Exception
object either by stack trace or by using Runtime
class or by any other way inside the debug()
method of StupidLogger
class and log it properly.