Description
Change NestedRuntimeException, NestedCheckedException, etc so that the exception's getMessage()
does not include the nested exception information.
NestedRuntimeException was first introduced all the way back in spring 1.0 as compatibility for code still running in Java 1.3 or older version, which did not have exception chaining feature. To easily make the chained exception messages visible to the user on such old Java versions, getMessage()
recursively included the messages.
We are long past Java 1.3. Nowadays, the nested message information is extremely, unnecessarily verbose and repetitive.
Look at an example exception from a toy application.
And then look at the same exception without nested messages.
In typical large applications, the problem is exacerbated because the exception messages/stacktraces can span many many console pages. In most cases, we must locate the root exception anyways to make sense of it all because both the root exception message and the root stacktrace are needed to accurately diagnose the problem. The nested messages only impede the diagnostics.
Please remove nested exception messages.