You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "elharo (via GitHub)" <gi...@apache.org> on 2026/07/03 14:00:53 UTC

[I] Inverted filter logic in EarMojo.isNonFilteredExtension() causes filtering to apply to wrong files [maven-ear-plugin]

elharo opened a new issue, #511:
URL: https://github.com/apache/maven-ear-plugin/issues/511

   ## Description
   
   In `EarMojo.java:642-644`, the `isNonFilteredExtension()` method has a double-negation bug:
   
   ```java
   public boolean isNonFilteredExtension(String fileName) {
       return !mavenResourcesFiltering.filteredFileExtension(fileName, nonFilteredFileExtensions);
   }
   ```
   
   `MavenResourcesFiltering.filteredFileExtension()` returns `true` when the file extension *is in the non-filtered list* (meaning the file should **not** be filtered). The `!` inverts this, so the method returns `false` for non-filtered files and `true` for files that should be filtered.
   
   At `EarMojo.java:622`:
   ```java
   if (filtering && !isNonFilteredExtension(source.getName())) {
   ```
   
   The double negation means:
   - Files with non-filtered extensions (e.g., `.xml`) enter the filter branch and get incorrectly modified
   - Files without non-filtered extensions skip filtering when they should be filtered
   
   ## Expected behavior
   
   Remove the `!` negation:
   
   ```java
   public boolean isNonFilteredExtension(String fileName) {
       return mavenResourcesFiltering.filteredFileExtension(fileName, nonFilteredFileExtensions);
   }
   ```


-- 
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: issues-unsubscribe@maven.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Inverted filter logic in EarMojo.isNonFilteredExtension() causes filtering to apply to wrong files [maven-ear-plugin]

Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on issue #511:
URL: https://github.com/apache/maven-ear-plugin/issues/511#issuecomment-4877114411

   After further analysis, this is **not a bug**. The `!` negation is correct.
   
   `MavenResourcesFiltering.filteredFileExtension()` returns:
   - `true` when the extension is **NOT** in the non-filtered list (file should be filtered)
   - `false` when the extension **IS** in the non-filtered list (file should NOT be filtered)
   
   So in `EarMojo.isNonFilteredExtension()`:
   ```java
   return !mavenResourcesFiltering.filteredFileExtension(fileName, nonFilteredFileExtensions);
   ```
   
   - If extension IS in non-filtered list → `filteredFileExtension` returns `false` → `!false` = `true` → correct
   - If extension is NOT in non-filtered list → `filteredFileExtension` returns `true` → `!true` = `false` → correct
   
   The existing integration test `testProject047` confirms this works correctly (`.txt` files in `nonFilteredFileExtensions` are not filtered).
   
   Closing as not a bug.


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Inverted filter logic in EarMojo.isNonFilteredExtension() causes filtering to apply to wrong files [maven-ear-plugin]

Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo closed issue #511: Inverted filter logic in EarMojo.isNonFilteredExtension() causes filtering to apply to wrong files
URL: https://github.com/apache/maven-ear-plugin/issues/511


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org