oscerd opened a new pull request, #25737: URL: https://github.com/apache/camel/pull/25737
# CAMEL-24488: close the audio FileInputStream in the Watson STT producer `WatsonSpeechToTextProducer.recognize()` opens a `FileInputStream` for the audio input — from the `CamelIbmWatsonSttAudioFile` header (a `File`) or from a `File` message body — but never closes it. There is no `try`/`finally` or try-with-resources around `stt.recognize(options).execute()`, so on every File-based invocation (and on any exception during recognition) the file descriptor is leaked. ## Fix Track an `ownStream` flag, set to `true` only for the two producer-opened `FileInputStream` cases, and close the stream via `IOHelper.close` in a `finally` block around the recognition. When the audio is supplied as an exchange-body `InputStream`, the caller owns it, so it is deliberately left untouched. ## Testing The module ships only integration tests (they require live Watson credentials); this is a resource-lifecycle fix around an SDK call that cannot be unit-tested without new mocking dependencies. Verified with a module build (`BUILD SUCCESS`, no generated-file drift). --- _Claude Code on behalf of oscerd_ -- 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]
