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 2022/10/24 08:11:39 UTC

[camel] branch main updated (72faa4301b9 -> 176626de00d)

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

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


    from 72faa4301b9 Sync deps
     new 1e720577f56 CAMEL-18640: camel-console - Stacktraces in json response should be as array
     new 176626de00d CAMEL-18640: camel-console - Stacktraces in json response should be as array

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/camel/impl/console/HealthDevConsole.java | 12 ++++++++----
 .../camel/support/processor/DefaultExchangeFormatter.java    |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)


[camel] 02/02: CAMEL-18640: camel-console - Stacktraces in json response should be as array

Posted by da...@apache.org.
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

commit 176626de00d144b77b9f4d0fb3b1942b72427b1e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Oct 24 10:10:23 2022 +0200

    CAMEL-18640: camel-console - Stacktraces in json response should be as array
---
 .../main/java/org/apache/camel/impl/console/HealthDevConsole.java  | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/core/camel-console/src/main/java/org/apache/camel/impl/console/HealthDevConsole.java b/core/camel-console/src/main/java/org/apache/camel/impl/console/HealthDevConsole.java
index 791d8c7186f..b8a6ec95f13 100644
--- a/core/camel-console/src/main/java/org/apache/camel/impl/console/HealthDevConsole.java
+++ b/core/camel-console/src/main/java/org/apache/camel/impl/console/HealthDevConsole.java
@@ -19,6 +19,7 @@ package org.apache.camel.impl.console;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Map;
 import java.util.stream.Stream;
 
@@ -109,11 +110,13 @@ public class HealthDevConsole extends AbstractDevConsole {
 
                 Throwable cause = res.getError().orElse(null);
                 if (cause != null) {
+                    JsonArray arr2 = new JsonArray();
                     StringWriter writer = new StringWriter();
                     cause.printStackTrace(new PrintWriter(writer));
                     writer.flush();
-                    String stacktrace = writer.toString();
-                    jo.put("stacktrace", stacktrace);
+                    String trace = writer.toString();
+                    jo.put("stackTrace", arr2);
+                    Collections.addAll(arr2, trace.split("\n"));
                 }
             }
 


[camel] 01/02: CAMEL-18640: camel-console - Stacktraces in json response should be as array

Posted by da...@apache.org.
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

commit 1e720577f568985f3c003e8ca2c9d26c4d855b7f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Oct 24 06:21:45 2022 +0200

    CAMEL-18640: camel-console - Stacktraces in json response should be as array
---
 .../java/org/apache/camel/impl/console/HealthDevConsole.java     | 9 +++++----
 .../apache/camel/support/processor/DefaultExchangeFormatter.java | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/core/camel-console/src/main/java/org/apache/camel/impl/console/HealthDevConsole.java b/core/camel-console/src/main/java/org/apache/camel/impl/console/HealthDevConsole.java
index 727f86360b7..791d8c7186f 100644
--- a/core/camel-console/src/main/java/org/apache/camel/impl/console/HealthDevConsole.java
+++ b/core/camel-console/src/main/java/org/apache/camel/impl/console/HealthDevConsole.java
@@ -109,10 +109,11 @@ public class HealthDevConsole extends AbstractDevConsole {
 
                 Throwable cause = res.getError().orElse(null);
                 if (cause != null) {
-                    StringWriter sw = new StringWriter();
-                    PrintWriter pw = new PrintWriter(sw);
-                    cause.printStackTrace(pw);
-                    jo.put("stacktrace", pw.toString());
+                    StringWriter writer = new StringWriter();
+                    cause.printStackTrace(new PrintWriter(writer));
+                    writer.flush();
+                    String stacktrace = writer.toString();
+                    jo.put("stacktrace", stacktrace);
                 }
             }
 
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/processor/DefaultExchangeFormatter.java b/core/camel-support/src/main/java/org/apache/camel/support/processor/DefaultExchangeFormatter.java
index 7d42ae6ab67..ceea457b93c 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/processor/DefaultExchangeFormatter.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/processor/DefaultExchangeFormatter.java
@@ -197,7 +197,7 @@ public class DefaultExchangeFormatter implements ExchangeFormatter {
                 if (showAll || showStackTrace) {
                     StringWriter sw = new StringWriter();
                     exception.printStackTrace(new PrintWriter(sw));
-                    style(sb, "StackTrace").append(sw.toString());
+                    style(sb, "StackTrace").append(sw);
                 }
             }
         }