guru-bharadwaj20 opened a new pull request, #1426:
URL: https://github.com/apache/maven-assembly-plugin/pull/1426

   Fixes #1423
   
   If a `<file>` entry has `<filtered>true</filtered>` and a file-aggregating 
handler such as `SimpleAggregatingDescriptorHandler` selects it, the aggregate 
gets the raw file content instead of the filtered content. 
`AssemblyProxyArchiver.addResource` builds the `FileInfo` for the selectors 
from `new File(resource.getName())`, and `DefaultFileInfo.getContents()` opens 
that file, so the selectors never see what the resource would write.
   
   With this change `addResource` hands the resource to `DefaultFileInfo`, and 
`getContents()` reads from the resource when one is set. The name, `isFile()` 
and `isDirectory()` still come from the file, so selectors match on the same 
things as before. `addFile` and the other add paths are unchanged.
   
   One limit I noticed while reading plexus-io: `PlexusIoFileResource` keeps 
transformed content above 5 MB in a temp file, and closing the stream from 
`getContents()` deletes that file. The bundled handlers exclude the files they 
aggregate, so they are not affected. A custom selector that reads a filtered 
file over 5 MB and still lets it into the archive would run into it.
   
   Tests:
   - New unit test 
`AssemblyProxyArchiverTest.addResourceShouldShowTheResourceContentToSelectors`. 
On master it fails with `expected: <filtered> but was: <raw>`; with the change 
it passes.
   - The `custom-handler-withFileEntries` IT has a new `bin-filtered` assembly 
with a filtered `<file>` that contains `${project.version}`. `verify.groovy` 
checks that the aggregate contains `file C 1`.
   - `mvn verify -Prun-its` passes locally (JDK 17, Maven 3.9.9), with spotless 
and rat.
   
   ---
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 
2004](https://www.apache.org/licenses/LICENSE-2.0)
   check one of the following:
   
   - [x] I hereby declare this contribution to be licensed under the [Apache 
License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
   - [ ] I hereby declare that I have filed an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).
   


-- 
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]

Reply via email to