Replace PlexusIoZipFileResourceCollection with PlexusArchiverZipFileResourceCollection for non-JAR formats #398
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR addresses the performance issue identified in the original issue by replacing
PlexusIoZipFileResourceCollectionwith the fasterPlexusArchiverZipFileResourceCollectionfor non-JAR ZIP-based file formats, while preserving JAR signature verification for security compliance.Background
Previously, all ZIP-based file formats (ZIP, JAR, WAR, EAR, etc.) used
PlexusIoZipFileResourceCollection, which has performance penalties due to its use ofJarFilefor reading entries. WhileJarFileis necessary for verifying signatures in signed JAR files, this overhead is unnecessary for other ZIP-based formats.The faster
PlexusArchiverZipFileResourceCollectionuses Apache Commons CompressZipFiledirectly without the signature verification overhead, but was only used for plain ZIP files.Solution
This PR implements a hybrid approach:
Created
PlexusIoJarFileResourceCollectionWithSignatureVerification- A new class containing the original implementation that usesJarFileandURLClassLoaderto provide URL-based resource access and JAR signature verification.Simplified
PlexusIoZipFileResourceCollection- Now extendsPlexusArchiverZipFileResourceCollectionfor better performance when signature verification is not needed.Updated all non-JAR ZIP-based format collections - WAR, EAR, SAR, RAR, NAR, CAR, ESB, SWC, and PAR file collections now extend
PlexusArchiverZipFileResourceCollectiondirectly, gaining the performance benefits.Preserved JAR signature verification -
PlexusIoJarFileResourceCollectionextends the signature-verifying version to maintain security for signed JAR files.Benefits
Testing
All 340 existing tests pass successfully. Tests that specifically require URL support (JAR-related functionality) have been updated to use the appropriate signature-verifying collection.
Related Issues
Fixes the performance issue described in the original issue and resolves the concerns raised in codehaus-plexus/plexus-io#12 regarding the performance penalty of using
PlexusIoZipFileResourceCollectionfor all ZIP-based formats.Original prompt
Fixes #90
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.