Skip to content

Fix Log4j2PluginsCacheFileTransformer not working for merging Log4j2Plugins.dat files#1955

Merged
Goooler merged 3 commits into8.xfrom
copilot/port-1175-plugin-groovy
Mar 3, 2026
Merged

Fix Log4j2PluginsCacheFileTransformer not working for merging Log4j2Plugins.dat files#1955
Goooler merged 3 commits into8.xfrom
copilot/port-1175-plugin-groovy

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

Ports the Log4j2PluginsCacheFileTransformer fixes from #1175 to the Groovy plugin branch.

Transformer fixes (Log4j2PluginsCacheFileTransformer.groovy)

  • canTransformResource: Use element.relativePath.pathString instead of element.name — prevents false matches on .dat files with the same name in unrelated paths
  • hasTransformedResource: Simplify to !temporaryFiles.isEmpty() — old logic incorrectly returned false for single-file transforms without relocators
  • modifyOutputStream: Wrap in try/finally so temp files are always cleaned up
  • deleteTempFiles(): New helper that removes files from both the list and filesystem (vs. just clear())
  • relocatePlugins: Made package-accessible for testing
  • Updated Javadoc to reference upstream Apache source

Test updates (Log4j2PluginsCacheFileTransformerSpec.groovy)

  • Extend TransformerSpecSupport to get getFileElement() helper
  • Add canTransformResource test asserting full-path matching semantics
  • Replace should not transformer / should transform with transformAndModifyOutputStream covering the full pipeline
  • Add relocations parameterized test (matching and non-matching pattern cases)

  • CHANGELOG's "Unreleased" section has been updated, if applicable.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • scans-in.gradle.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -Xmx4g -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: Goooler <10363352+Goooler@users.noreply.github.com>
Copilot AI changed the title [WIP] Port feature for plugin written in Groovy to branch 1175 Port Log4j2PluginsCacheFileTransformer fixes (#1175) to Groovy branch Mar 3, 2026
@Goooler Goooler marked this pull request as ready for review March 3, 2026 11:53
Add a fix for Log4j2PluginsCacheFileTransformer issue.
@Goooler Goooler changed the title Port Log4j2PluginsCacheFileTransformer fixes (#1175) to Groovy branch Fix Log4j2PluginsCacheFileTransformer not working for merging Log4j2Plugins.dat files Mar 3, 2026
@Goooler Goooler enabled auto-merge (squash) March 3, 2026 11:57
@Goooler Goooler merged commit 9f1d458 into 8.x Mar 3, 2026
7 checks passed
@Goooler Goooler deleted the copilot/port-1175-plugin-groovy branch March 3, 2026 11:58
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