jetty.project icon indicating copy to clipboard operation
jetty.project copied to clipboard

Jetty 12 : Avoid recreating `Resource` during container/jar pattern filtering in `MetaInfConfiguration`

Open joakime opened this issue 3 years ago • 0 comments

This fixes a few things with the URI matching done in MetaInfConfiguration against the regex from CONTAINER_JAR_PATTERN and WEBINF_JAR_PATTERN.

  1. The old PatternMatcher usage introduced an extra unnecessary newResource() call
  2. The regex patterns need to work against the container of a jar:file:// URI, not the jar:file: URI itself.

The fix here was to avoid converting a List<Resource> to List<URI> and then URI[] to just match against the provided patterns, which then does a resourceFactory.newResource(URI) on the pre-existing Resource to then add it to another List<Resource>.

Introducing UriPatternPredicate to standardize the selection logic from PatternMatcher, and have PatternMatcher use it. Creating ResourceUriPatternPredicate specific implementation to to allow filtering of resources by their URI Reworked MetaInfConfiguration to filter Lists of Resources using these new classes to test againt the archive container, and to avoid recreating the Resource object.

joakime avatar Aug 09 '22 12:08 joakime