When you invoke getStackTrace() on a Throwable object, it gives back you an array of java.lang.StackTraceElement - each element representing a single line in the stack trace.
You need not parse the stack trace at all, as it is just an aggregation of individual data.
Try exploring the java.lang.StackTraceElement class for more info.
No, I don't want Exception but specific one that is defined in the stack trace. Let say I have the following stack trace:
java.io.FileNotFoundException: Cannot find /a.txt
So having above stack trace as a String I would like to create FileNotFoundException object with message and all stack trace elements.
Is there any tool that can do it automatically for me. I don't want to parse it manually.
Anyone know something like that?