Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 26, 2025

Fixes #118. When using InputStreamTransformer with files exceeding the 5MB threshold, DeferredFileOutputStream creates temp files in /tmp but was never closed after writing. On Linux/macOS, subsequent reads fail with FileNotFoundException because the file isn't fully flushed to disk.

Changes

  • PlexusIoFileResource.asDeferredStream(): Close dfos after copying transformed content to ensure temp file is flushed
  • Deferred constructor: Close dfos after copying to ensure temp file is accessible for subsequent reads
  • PlexusIoFileResourceDeferredTest: Add tests covering multiple reads, large files (>5MB threshold), and small files (<5MB)

The existing cleanup logic (deleting temp file on InputStream close) remains unchanged.

Original prompt

This section details on the original issue you should resolve

<issue_title>plexus-io:3.3.0 error: tmp/maven-metadata-local.xml3261144141794286831.tmp (No such file or directory)</issue_title>
<issue_description>I upgrade plexus-io from 3.2.0 to 3.3.0 because of the CVE issue, and get error as:
[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.2.7:kar (create-kar) on project testRoute-feature: Failed to create archive: Problem creating jar: Execution exception: java.io.FileNotFoundException: /tmp/maven-metadata-local.xml11604840448228358901.tmp (No such file or directory) -> [Help 1]
How to reproduce?
extract testRoute.zip,
execute in testRoute folder.
mvn -X -B package -llr -Dmaven.test.skip=true -Dmaven.main.skip=true

Note. This error only happens in Linux/mac os. details error see
mvn.log
</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix plexus-io 3.3.0 error related to missing metadata file Close DeferredFileOutputStream to prevent FileNotFoundException on temp files Oct 26, 2025
Copilot AI requested a review from slachiewicz October 26, 2025 07:37
Copilot finished work on behalf of slachiewicz October 26, 2025 07:37
@slachiewicz
Copy link
Member

@copilot use try with resources to close streams always

@slachiewicz slachiewicz merged commit 9632ee1 into master Oct 26, 2025
15 checks passed
@slachiewicz slachiewicz deleted the copilot/fix-plexus-io-330-error branch October 26, 2025 12:46
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.

plexus-io:3.3.0 error: tmp/maven-metadata-local.xml3261144141794286831.tmp (No such file or directory)

2 participants