The last line of the lowest exception and the first line of the previous one are combined to form the completed stack information.
Reason: These exception information are passed Throwable.printStackTrace()输出到System.err, first quote a description from the JDK official document
HighLevelException: MidLevelException: LowLevelException
at Junk.a(Junk.java:13)
at Junk.main(Junk.java:4)
Caused by: MidLevelException: LowLevelException
at Junk.c(Junk.java:23)
at Junk.b(Junk.java:17)
at Junk.a(Junk.java:11)
... 1 more
Caused by: LowLevelException
at Junk.e(Junk.java:30)
at Junk.d(Junk.java:27)
at Junk.c(Junk.java:21)
... 3 more
Note the presence of lines containing the characters "...". These lines indicate that the remainder of the stack trace for this exception matches the indicated number of frames from the bottom of the stack trace of the exception that was caused by this exception (the "enclosing" exception).
These lines indicate that the remainder of this exception's stack trace matches the specified number of frames from the bottom of the stack trace of the exception (caused by the "enclosing" exception)
can also be understood in this way. The calls between methods are all stack models. For example, a.b.c means that method a calls method b, and method b calls method c. Then the exception thrown in method c only represents the information in the stack frame of method c. The exception thrown by method b will have the information of two stack frames b and c, and so on.
The last line of the lowest exception and the first line of the previous one are combined to form the completed stack information.
Reason:
These exception information are passed
Throwable.printStackTrace()
输出到System.err
, first quote a description from the JDK official documentcan also be understood in this way. The calls between methods are all stack models. For example,
a.b.c
means that method a calls method b, and method b calls method c. Then the exception thrown in method c only represents the information in the stack frame of method c. The exception thrown by method b will have the information of two stack frames b and c, and so on.