I have one method for e.g. void abc(){}
and this method is getting called from my main()
method directly as well as from it's exception block i.e from catch block too.
Now I wants to find out inside abc()
method , whether abc()
is getting called normally (i.e. from main()
) or it is called in exception case (i.e. from catch()
block).
I tried this , using Thread.getCurrentStackTrace()
, however it always returns main()
method (as method name), as in both cases method will always remain same.
Important point here is , I can not change signature of abc()method and I can not set any flag inside main() method or in catch() block , with this limitations, I am trying to find out , how to check from where abc() get called or in simple words....how to find out whether exception is thrown or not inside abc() method.
Please suggest!