RFR: 8282712: VMConnection.open() does not detect if VM failed to be created, resulting in NPE

Chris Plummer cjplummer at openjdk.org
Sat Aug 12 04:21:28 UTC 2023


VMConnection.open() expects launchTarget(), attachTarget(), and listentTarget() to either throw an exception or return a valid VirtualMachine instance. Instead they were catching certain exceptions and returning null, which resulted in an NPE in VMConnection.open(). I've fixed it so these APIs now rethrow any caught exception and never return null.

Tested with tier1 and also running the following 10x each on linux-x64, macosx-aarch64, and windows-x64:

test/hotspot/jtreg/vmTestbase/nsk/jdwp/
test/hotspot/jtreg/vmTestbase/nsk/jdb/
test/hotspot/jtreg/vmTestbase/nsk/jdi
test/jdk/com/sun/jdi

-------------

Commit messages:
 - Catch and rethrow exceptions rather than returning null.

Changes: https://git.openjdk.org/jdk/pull/15255/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15255&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8282712
  Stats: 21 lines in 2 files changed: 14 ins; 6 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/15255.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15255/head:pull/15255

PR: https://git.openjdk.org/jdk/pull/15255


More information about the serviceability-dev mailing list