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:
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.