This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit cc51f3385098ac928a21994a57e509c9461ce79a
Author: Guillaume Nodet <[email protected]>
AuthorDate: Sun Jun 7 07:07:26 2026 +0000

    Fix MinioTransporter implPut — close InputStream from task
    
    F-33: Wrap task.newInputStream() in try-with-resources so the stream
    is properly closed after Files.copy(), preventing resource leaks on
    both normal and error paths.
---
 .../java/org/eclipse/aether/transport/minio/MinioTransporter.java    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/maven-resolver-transport-minio/src/main/java/org/eclipse/aether/transport/minio/MinioTransporter.java
 
b/maven-resolver-transport-minio/src/main/java/org/eclipse/aether/transport/minio/MinioTransporter.java
index 980c51c8f..50fe59a44 100644
--- 
a/maven-resolver-transport-minio/src/main/java/org/eclipse/aether/transport/minio/MinioTransporter.java
+++ 
b/maven-resolver-transport-minio/src/main/java/org/eclipse/aether/transport/minio/MinioTransporter.java
@@ -175,8 +175,9 @@ final class MinioTransporter extends AbstractTransporter 
implements Transporter
         task.getListener().transportStarted(0, task.getDataLength());
         final Path dataFile = task.getDataPath();
         if (dataFile == null) {
-            try (PathProcessor.TempFile tempFile = 
pathProcessor.newTempFile()) {
-                Files.copy(task.newInputStream(), tempFile.getPath(), 
StandardCopyOption.REPLACE_EXISTING);
+            try (PathProcessor.TempFile tempFile = pathProcessor.newTempFile();
+                    InputStream inputStream = task.newInputStream()) {
+                Files.copy(inputStream, tempFile.getPath(), 
StandardCopyOption.REPLACE_EXISTING);
                 client.uploadObject(UploadObjectArgs.builder()
                         .bucket(objectName.getBucket())
                         .object(objectName.getName())

Reply via email to