Noticed this when backporting [JDK-8311546](https://bugs.openjdk.org/browse/JDK-8311546). The test is actually broken, as it does not include CA cert in the certification path. So it passes even without the fix, and thus does not actually tests what the fix is supposed to test.
The test is also quite hairy and can be drastically simplified. It looks to me the actual bug is in this line: List<Certificate> list = List.of(targetCert); I think it got wrongly rewritten here: https://github.com/openjdk/jdk/commit/a2c0fa6f9ccefd3d1b088c51d0b8170cfb59a885#diff-518af459086b0cd1aef2498da82abf7da93391c030662e55312860ac9ce80542L55 Additional testing: - [x] Test now fails with [JDK-8311546](https://bugs.openjdk.org/browse/JDK-8311546) fix reverted, passes with it ------------- Commit messages: - Fix Changes: https://git.openjdk.org/jdk/pull/23033/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23033&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8347424 Stats: 63 lines in 1 file changed: 1 ins; 44 del; 18 mod Patch: https://git.openjdk.org/jdk/pull/23033.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/23033/head:pull/23033 PR: https://git.openjdk.org/jdk/pull/23033