saravanakumar1987 opened a new pull request, #31395:
URL: https://github.com/apache/camel/pull/31395

   # Description
   
   Fixes [CAMEL-28120](https://issues.apache.org/jira/browse/CAMEL-28120).
   
   ## Summary
   
   For a URL or a Path body, putObject converts the body to a new stream. Only 
the upload of the body closed that stream, so a request that failed before the 
upload left it open. putObject now closes it in a finally block, also when the 
request fails.
   
   - `OSSProducer.putObject` closes the converted stream after the request, 
whether it succeeds or fails, as `AWS2S3Producer.processSingleOp` does.
   - It leaves the stream open when the message body is a `WrappedFile` whose 
body is that stream.
   
   ### Why some streams stay open
   
   With `streamDownload=true` of camel-ftp and stream caching off, the body of 
the file is the download stream. The conversion returns that stream, and 
`FtpOperations.releaseRetrievedFileResources` closes it when the exchange is 
done. A redelivery sends an InputStream body again, so its branch stays as it 
is.
   
   ## Tests
   
   - `convertedStreamIsClosedWhenTheRequestFails` checks that the producer 
closes the converted stream when the mocked client fails, and it failed before 
the change.
   - `streamOfAFileBodyIsLeftToTheConsumerOfTheFile` checks that the sent 
stream of a `GenericFile` body stays open, and it passed before the change too.
   - The module build of camel-alibaba-oss ran 39 tests, none of them skipped, 
with no failure.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] I ran `mvn clean install -Dquickly -DskipTests` on the parent commit, 
and resumed it from camel-kserve with `-Dgrpc-version=1.85.1`. Then I ran `mvn 
install -nsu` in camel-alibaba-oss, which changed no generated file.
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
   
   _Claude Code on behalf of saravanakumar1987_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to