Tomáš Hubálek Blog: Bavte se přiměřeně
Calendar
| Mon | Tue | Wed | Thu | Fri | Sat | Sun |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
Čtvrtek, 13.09.07
Java: How to display incomplete stacktrace?
A few days ago we met some issue and there was huge stacktrace finishing with ... 20 more.
We was disappointed that we cannot see real cause of the exception because we thought that Java is hiding most important exception details.
But in fact, there is nothing hidden, it is just misunderstanding of the stack trace.
Lets look at following java snippet:
01 public class Test {
|
| Java2html |
This code display following stack trace:
Exception in thread "main" java.lang.RuntimeException: Error occured in method a()
at Test.a(Test.java:7)
at Test.main(Test.java:24)
Caused by: java.lang.RuntimeException: Error occured in method b()
at Test.b(Test.java:15)
at Test.a(Test.java:5)
... 1 more
Caused by: java.lang.RuntimeException
at Test.c(Test.java:20)
at Test.b(Test.java:13)
... 2 more
and you can see complete stack trace although there is text .. 2 more and the real cause you can see at the top of the last exception.
For more info see description of the "bug" number 4775147 (Incomplete stack trace printed by Throwable.printStackTrace in JDK 1.4+) in Sun's bug parade.
21:18:05 -