If I rethrow a caught exception, the old stack trace is still shown. How do I change the stack trace to show it is coming from within the catch clause that caught the original exception, instead of where the original exception happened?

John Zukowski

To have the stack trace indicate that the exception came from the catch clause, you need to install the new trace information by calling the fillInStackTrace() method.

catch (Exception e) {
  System.err.println("Problem here");
  throw e.fillInStackTrace();
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact