This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch tui-ollama-tab
in repository https://gitbox.apache.org/repos/asf/camel.git

commit f9e59142a0bceb739370db258dee28ba2fa1a8b7
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Sep 17 12:37:33 2026 +0200

    camel-jbang-tui: F1 help files load under the camel launcher
    
    DocHelper read tui/help/*.md through the classloader of a camel-jbang-core
    class. The camel launcher loads plugin jars in a child URLClassLoader with
    core in the parent, so the parent could not see the plugin's resources and
    every tab's F1 help came back null (no F1 hint in the footer, F1 did 
nothing)
    even though the files are in the jar. Resolve from this plugin's own class
    first, like Theme does for its stylesheets, with the context classloader and
    the core loader as fallbacks for a flat classpath.
    
    Co-Authored-By: Claude Fable 5.1 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../dsl/jbang/core/commands/tui/DocHelper.java     | 32 ++++++++++++++++++----
 1 file changed, 27 insertions(+), 5 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DocHelper.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DocHelper.java
index 2e1c92174b78..73a1425c6888 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DocHelper.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DocHelper.java
@@ -51,15 +51,37 @@ final class DocHelper {
         return cached;
     }
 
+    /**
+     * Reads a resource of this plugin. Under the {@code camel} launcher the 
plugin jar lives in its own classloader
+     * with camel-jbang-core in the parent, so the lookup must start from a 
class of this jar; the context classloader
+     * and the core's loader are fallbacks for other setups (tests, a flat 
classpath).
+     */
     static String loadResourceContent(String resourcePath) {
-        try (InputStream is = 
ExampleHelper.class.getClassLoader().getResourceAsStream(resourcePath)) {
-            if (is != null) {
-                return new String(is.readAllBytes(), StandardCharsets.UTF_8);
+        InputStream is = null;
+        ClassLoader own = DocHelper.class.getClassLoader();
+        if (own != null) {
+            is = own.getResourceAsStream(resourcePath);
+        }
+        if (is == null) {
+            ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+            if (tccl != null) {
+                is = tccl.getResourceAsStream(resourcePath);
+            }
+        }
+        if (is == null) {
+            ClassLoader core = ExampleHelper.class.getClassLoader();
+            if (core != null) {
+                is = core.getResourceAsStream(resourcePath);
             }
+        }
+        if (is == null) {
+            return null;
+        }
+        try (InputStream in = is) {
+            return new String(in.readAllBytes(), StandardCharsets.UTF_8);
         } catch (IOException e) {
-            // ignore
+            return null;
         }
-        return null;
     }
 
     static String downloadContent(String url) {

Reply via email to