This is an automated email from the ASF dual-hosted git repository. tallison pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tika.git
commit 2528d468a73f29293ab069e7feef181ff53ea9d3 Author: tballison <talli...@apache.org> AuthorDate: Thu Nov 17 16:32:04 2022 -0500 CompositePipesReporter needs to close resources --- .../apache/tika/pipes/CompositePipesReporter.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tika-core/src/main/java/org/apache/tika/pipes/CompositePipesReporter.java b/tika-core/src/main/java/org/apache/tika/pipes/CompositePipesReporter.java index 4f78b6be8..dfce28bb7 100644 --- a/tika-core/src/main/java/org/apache/tika/pipes/CompositePipesReporter.java +++ b/tika-core/src/main/java/org/apache/tika/pipes/CompositePipesReporter.java @@ -16,6 +16,7 @@ */ package org.apache.tika.pipes; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -76,4 +77,25 @@ public class CompositePipesReporter extends PipesReporter implements Initializab throw new TikaConfigException("must specify at least one pipes reporter"); } } + + /** + * Tries to close all resources. Throws the last encountered IOException + * if any are thrown by the component reporters. + * + * @throws IOException + */ + @Override + public void close() throws IOException { + IOException ex = null; + for (PipesReporter pipesReporter : pipesReporters) { + try { + pipesReporter.close(); + } catch (IOException e) { + ex = e; + } + } + if (ex != null) { + throw ex; + } + } }