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

Jukka Zitting resolved TIKA-567.
--------------------------------

    Resolution: Fixed

I've added a TemporaryFiles class that can be used with TikaInputStream when 
the close() method is not called:

    TemporaryFiles tmp = new TemporaryFiles();
    try {
        TikaInputStream stream = TikaInputStream.get(..., tmp);
        // process stream but don't close it
    } finally {
        tmp.dispose();
    }

This makes sure that any temporary files created by TikaInputStream are 
correctly removed when no longer used.

This construct is not needed in cases where you know that the close() method 
will be called on the TikaInputStream instance.

I also modified all existing Tika code to use this new construct where 
appropriate. Now a "mvn clean install" or another test run leaves no temporary 
files behind. Resolving as fixed.

> Temporary file leak in TikaInputStream
> --------------------------------------
>
>                 Key: TIKA-567
>                 URL: https://issues.apache.org/jira/browse/TIKA-567
>             Project: Tika
>          Issue Type: Bug
>          Components: general
>    Affects Versions: 0.8
>            Reporter: Jukka Zitting
>            Assignee: Jukka Zitting
>             Fix For: 0.9
>
>
> The TikaInputStream.get(InputStream) method can end up leaking temporary 
> files in cases like the Detector classes that will not close the returned 
> stream.
> There should be a mechanism to signal that a potential TikaInputStream 
> wrapper will no longer be used even if the underlying stream should not be 
> closed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to