Claus Ibsen created CAMEL-26223:
-----------------------------------

             Summary: camel-ibm-watson-speech-to-text - a File body is opened 
as a stream that Camel never closes
                 Key: CAMEL-26223
                 URL: https://issues.apache.org/jira/browse/CAMEL-26223
             Project: Camel
          Issue Type: Bug
          Components: camel-ai
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of ibm-watson-speech-to-text 
(CAMEL-24961, PR #28402).

h4. 1. A File body's stream is not closed

{{WatsonSpeechToTextProducer.recognize}} (main 2a465aa4814c, line 110) first 
tries {{getBody(InputStream.class)}}, which for a {{File}} body opens a 
{{FileInputStream}} through the type converter. {{ownStream}} stays false, so 
the {{File}} branch that sets it (lines 112-115) never runs and the {{finally}} 
block (line 165) does not close the stream: one open file handle per message 
until garbage collection. Checked on 4.24.0-SNAPSHOT with a JDK HttpServer stub.

Proposed: check for a {{File}} / {{Path}} / {{WrappedFile}} body first and open 
(and close) the stream itself, or close any stream it got by conversion.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to