You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/11/14 07:55:42 UTC

(camel) branch main updated: camel-jbang - Fix bugs in debug command

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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new b7d481eb4ce camel-jbang - Fix bugs in debug command
b7d481eb4ce is described below

commit b7d481eb4ce8d5a29a782f187013c02129e44c74
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Nov 14 08:53:43 2023 +0100

    camel-jbang - Fix bugs in debug command
---
 .../java/org/apache/camel/dsl/jbang/core/commands/Debug.java     | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
index 4772f4fbca7..f5d788235e9 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
@@ -32,7 +32,6 @@ import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.camel.dsl.jbang.core.commands.action.MessageTableHelper;
 import org.apache.camel.main.KameletMain;
-import org.apache.camel.support.LoggerHelper;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.ReflectionHelper;
@@ -446,7 +445,7 @@ public class Debug extends Run {
     private void printSourceAndHistory(SuspendedRow row) {
         List<Panel> panel = new ArrayList<>();
         if (!row.code.isEmpty()) {
-            String loc = LoggerHelper.stripSourceLocationLineNumber(row.location);
+            String loc = StringHelper.beforeLast(row.location, ":", row.location);
             if (loc.length() < 72) {
                 loc = loc + " ".repeat(72 - loc.length());
             }
@@ -505,9 +504,11 @@ public class Debug extends Run {
             if (row.history.size() > (panel.size() - 4)) {
                 // cut to only what we can display
                 int pos = row.history.size() - (panel.size() - 4);
-                row.history = row.history.subList(pos, row.history.size());
+                if (row.history.size() > pos) {
+                    row.history = row.history.subList(pos, row.history.size());
+                }
             }
-            for (int i = 2; i < 11; i++) {
+            for (int i = 2; panel.size() > 2 && i < 11; i++) {
                 Panel p = panel.get(i);
                 if (row.history.size() > (i - 2)) {
                     History h = row.history.get(i - 2);