On Mon, 16 Nov 2026 13:52:12 GMT, Weijun Wang <[email protected]> wrote:

>> Timofei Fedotov has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Limit empty attribute value checks to friendlyName and localKeyId
>
> src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java line 2394:
> 
>> 2392:                                 attrId.equals(PKCS9LocalKeyId_OID))) {
>> 2393:                             throw new IOException("Empty attribute 
>> value set");
>> 2394:                         }
> 
> The IOE above will be caught by the next line and wrapped in another IOE, and 
> the message is not precise.
> 
> I'd rather duplicate the length check in the branches on lines 2399-2401.

Done.

> test/jdk/sun/security/pkcs12/EmptyAttributeSet.java line 47:
> 
>> 45:                     !message.contains("Empty attribute value set")) {
>> 46:                 throw new AssertionError("Unexpected exception", e);
>> 47:             }
> 
> We have some helper methods for the checks:
> 
>         IOException ioe = Asserts.assertThrows(IOException.class,
>                 () -> store.load(new ByteArrayInputStream(data), null));
>         Asserts.assertTrue(ioe.getMessage().contains(oid));
>         Asserts.assertTrue(ioe.getMessage().contains("Empty attribute value 
> set"));

Done.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33864#discussion_r4595827146
PR Review Comment: https://git.openjdk.org/jdk/pull/33864#discussion_r4595828180

Reply via email to