On Wed, 22 Oct 2025 19:25:43 GMT, Anthony Scarpino <[email protected]> 
wrote:

>> src/java.base/share/classes/java/security/PEMDecoder.java line 298:
>> 
>>> 296:      * @param str a String containing PEM data
>>> 297:      * @return a {@code DEREncodable}
>>> 298:      * @throws IllegalArgumentException on error in decoding or no PEM 
>>> data found
>> 
>> It looks like this method will throw `EOFException` and not 
>> `IllegalArgumentException` if there is no PEM data because it calls decode 
>> with a `ByteArrayInputStream` so uses that method which throws an 
>> `EOFException`.
>> 
>> Same comment for method that takes a `Class` argument.
>
> EOFException is a child of IOException, so the catch covers this.

Ah, ok, although I think it is odd for `EOFException` (or even `IOException`) 
to be the cause for reading from a String or byte array.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27147#discussion_r2466995168

Reply via email to