davsclaus commented on code in PR #26627:
URL: https://github.com/apache/camel/pull/26627#discussion_r4056827558
##########
core/camel-support/src/main/java/org/apache/camel/support/MessageHelper.java:
##########
@@ -1109,6 +1110,17 @@ public static JsonObject dumpAsJSonObject(
jb.put("size", size);
}
}
+ if (!jb.containsKey("size") && message.getExchange() != null &&
message.getExchange().getContext() != null) {
+ // the size of a text or byte body, from the message size
strategy when it is enabled (the dev
+ // profile does): lengths only, nothing is read or converted
(CAMEL-24844)
+ MessageSizeStrategy sizeStrategy =
message.getExchange().getContext().getMessageSizeStrategy();
+ if (sizeStrategy != null && sizeStrategy.isEnabled()) {
+ long size = sizeStrategy.computeBodySize(message);
+ if (size >= 0) {
Review Comment:
Applied in 6e65292cc0f0, with one difference from the suggestion: the guard
is on the body being null, not on the size being zero, so an empty text or byte
array keeps its `size: 0` (a real fact) while a null body gets no size at all.
The test asserts both: no size for null, 0 for an empty string. Same rule as in
#26626's history entries.
##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HistoryTab.java:
##########
@@ -1388,7 +1388,7 @@ private void renderTraceStepDetail(Frame frame, Rect
area, List<TraceEntry> step
headersChanged, prev != null ? prev.headers : null);
}
if (showTraceBody) {
- addBodyLines(lines, entry.body, entry.bodyType, bodyChanged);
+ addBodyLines(lines, entry.body, entry.bodyType, entry.bodySize,
bodyChanged);
Review Comment:
Both paths in 6e65292cc0f0: the diagram info panel carries a bodySize local
from either entry type and renders the same `(type, size)` detail, and the
error detail calls the five-argument addBodyLines with the entry's size.
--
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]