On Mon, 11 Aug 2025 22:38:22 GMT, Chen Liang <li...@openjdk.org> wrote:
>> This bug fix is to change PEMDecoder.decode(..., Class<>) using >> PKCS8EncodedKeySpec and X509EncodedKeySpec will throw an >> IllegalArgumentException when the decoded data does not match. It should be >> ClassCastException. >> >> Thanks >> >> Tony > > test/jdk/java/security/PEM/PEMDecoderTest.java line 492: > >> 490: testClass(entry, clazz); >> 491: } catch (Exception e) { >> 492: if (e.getClass().isAssignableFrom(ec)) { > > You got it the other way around, testing if `e` is of a superclass of `ec`. > Suggestion: > > if (ec.isInstance(e)) { > > Or `ec.isAssignableFrom(e.getClass())` I cannot say the name is confusing because I actually don't know what it means. Over the years I've learnt to read it as `isParentOf`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26734#discussion_r2269592770