gnodet-bot commented on code in PR #27966:
URL: https://github.com/apache/camel/pull/27966#discussion_r4298169312


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/RestartProcess.java:
##########
@@ -179,7 +179,8 @@ static List<String> parseCommandLine(String commandLine) {
             if (escaped) {
                 current.append(c);
                 escaped = false;
-            } else if (c == '\\') {
+            } else if (c == '\\' && i + 1 < commandLine.length() && 
commandLine.charAt(i + 1) == '"') {

Review Comment:
   💡 **Note (inherent ambiguity):** This fix correctly handles the common case 
(backslashes in Windows paths like `"C:\\Program Files\\Java\\bin\\java.exe"`), 
but there is a known remaining edge case: a quoted token that ends with a 
literal backslash immediately before the closing quote (e.g. 
`"\\server\\share\\"`) will misparse — the `\\"` at the end is 
indistinguishable from an escaped-quote sequence, so the closing `"` will be 
consumed as a literal character rather than ending the token.
   
   This is an inherent ambiguity in Windows command-line quoting that cannot be 
fully resolved without a richer parsing strategy. If you want to document this, 
a brief comment here (or in the method Javadoc) noting the known limitation 
would be helpful for future maintainers. No action required — the fix is 
correct for all realistic inputs.



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