Copilot commented on code in PR #2724:
URL: https://github.com/apache/tika/pull/2724#discussion_r3011762883


##########
tika-pipes/tika-pipes-plugins/tika-pipes-http/src/test/java/org/apache/tika/pipes/fetcher/http/HttpFetcherTest.java:
##########
@@ -213,7 +213,7 @@ public String getReasonPhrase() {
         headersMapFromConfig.put("fromFetchConfig2", 
List.of("fromFetchConfigValue2", "fromFetchConfigValue3"));
         
httpFetcher.getHttpFetcherConfig().getHttpRequestHeaders().setMap(headersMapFromConfig);
 
-        httpFetcher.fetch("http://localhost";, metadata, parseContext);
+        httpFetcher.fetch("http://localhost";, metadata, parseContext).close();

Review Comment:
   For consistency with the other tests in this class (e.g., 
`test2xxResponse`/`testJwt`), consider wrapping `httpFetcher.fetch(...)` in a 
try-with-resources block instead of calling `.close()` inline. This keeps 
resource cleanup explicit even if more assertions/logic are added later between 
open/close.
   ```suggestion
           try (InputStream ignored = httpFetcher.fetch("http://localhost";, 
metadata, parseContext)) {
               // resource is automatically closed after this block
           }
   ```



##########
tika-pipes/tika-pipes-plugins/tika-pipes-http/src/test/java/org/apache/tika/pipes/fetcher/http/HttpFetcherTest.java:
##########
@@ -234,7 +234,7 @@ public String getReasonPhrase() {
         Assertions.assertEquals("fromFetchConfigValue3", 
fromFetchConfig2s.get(1));
 
         metadata.set(Property.externalText("httpRequestHeaders"), new String[] 
{" nick1 :   val1", "nick2:   val2"});
-        httpFetcher.fetch("http://localhost";, metadata, parseContext);
+        httpFetcher.fetch("http://localhost";, metadata, parseContext).close();

Review Comment:
   Same as above: prefer try-with-resources around `httpFetcher.fetch(...)` 
rather than calling `.close()` directly, to align with the existing pattern in 
this test class and make cleanup resilient to future edits.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to