Exceptions during setup of these tests could leave e.g. JMXConnector cs as null. But, we call cs.close() during a finally block and fail with an NPE, obscuring the real failure. We must only call close if this is not null.
------------- Commit messages: - 8299112: HashedPasswordFileTest.java and ExceptionTest.java fails with java.lang.NullPointerException Changes: https://git.openjdk.org/jdk/pull/11881/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11881&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8299112 Stats: 18 lines in 2 files changed: 9 ins; 0 del; 9 mod Patch: https://git.openjdk.org/jdk/pull/11881.diff Fetch: git fetch https://git.openjdk.org/jdk pull/11881/head:pull/11881 PR: https://git.openjdk.org/jdk/pull/11881