garydgregory commented on code in PR #480:
URL: https://github.com/apache/commons-compress/pull/480#discussion_r1485214180
##########
src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java:
##########
@@ -113,24 +116,24 @@ public ZipExtraField onUnparseableExtraField(final byte[]
data, final int off, f
/**
* Static registry of known extra fields.
*/
- private static final Map<ZipShort, Class<?>> IMPLEMENTATIONS;
+ private static final Map<ZipShort, Supplier<ZipExtraField>>
IMPLEMENTATIONS;
static {
- IMPLEMENTATIONS = new ConcurrentHashMap<>();
- register(AsiExtraField.class);
- register(X5455_ExtendedTimestamp.class);
- register(X7875_NewUnix.class);
- register(JarMarker.class);
- register(UnicodePathExtraField.class);
- register(UnicodeCommentExtraField.class);
- register(Zip64ExtendedInformationExtraField.class);
- register(X000A_NTFS.class);
- register(X0014_X509Certificates.class);
- register(X0015_CertificateIdForFile.class);
- register(X0016_CertificateIdForCentralDirectory.class);
- register(X0017_StrongEncryptionHeader.class);
- register(X0019_EncryptionRecipientCertificateList.class);
- register(ResourceAlignmentExtraField.class);
+ IMPLEMENTATIONS = new HashMap<>(); // it can't be used at runtime by
design so no need to be concurrent
Review Comment:
The method `register(Class)` is a public API, so anyone can call it at any
time, I don't see the need to change the Map implementation, better safe than
sorry ;-)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]