You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ti...@apache.org on 2026/03/30 20:23:51 UTC

(tika) branch main updated: [TIKA-4704] close input (#2724)

This is an automated email from the ASF dual-hosted git repository.

tilman pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/main by this push:
     new f19c8376f8 [TIKA-4704] close input (#2724)
f19c8376f8 is described below

commit f19c8376f852a913df0352f70f8b16a96ccc5ef3
Author: Tilman Hausherr <ti...@snafu.de>
AuthorDate: Mon Mar 30 22:23:45 2026 +0200

    [TIKA-4704] close input (#2724)
    
    * [TIKA-4704] close input
    
    * Update tika-pipes/tika-pipes-plugins/tika-pipes-http/src/test/java/org/apache/tika/pipes/fetcher/http/HttpFetcherTest.java
    
    Co-authored-by: Copilot <17...@users.noreply.github.com>
    
    * Refactor HttpFetcherTest to use try-with-resources
    
    ---------
    
    Co-authored-by: Copilot <17...@users.noreply.github.com>
---
 .../java/org/apache/tika/pipes/fetcher/http/HttpFetcherTest.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tika-pipes/tika-pipes-plugins/tika-pipes-http/src/test/java/org/apache/tika/pipes/fetcher/http/HttpFetcherTest.java b/tika-pipes/tika-pipes-plugins/tika-pipes-http/src/test/java/org/apache/tika/pipes/fetcher/http/HttpFetcherTest.java
index 24a7fd18fc..39a09efb3a 100644
--- a/tika-pipes/tika-pipes-plugins/tika-pipes-http/src/test/java/org/apache/tika/pipes/fetcher/http/HttpFetcherTest.java
+++ b/tika-pipes/tika-pipes-plugins/tika-pipes-http/src/test/java/org/apache/tika/pipes/fetcher/http/HttpFetcherTest.java
@@ -213,7 +213,8 @@ class HttpFetcherTest extends TikaTest {
         headersMapFromConfig.put("fromFetchConfig2", List.of("fromFetchConfigValue2", "fromFetchConfigValue3"));
         httpFetcher.getHttpFetcherConfig().getHttpRequestHeaders().setMap(headersMapFromConfig);
 
-        httpFetcher.fetch("http://localhost", metadata, parseContext);
+        try (InputStream ignored = httpFetcher.fetch("http://localhost", metadata, parseContext)) {
+        }
         HttpGet httpGet = httpGetArgumentCaptor.getValue();
         Assertions.assertEquals("fromFetchRequestValue1", httpGet.getHeaders("fromFetchRequestHeader1")[0].getValue());
         List<String> fromFetchRequestHeader2s = Arrays.stream(httpGet.getHeaders("fromFetchRequestHeader2"))
@@ -234,7 +235,8 @@ class HttpFetcherTest extends TikaTest {
         Assertions.assertEquals("fromFetchConfigValue3", fromFetchConfig2s.get(1));
 
         metadata.set(Property.externalText("httpRequestHeaders"), new String[] {" nick1 :   val1", "nick2:   val2"});
-        httpFetcher.fetch("http://localhost", metadata, parseContext);
+        try (InputStream ignored = httpFetcher.fetch("http://localhost", metadata, parseContext)) {
+        }
         httpGet = httpGetArgumentCaptor.getValue();
         Assertions.assertEquals("val1", httpGet.getHeaders("nick1")[0].getValue());
         Assertions.assertEquals("val2", httpGet.getHeaders("nick2")[0].getValue());