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

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

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


##########
tika-core/src/main/java/org/apache/tika/utils/ProcessUtils.java:
##########
@@ -442,4 +449,16 @@ public static boolean waitForWithHeartbeat(Process p, 
ParseContext context, long
         }
     }
 
+    private static Optional<FileProcessResult> failFastIfNoGrantedTimeout(long 
requestedTimeoutMillis, long grantedTimeoutMillis) {
+        if (grantedTimeoutMillis <= 0) {
+            FileProcessResult result = new FileProcessResult();
+            result.isTimeout = true;
+            result.requestedTimeoutMillis = requestedTimeoutMillis;
+            result.grantedTimeoutMillis = grantedTimeoutMillis;
+
+            return Optional.of(result);
+        }
+
+        return Optional.empty();
+    }

Review Comment:
   The new Javadoc includes `@param` tags without descriptions. Some builds 
enforce Javadoc completeness (e.g., via Checkstyle), and even when not enforced 
it reduces clarity. Add brief descriptions for both parameters (or remove the 
tags if not needed).





> ProcessUtils spawns and immediately kills a subprocess when time budget is 
> zero
> -------------------------------------------------------------------------------
>
>                 Key: TIKA-4886
>                 URL: https://issues.apache.org/jira/browse/TIKA-4886
>             Project: Tika
>          Issue Type: Bug
>          Components: core
>            Reporter: Tim Grein
>            Priority: Minor
>
> Currently ProcessUtils.execute starts a subprocess, even if 
> requestedTimeoutMillis is 0. TikaHttpClient on the other hand has a fail fast 
> path, where a timeout exception is thrown, if the granted timeout is <= 0.
> ProcessUtils.execute should probably also have a fail fast path similar to 
> the TikaHttpClient.



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

Reply via email to