You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "jvrubel (via GitHub)" <gi...@apache.org> on 2026/09/02 12:13:57 UTC
[PR] [LAUNCHER] Fix nested jar url handling [camel]
jvrubel opened a new pull request, #26039:
URL: https://github.com/apache/camel/pull/26039
Fix LauncherHelper to handle Spring Boot 3.x jar:nested: URL scheme
Problem
The productized camel-launcher-4.22.0.redhat-00010 is packaged as a Spring Boot 3.x executable fat JAR (Main-Class: org.springframework.boot.loader.launch.JarLauncher). Spring
Boot 3.x uses a jar:nested: URL scheme for code source locations of classes loaded from nested library JARs:
` jar:nested:/path/to/camel-launcher-4.22.0.redhat-00010.jar/!BOOT-INF/lib/camel-jbang-core-4.22.0.redhat-00003.jar!/`
`LauncherHelper.getLauncherJarPath()` only handled jar:file: (Spring Boot 2.x / Maven Shade) and file: URL schemes. When it received a jar:nested: URL, it returned null.
This caused `isRunningFromLauncher()` to return false, so `getCamelCommand()` fell back to ["camel"] — a command that does not exist when running from the fat JAR. Any operation
that spawned a background process (e.g. camel run <file> --background) failed with:
`java.io.IOException: Cannot run program "camel": error=2, No such file or directory`
This produced 52 test failures across all test cases exercising --background mode in the camel/launcher-it CI job.
Fix
Add a jar:nested: case to `getLauncherJarPath()`, before the existing jar:file: handler. The outer JAR path is extracted by splitting on /! (the separator between the outer JAR
and the nested path):
`if (urlStr.startsWith("jar:nested:")) {
String path = urlStr.substring("jar:nested:".length());
int idx = path.indexOf("/!");
if (idx > 0) {
return URLDecoder.decode(path.substring(0, idx), StandardCharsets.UTF_8);
}
}`
For the URL above, this correctly extracts /path/to/camel-launcher-4.22.0.redhat-00010.jar, causing `getCamelCommand()` to return ["java", "-jar",
"/path/to/camel-launcher-4.22.0.redhat-00010.jar"].
Magic number offsets in the existing jar:file: and file: branches were also replaced with named-length constants for readability.
Verification
Replicated the failure locally by running `java -jar camel-launcher-4.22.0.redhat-00010.jar run route.java --background` with camel removed from PATH. Confirmed the identical
Cannot run program "camel" error. Applied the fix and verified `getLauncherJarPath()` returns the correct outer JAR path from the jar:nested: URL.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LAUNCHER] Fix nested jar url handling [camel]
Posted by "Croway (via GitHub)" <gi...@apache.org>.
Croway commented on PR #26039:
URL: https://github.com/apache/camel/pull/26039#issuecomment-5509675580
Follow-up after a deeper pass with a probe run inside the built `camel-launcher-4.23.0-SNAPSHOT.jar` (Spring Boot loader 4.1.1). A few of the points in my review turn out to be more serious than I framed them, plus two new ones.
**Point 1 is a functional bug, not just duplication.** Inside the fat jar the main class's code source is `jar:nested:/.../camel-launcher.jar/!BOOT-INF/classes/!/`, so `CamelLauncher.detectJarPath()` returns `null` and `camel.launcher.jar` is never set. `InstallDetector.locate()` then returns `UNKNOWN`, which means `camel self-update` exits with "unable to determine how the Camel CLI was installed" and `UpdateChecker` never announces new releases. The self-update feature introduced in 4.22.0 stays broken after this PR unless the main class is fixed too.
Related: the description's diagnosis is slightly off. `camel.launcher=true` *is* set by `CamelLauncher.main`, so `isRunningFromLauncher()` was already true; the fallback to `camel` happened because `getLauncherJarPath()` returned `null` inside `getCamelCommand()`.
**The Windows path is a regression, not a nit.** The new branch returns `/C:/Users/me/.../camel-launcher.jar` and `getCamelCommand()` hands that verbatim to `java -jar`, which the native launcher rejects with `Error: Unable to access jarfile /C:/...`. Before this PR, Windows users who also had JBang fell back to a working `camel.cmd`; after it, `run --background`, `infra run --background` and every TUI launch fail for them. Decoding through the URI API fixes both this and the `+` issue in one go, e.g.
```java
Path.of(URI.create("file:" + path.substring(0, idx))).toString()
```
and the same should be applied to the `jar:file:` / `file:` branches. `BasePackageScanResolver` in camel-support documents this exact `URLDecoder` pitfall and uses `new URI(...).getPath()` for that reason.
**JVM options are dropped on spawn.** Now that the `java -jar <launcher>` branch is reachable for the first time, background and TUI children are started as bare `<java.home>/bin/java -jar camel-launcher.jar ...` with no `-X`/`-D` forwarding. The wrapper scripts (`camel.sh`, `camel.bat`) apply `JAVA_OPTS` to the foreground process, and it is a documented contract in the 4.22 upgrade guide, so a user with proxy or truststore settings in `JAVA_OPTS` gets a foreground run that works and a background run that cannot download dependencies. Consider spawning through the wrapper script when present, or forwarding `JAVA_OPTS` / the relevant parent system properties.
**Silent fallback masks failures.** When `camel.launcher=true` but the jar path cannot be resolved, `getCamelCommand()` falls through to whichever `camel` is first on PATH, possibly a different version or an old JBang shim. That is how this regression went unnoticed, and the next loader URL-shape change would be masked the same way. Logging a warning that includes the raw code-source URL (or failing) in that case would be a cheap safeguard.
**Minor:** `isRunningFromLauncher()` matches `contains("camel-launcher")` against the whole absolute path, and this PR makes that branch reachable for any Spring Boot 3.2+/4.x app that embeds camel-jbang-core. Matching on the file name would avoid false positives such as `~/projects/camel-launcher-poc/target/myapp.jar`.
A table test on an extracted `parseJarPath(String)` covering `jar:nested:` (both `BOOT-INF/classes` and `BOOT-INF/lib` forms), `jar:file:`, `file:`, `%20`, `+` and `/C:/` inputs would have caught the decoding and Windows issues.
---
_Claude Code on behalf of Croway_
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LAUNCHER] Fix nested jar url handling [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #26039:
URL: https://github.com/apache/camel/pull/26039#discussion_r3922189745
##########
dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/LauncherHelperTest.java:
##########
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.jbang.core.common;
+
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class LauncherHelperTest {
+
+ // jar:nested: — Spring Boot 3.2+/4.x loader
+
+ @Test
+ void parsesNestedJarUrlOnLinux() {
+ String result = LauncherHelper.parseJarPath(
+ "jar:nested:/home/user/camel-launcher-4.23.0.jar!/BOOT-INF/lib/camel-jbang-core.jar!/");
Review Comment:
This input uses `!/` after the outer jar, but a real Spring Boot nested URL uses `/!` as the outer-jar boundary. With `!/`, `parseJarPath` finds no `/!`, returns `null`, and this test fails.
```suggestion
"jar:nested:/home/user/camel-launcher-4.23.0.jar/!BOOT-INF/lib/camel-jbang-core.jar!/");
```
##########
dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/LauncherHelperTest.java:
##########
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.jbang.core.common;
+
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class LauncherHelperTest {
+
+ // jar:nested: — Spring Boot 3.2+/4.x loader
+
+ @Test
+ void parsesNestedJarUrlOnLinux() {
+ String result = LauncherHelper.parseJarPath(
+ "jar:nested:/home/user/camel-launcher-4.23.0.jar!/BOOT-INF/lib/camel-jbang-core.jar!/");
+ assertThat(result).isEqualTo("/home/user/camel-launcher-4.23.0.jar");
+ }
+
+ @Test
+ void parsesNestedJarUrlWithPercentEncodedSpaces() {
+ String result = LauncherHelper.parseJarPath(
+ "jar:nested:/home/user/my%20app/camel-launcher.jar!/BOOT-INF/lib/camel-jbang-core.jar!/");
Review Comment:
Same issue — outer-jar boundary must be `/!`, not `!/`.
```suggestion
"jar:nested:/home/user/my%20app/camel-launcher.jar/!BOOT-INF/lib/camel-jbang-core.jar!/");
```
##########
dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/LauncherHelperTest.java:
##########
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.jbang.core.common;
+
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class LauncherHelperTest {
+
+ // jar:nested: — Spring Boot 3.2+/4.x loader
+
+ @Test
+ void parsesNestedJarUrlOnLinux() {
+ String result = LauncherHelper.parseJarPath(
+ "jar:nested:/home/user/camel-launcher-4.23.0.jar!/BOOT-INF/lib/camel-jbang-core.jar!/");
+ assertThat(result).isEqualTo("/home/user/camel-launcher-4.23.0.jar");
+ }
+
+ @Test
+ void parsesNestedJarUrlWithPercentEncodedSpaces() {
+ String result = LauncherHelper.parseJarPath(
+ "jar:nested:/home/user/my%20app/camel-launcher.jar!/BOOT-INF/lib/camel-jbang-core.jar!/");
+ assertThat(result).isEqualTo("/home/user/my app/camel-launcher.jar");
+ }
+
+ @Test
+ void parsesNestedJarUrlOnWindows() {
+ // Windows code-source URLs embed the drive letter as /C:/... — the result must not carry the leading slash
+ String result = LauncherHelper.parseJarPath(
+ "jar:nested:/C:/Users/user/camel-launcher-4.23.0.jar!/BOOT-INF/lib/camel-jbang-core.jar!/");
Review Comment:
Same issue — outer-jar boundary must be `/!`, not `!/`.
```suggestion
"jar:nested:/C:/Users/user/camel-launcher-4.23.0.jar/!BOOT-INF/lib/camel-jbang-core.jar!/");
```
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LAUNCHER] Fix nested jar url handling [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26039:
URL: https://github.com/apache/camel/pull/26039#issuecomment-5525460054
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `dsl/camel-jbang/camel-jbang-core`
- `dsl/camel-jbang/camel-launcher`
---
<details><summary>:microscope: Scalpel shadow comparison — Scalpel: 8 tested, 7 compile-only — current: 6 all tested</summary>
[Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **15 affected modules** (current approach: 6).
<details><summary>:warning: Modules only in Scalpel (9)</summary>
- `camel-jbang-core`
- `camel-jbang-it`
- `camel-jbang-main`
- `camel-jbang-plugin-edit`
- `camel-jbang-plugin-generate`
- `camel-jbang-plugin-kubernetes`
- `camel-jbang-plugin-test`
- `camel-launcher`
- `coverage`
</details>
**Skip-tests mode would test 8 modules** (2 direct + 6 downstream), **skip tests for 7** (generated code, meta-modules)
<details><summary>Modules Scalpel would test (8)</summary>
- `camel-jbang-core`
- `camel-jbang-mcp`
- `camel-jbang-plugin-mcp`
- `camel-jbang-plugin-route-parser`
- `camel-jbang-plugin-tui`
- `camel-jbang-plugin-validate`
- `camel-launcher`
- `camel-launcher-container`
</details>
<details><summary>Modules with tests skipped (7)</summary>
- `camel-jbang-it`
- `camel-jbang-main`
- `camel-jbang-plugin-edit`
- `camel-jbang-plugin-generate`
- `camel-jbang-plugin-kubernetes`
- `camel-jbang-plugin-test`
- `coverage`
</details>
> :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
</details>
:warning: **Some tests are disabled on GitHub Actions** (`@DisabledIfSystemProperty(named = "ci.env.name")`) and require manual verification:
- `dsl/camel-jbang/camel-jbang-core`: 1 test(s) disabled on GitHub Actions
:bulb: **Manual integration tests recommended:**
> You modified `dsl/camel-jbang/camel-jbang-core`, `dsl/camel-jbang/camel-launcher`. The related integration tests in `dsl/camel-jbang/camel-jbang-it` are excluded from CI. Consider running them manually:
> ```
> mvn verify -f dsl/camel-jbang/camel-jbang-it -Djbang-it-test
> ```
<details><summary>All tested modules (15 modules)</summary>
- Camel :: Coverage
- Camel :: JBang :: Core
- Camel :: JBang :: Integration tests
- Camel :: JBang :: MCP
- Camel :: JBang :: Main
- Camel :: JBang :: Plugin :: Edit
- Camel :: JBang :: Plugin :: Generate
- Camel :: JBang :: Plugin :: Kubernetes
- Camel :: JBang :: Plugin :: MCP
- Camel :: JBang :: Plugin :: Route Parser
- Camel :: JBang :: Plugin :: TUI
- Camel :: JBang :: Plugin :: Testing
- Camel :: JBang :: Plugin :: Validate
- Camel :: Launcher
- Camel :: Launcher :: Container
</details>
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/33746981212)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LAUNCHER] Fix nested jar url handling [camel]
Posted by "Croway (via GitHub)" <gi...@apache.org>.
Croway commented on PR #26039:
URL: https://github.com/apache/camel/pull/26039#issuecomment-5510929033
> Thanks for the comments and the analysis, Fede. So the plan is:
>
> 1. Drop `CamelLauncher.detectJarPath()`, call `LauncherHelper.getLauncherJarPath()` instead
> 2. Use `Path.of(URI.create(...))` to normalize Windows paths in all three URL branches
> 3. Tighten `isRunningFromLauncher()` to check filename only
> 4. Extract `parseJarPath(String)` as package-private + add unit tests
> 5. Forward JVM args in `getCamelCommand()`
> 6. Log warning with raw URL on fallback
>
> +Fixed the PR description Sounds good?
yes, sounds reasonable
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LAUNCHER] Fix nested jar url handling [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26039:
URL: https://github.com/apache/camel/pull/26039#issuecomment-5524594781
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
* You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
:warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LAUNCHER] Fix nested jar url handling [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26039:
URL: https://github.com/apache/camel/pull/26039#issuecomment-5524743167
<!-- regen-patch -->
### :warning: Generated files are out of date
The [CI build](https://github.com/apache/camel/actions/runs/33742851977) regenerated files that are not committed on this PR.
The missing changes are available as the `regen-patch` artifact of that run.
Anyone with push access to this branch (the PR author, or a committer when
*Allow edits from maintainers* is enabled) can apply and push them:
```bash
gh pr checkout 26039 --repo apache/camel
gh run download 33742851977 --repo apache/camel -n regen-patch
git apply --index regen.patch && rm regen.patch pr-number
git commit -m "Regen" && git push
```
Alternatively, run `./etc/scripts/regen.sh` locally and commit the resulting changes.
If the patch does not apply cleanly, update the branch from the base branch first —
the patch was generated against the merge with the base branch.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LAUNCHER] Fix nested jar url handling [camel]
Posted by "jvrubel (via GitHub)" <gi...@apache.org>.
jvrubel commented on PR #26039:
URL: https://github.com/apache/camel/pull/26039#issuecomment-5524160887
Thank you for the reviews @Croway and @davsclaus. I have modified the PR to address your points, validated the tests (bar Windows) and cleaned up the config files.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LAUNCHER] Fix nested jar url handling [camel]
Posted by "jvrubel (via GitHub)" <gi...@apache.org>.
jvrubel commented on PR #26039:
URL: https://github.com/apache/camel/pull/26039#issuecomment-5510102939
Thanks for the comments and the analysis, Fede. So the plan is:
1) Drop `CamelLauncher.detectJarPath()`, call `LauncherHelper.getLauncherJarPath()` instead
2) Use `Path.of(URI.create(...))` to normalize Windows paths in all three URL branches
3) Tighten `isRunningFromLauncher()` to check filename only
4) Extract `parseJarPath(String)` as package-private + add unit tests
5) Forward JVM args in `getCamelCommand()`
6) Log warning with raw URL on fallback
+Fixed the PR description
Sounds good?
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LAUNCHER] Fix nested jar url handling [camel]
Posted by "jvrubel (via GitHub)" <gi...@apache.org>.
jvrubel commented on code in PR #26039:
URL: https://github.com/apache/camel/pull/26039#discussion_r3923450372
##########
dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/LauncherHelperTest.java:
##########
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.jbang.core.common;
+
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class LauncherHelperTest {
+
+ // jar:nested: — Spring Boot 3.2+/4.x loader
+
+ @Test
+ void parsesNestedJarUrlOnLinux() {
+ String result = LauncherHelper.parseJarPath(
+ "jar:nested:/home/user/camel-launcher-4.23.0.jar!/BOOT-INF/lib/camel-jbang-core.jar!/");
+ assertThat(result).isEqualTo("/home/user/camel-launcher-4.23.0.jar");
+ }
+
+ @Test
+ void parsesNestedJarUrlWithPercentEncodedSpaces() {
+ String result = LauncherHelper.parseJarPath(
+ "jar:nested:/home/user/my%20app/camel-launcher.jar!/BOOT-INF/lib/camel-jbang-core.jar!/");
+ assertThat(result).isEqualTo("/home/user/my app/camel-launcher.jar");
+ }
+
+ @Test
+ void parsesNestedJarUrlOnWindows() {
+ // Windows code-source URLs embed the drive letter as /C:/... — the result must not carry the leading slash
+ String result = LauncherHelper.parseJarPath(
+ "jar:nested:/C:/Users/user/camel-launcher-4.23.0.jar!/BOOT-INF/lib/camel-jbang-core.jar!/");
Review Comment:
Modified
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LAUNCHER] Fix nested jar url handling [camel]
Posted by "jvrubel (via GitHub)" <gi...@apache.org>.
jvrubel commented on PR #26039:
URL: https://github.com/apache/camel/pull/26039#issuecomment-5513679575
Addressed the points in the following way:
1. `CamelLauncher.detectJarPath()` dropped — `CamelLauncher.java` now calls `LauncherHelper.getLauncherJarPath()` directly and uses the shared property constants, eliminating the
duplicated parsing logic that was missing jar:nested: support.
2. Windows path regression fixed — All three URL branches in `LauncherHelper.parseJarPath()` now use `Paths.get(URI.create(...))` instead of `URLDecoder.decode`. This correctly
converts `/C:/Users/..`. to `C:\Users\...` on Windows, and also avoids the +→space bug from URLDecoder.
3. `isRunningFromLauncher()` false positive fixed — Now checks `Path.of(jarPath).getFileName().toString().startsWith("camel-launcher")` instead of
`jarPath.contains("camel-launcher")`.
4. Unit tests added — LauncherHelperTest covers all three URL forms plus edge cases (percent-encoded spaces, Windows drive letters, unknown schemes, missing /! boundary).
5. JVM args forwarded on spawn — `getCamelCommand()` now inserts `ManagementFactory.getRuntimeMXBean().getInputArguments()` between java and -jar, so child processes inherit proxy
settings, truststores, etc.
6. Warning on null fallback — When the launcher is detected but the JAR path can't be resolved, `getCamelCommand()` now logs a warning including the raw code-source URL before
falling back to camel.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LAUNCHER] Fix nested jar url handling [camel]
Posted by "Croway (via GitHub)" <gi...@apache.org>.
Croway merged PR #26039:
URL: https://github.com/apache/camel/pull/26039
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LAUNCHER] Fix nested jar url handling [camel]
Posted by "jvrubel (via GitHub)" <gi...@apache.org>.
jvrubel commented on code in PR #26039:
URL: https://github.com/apache/camel/pull/26039#discussion_r3923448176
##########
dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/LauncherHelperTest.java:
##########
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.jbang.core.common;
+
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class LauncherHelperTest {
+
+ // jar:nested: — Spring Boot 3.2+/4.x loader
+
+ @Test
+ void parsesNestedJarUrlOnLinux() {
+ String result = LauncherHelper.parseJarPath(
+ "jar:nested:/home/user/camel-launcher-4.23.0.jar!/BOOT-INF/lib/camel-jbang-core.jar!/");
Review Comment:
Modified
##########
dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/LauncherHelperTest.java:
##########
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.jbang.core.common;
+
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class LauncherHelperTest {
+
+ // jar:nested: — Spring Boot 3.2+/4.x loader
+
+ @Test
+ void parsesNestedJarUrlOnLinux() {
+ String result = LauncherHelper.parseJarPath(
+ "jar:nested:/home/user/camel-launcher-4.23.0.jar!/BOOT-INF/lib/camel-jbang-core.jar!/");
+ assertThat(result).isEqualTo("/home/user/camel-launcher-4.23.0.jar");
+ }
+
+ @Test
+ void parsesNestedJarUrlWithPercentEncodedSpaces() {
+ String result = LauncherHelper.parseJarPath(
+ "jar:nested:/home/user/my%20app/camel-launcher.jar!/BOOT-INF/lib/camel-jbang-core.jar!/");
Review Comment:
Modified
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LAUNCHER] Fix nested jar url handling [camel]
Posted by "Croway (via GitHub)" <gi...@apache.org>.
Croway commented on PR #26039:
URL: https://github.com/apache/camel/pull/26039#issuecomment-5523177900
Two more things on top of @davsclaus' review, both in `LauncherHelperTest`:
**1. `parsesNestedJarUrlOnWindows` will fail on Linux/macOS CI even after the `/!` fix.** `Paths.get(URI)` only strips the leading slash on Windows; on a Unix host `file:/C:/Users/...` resolves to `/C:/Users/user/camel-launcher-4.23.0.jar`, so `doesNotStartWith("/C:")` fails (verified on macOS). Guard the strict assertion with `@EnabledOnOs(OS.WINDOWS)` and keep a platform-neutral check (e.g. `endsWith("camel-launcher-4.23.0.jar")`) for the other OSes.
**2. The Javadoc on `parseJarPath` and the inline comment in the `jar:nested:` branch still show the wrong form** (`jar:nested:/outer.jar!/...`); the suggestion commits only fix the test strings. Should be `jar:nested:/outer.jar/!BOOT-INF/lib/inner.jar!/`.
Minor: `Path.of` and `Paths.get` are mixed in the same class; pick one.
_Claude Code on behalf of Croway_
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org