JDK-8277123 : jdeps does not report some exceptions correctly
  • Type: Bug
  • Component: tools
  • Affected Version: 18
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-11-15
  • Updated: 2022-03-17
  • Resolved: 2021-11-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17 JDK 18
17.0.4-oracleFixed 18 b26Fixed
Related Reports
Relates :  
Relates :  
Description
Found through this stack overflow question: https://stackoverflow.com/q/69943899

If e.g. a MultiReleaseException is thrown from VersionHelper.java:60 [1], it will be wrapped in an ExecutionException, and then re-wrapped in an Error in DependencyFinder.java:271 [2].

As a result, the main logic for reporting errors in JdepsTask::run will not recognize the exception and report the error properly [3], resulting in a stack trace with an empty exception message instead (like in the SO question).

Perhaps the cause of the ExecutionException at [2] should be re-thrown instead of wrapping it in an Error.

See https://bugs.openjdk.java.net/browse/JDK-8277165 for a reproducer.

[1] : https://github.com/openjdk/jdk/blob/master/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/VersionHelper.java#L60
[2] : https://github.com/openjdk/jdk/blob/master/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java#L270
[3] : https://github.com/openjdk/jdk/blob/master/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java#L549
Comments
A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk17u-dev/pull/256 Date: 2022-03-15 09:34:18 +0000
15-03-2022

Changeset: 7e54d065 Author: Mandy Chung <mchung@openjdk.org> Date: 2021-11-26 01:55:58 +0000 URL: https://git.openjdk.java.net/jdk/commit/7e54d065a17f1277adf1b8561fadb8a480bc6bed
26-11-2021

I guess this explains this other issue (which is now closed) https://bugs.openjdk.java.net/browse/JDK-8264267 which was reported against Java 11.
16-11-2021

Initially found on Java 17, but AFAICS the relevant code has not changed in the latest mainlain
15-11-2021