On Mon, 11 Aug 2025 20:58:13 GMT, Anthony Scarpino <ascarp...@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())` ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26734#discussion_r2268160924