[8] code review for 8006946: PKCS12 test failure due to incorrect alias name (original) (raw)

Michael StJohns mstjohns at comcast.net
Fri Jan 25 17:42:15 UTC 2013


At 08:47 AM 1/25/2013, Vincent Ryan wrote:

Please review this fix to correct a failing PKCS12 test:

Webrev: <http://cr.openjdk.java.net/~vinnie/8006946/webrev.00/>http://cr.openjdk.java.net/~vinnie/8006946/webrev.00/ Thanks.

This first is not a comment on the change - but a "why can't java do ...." type of comment....

+ // skip friendlyName, localKeyId and trustedKeyUsage + if (COREATTRIBUTES[0].equals(attributeName) || + COREATTRIBUTES[1].equals(attributeName) || + COREATTRIBUTES[2].equals(attributeName)) { + continue; + }

We allow arrays to be implicitly treated as collections only in the for () construct. For the above, it would be really nice if you could just do:

if (CORE_ATTRIBUTES.contains(attributeName)) {}

For your version, it would be increase supportability if instead of:

+ private static final String[] COREATTRIBUTES = { + "1.2.840.113549.1.9.20", + "1.2.840.113549.1.9.21", + "2.16.840.1.113894.746875.1.1" + }; +

you did

private static final String idAtPkcs9FriendlyName = "1.2.840.113549.1.9.20";

etc... and did "idAtPkcs9FriendlyName.equals(attributeName)"

I can't see any reason why this is in an array as it's not referenced anywhere else in the code.

Mike

-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/security-dev/attachments/20130125/c28cb4d0/attachment.htm>



More information about the security-dev mailing list