[crac] RFR: Improve C/R exception printout
Radim Vansa
rvansa at openjdk.org
Wed Jan 3 14:02:06 UTC 2024
On Fri, 24 Nov 2023 09:04:43 GMT, Radim Vansa <rvansa at openjdk.org> wrote:
> Some users might get confused by the inner exceptions reported during C/R as *suppressed* exceptions. This PR changes the printout to make it look as if the exception had multiple causes. For example the DryRunTest will report this:
>
> jdk.crac.CheckpointException: Failed with 2 inner exceptions
> Cause 1/2: java.lang.RuntimeException: should not pass
> at DryRunTest$CRResource.beforeCheckpoint(DryRunTest.java:47)
> at java.base/jdk.crac.impl.AbstractContext.invokeBeforeCheckpoint(AbstractContext.java:44)
> ... (redacted)
> Cause 2/2: jdk.crac.impl.CheckpointOpenFileException: /tmp/jtreg-DryRunTest6956725915963168340.tmp
> at java.base/jdk.internal.crac.JDKFileResource.lambda$beforeCheckpoint$1(JDKFileResource.java:89)
> at java.base/jdk.crac.Core.checkpointRestore1(Core.java:174)
> ... (redacted)
"Nested" is probably a better term than "inner". Having method `getNestedExceptions()` that actually calls `getSuppressed()` would be trivial, and would provide space for javadocs. A completely distinct field is probably cleaner, though; however it feels that we are getting more code duplicated for Checkpoint and RestoreException; do you think it would be useful to have them share a common parent? (ofc. we will still have some duplication with the `javax.crac` package...).
-------------
PR Comment: https://git.openjdk.org/crac/pull/145#issuecomment-1875411980
More information about the crac-dev
mailing list