[ 
https://issues.apache.org/jira/browse/CAMEL-5235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13265736#comment-13265736
 ] 

Babak Vahdat commented on CAMEL-5235:
-------------------------------------

{quote}
Maybe but dont you still have the the issue that the File input/output streams 
do not get closed when the InputStreamWriter/OutputStreamWriter gets closed.
{quote}

No as that's done for "free" through the close() method magic, that's the 
call-chaining of the close() call by the underlying input/output streams. As an 
example when we look at BufferedReader.close() method we see that the close() 
call get's chained and the underlying stream (hopefully) does properly chain 
the call again and again, until the OS native stream gets properly closed. 
*But* that's the user's responsibility to
do that:


{code}
BufferedReader myReader = 
CamelContext.getTypeConverter().convertTo(BufferedReader.class, ...);
…
…
myReader.close(); // user should close the stream properly after the usage
{code}

The main "problem" is that we can't control if the user do *properly* close the 
Reader, Writer, In and Outputstream after the usage. And if they don't, then 
they will run into trouble and think something in Camel could be the reason for 
that.
                
> Make sure to close file input stream when converting file to string to avoid 
> locking file on windows
> ----------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-5235
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5235
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.9.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.9.3, 2.10.0
>
>
> See nabble
> http://camel.465427.n5.nabble.com/File-Processor-Not-deleting-the-files-tp5670301.html
> Need to explicit close the file input/output streams to avoid the files to be 
> locked on windows.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to