strings parser should not leave behind temp file.
@@ -30,6 +30,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.apache.tika.exception.TikaException;
+import org.apache.tika.io.TemporaryResources;
import org.apache.tika.io.TikaInputStream;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.mime.MediaType;
@@ -87,7 +88,9 @@ public class StringsParser extends AbstractParser {
return;
}
- TikaInputStream tis = TikaInputStream.get(stream);
+ TemporaryResources tmp = new TemporaryResources();
+ TikaInputStream tis = TikaInputStream.get(stream, tmp);
+ try {
File input = tis.getFile();
// Metadata
@@ -108,6 +111,9 @@ public class StringsParser extends AbstractParser {
// Metadata
metadata.set("strings:length", "" + totalBytes);
+ } finally {
+ tmp.close();
+ }
}
/**
