lordrip opened a new pull request, #28624:
URL: https://github.com/apache/camel/pull/28624

   ## Summary
   
   Fixes https://issues.apache.org/jira/browse/CAMEL-26371
   
   Routes using local kamelets failed to start when `--runtime=camel-main` was 
combined with a comma-separated `--local-kamelet-dir` containing more than one 
path (regression since 4.23.0, introduced by commit `935f581a8a59` / 
CAMEL-24659).
   
   ## Root cause
   
   `ExportBaseCommand.copySourceFiles()` had two bugs in the 
`LOCAL_KAMELET_DIR` handling:
   
   1. **Scheme stripped from the entire comma-joined string** — `getScheme()` 
found the first `:` in the whole value and stripped the prefix from there. With 
`file:/path/a,file:/path/b` only the first `file:` was removed; subsequent 
entries kept their prefix and were passed as-is to `Paths.get()`.
   
   2. **`Paths.get()` called with the unsplit string** — the directory argument 
contained a literal comma and an unstripped `file:` prefix, producing a path 
that does not exist on disk.
   
   ## Fix
   
   Replace the single `localKameletDir` string with a `List<String>`, strip the 
scheme from each element individually, and search all directories in order when 
resolving the kamelet file (falling back to the first entry to preserve the 
existing error behaviour).
   
   No new imports — `List`, `ArrayList`, `Paths` and `Files` were already 
imported.
   
   ## Tests
   
   Added `ExportBaseCommandCopySourceFilesTest` with two cases:
   - `shouldCopyKameletFromSecondLocalKameletDir` — regression test: kamelet in 
the second directory of a two-dir value is copied correctly.
   - `shouldCopyKameletFromSingleLocalKameletDir` — sanity check: 
single-directory behaviour is unchanged.
   
   ---
   _Claude Code on behalf of lordrip_


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