NIFI-3677 - ExtractMediaMetadata should close TikaInputStream

* Added finally block to close TikaInputStream.

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #1993.
This commit is contained in:
Joe Skora 2017-07-07 17:38:28 +00:00 committed by Pierre Villard
parent 58fc5f24b8
commit 325fe53fa1
1 changed files with 5 additions and 1 deletions

View File

@ -210,7 +210,11 @@ public class ExtractMediaMetadata extends AbstractProcessor {
Integer maxAttribLen) throws IOException, TikaException, SAXException {
final Metadata metadata = new Metadata();
final TikaInputStream tikaInputStream = TikaInputStream.get(sourceStream);
autoDetectParser.parse(tikaInputStream, new DefaultHandler(), metadata);
try {
autoDetectParser.parse(tikaInputStream, new DefaultHandler(), metadata);
} finally {
tikaInputStream.close();
}
final Map<String, String> results = new HashMap<>();
final Pattern metadataKeyFilter = metadataKeyFilterRef.get();