[jira] [Resolved] (TIKA-3197) TikaInputStream may not be closed

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (TIKA-3197) TikaInputStream may not be closed

Hudson (Jira)

     [ https://issues.apache.org/jira/browse/TIKA-3197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Lee resolved TIKA-3197.
-----------------------------
    Resolution: Not A Problem

> TikaInputStream may not be closed
> ---------------------------------
>
>                 Key: TIKA-3197
>                 URL: https://issues.apache.org/jira/browse/TIKA-3197
>             Project: Tika
>          Issue Type: Bug
>          Components: parser
>            Reporter: Peter Lee
>            Priority: Minor
>
> This is TikaInputStream's close method : 
> {code:java}
> public void close() throws IOException {
>     path = null;
>     mark = -1;
>     tmp.addResource(in);
>     tmp.close();
> }
> {code}
> It will clean the TemporaryResources and close the InputStream which we orginal get in parameter.
>  
> This is TikaInputStream's get method : 
> {code:java}
> public static TikaInputStream get(InputStream stream, TemporaryResources tmp) {
>     if (stream == null) {
>         throw new NullPointerException("The Stream must not be null");
>     }
>     if (stream instanceof TikaInputStream) {
>         return (TikaInputStream) stream;
>     } else {
>         // Make sure that the stream is buffered and that it
>         // (properly) supports the mark feature
>         if (!(stream.markSupported())) {
>             stream = new BufferedInputStream(stream);
>         }
>         return new TikaInputStream(stream, tmp, -1);
>     }
> }{code}
> If stream is not instance of TikaInputStream,  *it will create and return a new instance of TikaInputStream.* 
> And as you can see , *we will not close this new instance in close method in this case*. We will only close the  InputStream which we orginal get in parameter.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)