Skip to content

Be gracious with "filtering" of binary files#303

Open
fridrich wants to merge 3 commits intoapache:masterfrom
fridrich:master
Open

Be gracious with "filtering" of binary files#303
fridrich wants to merge 3 commits intoapache:masterfrom
fridrich:master

Conversation

@fridrich
Copy link

@fridrich fridrich commented Nov 8, 2025

Some projects have among the test resources various binary files along with property files that actually need to be filtered. The binary files can be for instance dummy P12 or JKS files. When the pom.xml has filtering enabled for those resources, the parser tries to parse them as text files with the given encoding. But they are more then likely not to be valid UTF-8 or ISO-8859-1, ... files. An MalformedInputException is thrown in that case.

This fix catches that exception if it is thrown and, in that case, assumes that the file is a binary and copies it without filtering.

The included test will fail without the fix and pass with the fix

@cstamas
Copy link
Member

cstamas commented Feb 26, 2026

Am on edge here; why filter something is does not need filtering? Also, this can "hide" user mistake as well. I personally tend to keep resources split; those needing filtering in one spot and those not needed it in another.

@fridrich
Copy link
Author

You do as you want. I met a number of projects like that around. And I don't really think that it is harming to implement this kind of things, but you do as you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants