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

   ## Summary
   
   - **Fix double download**: `SmbFile.getBody()` was bypassing the body 
already stored by `retrieveFile` and always re-downloading the file from the 
server. Now returns the binding body first, falling back to lazy fetch only 
when no body was stored (e.g., `pollEnrich`).
   - **Fix file handle leak**: For `streamDownload=true`, the smbj `File` 
handle was leaked because `FileInputStream.close()` does not close the 
underlying `File`. Introduced `SmbFileClosingInputStream` wrapper whose 
`close()` also closes the smbj `File` handle.
   - **Fix dead-on-arrival stream**: `retrieveFileToStreamInBody` was wrapping 
the smbj `File` in try-with-resources even for the stream download path, 
closing the handle before the stream was ever read. This was masked by the 
double download bug.
   
   ## Test plan
   
   - [ ] Existing SMB integration tests pass (stream download, local work 
directory, no-download)
   - [ ] Verify with server-side instrumentation that files are downloaded only 
once
   - [ ] Verify `streamDownload=true` does not leak SMB file handles after 
stream is consumed
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.ai/claude-code)
   
   Co-Authored-By: Claude Opus 4.6 <[email protected]>


-- 
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