[ 
https://issues.apache.org/jira/browse/TIKA-4704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18069702#comment-18069702
 ] 

ASF GitHub Bot commented on TIKA-4704:
--------------------------------------

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.





> Avoid remaining temp files
> --------------------------
>
>                 Key: TIKA-4704
>                 URL: https://issues.apache.org/jira/browse/TIKA-4704
>             Project: Tika
>          Issue Type: Task
>    Affects Versions: 3.3.0
>            Reporter: Tilman Hausherr
>            Priority: Minor
>             Fix For: 4.0.0, 3.3.1
>
>         Attachments: screenshot-1.png
>
>
> This is my temp directory after a successful build of tika 3. We should try 
> to lessen this.
>  !screenshot-1.png! 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to