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


##########
tika-pipes/tika-pipes-fork-parser/src/main/java/org/apache/tika/pipes/fork/PipesForkParser.java:
##########
@@ -409,11 +411,15 @@ private ConfigMerger.MergeResult createTikaConfigFile() 
throws IOException {
                 // Use null ID to trigger UUID generation
                 .addFetcher(null, "file-system-fetcher",
                         Map.of("allowAbsolutePaths", true))
-                // Set pipes configuration
+                // Set pipes configuration. socketTimeoutMillis/javaPath only 
when set in
+                // code (TIKA-4931): writing the default would clobber a user 
config's value.
                 .setPipesConfig(
                         pc.getNumClients(),
                         pc.getMaxFilesProcessedPerProcess(),
-                        pc.getForkedJvmArgs())
+                        pc.getForkedJvmArgs(),
+                        pc.getSocketTimeoutMillis() == 
PipesConfig.DEFAULT_SOCKET_TIMEOUT_MILLIS
+                                ? -1 : pc.getSocketTimeoutMillis(),
+                        DEFAULT_JAVA_PATH.equals(pc.getJavaPath()) ? null : 
pc.getJavaPath())

Review Comment:
   Comparing against the default value cannot tell whether the caller 
explicitly set these values. With a user config containing `javaPath: 
"/file/java"` (or a non-default socket timeout), calling `setJavaPath("java")` 
(or explicitly setting the default 60000 timeout through `getPipesConfig()`) is 
silently discarded, so the fork still uses the user-configured value. Track 
whether each setter was invoked and pass that override state to `ConfigMerger`, 
rather than using the value as the signal.



-- 
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