gnodet-bot commented on code in PR #29495:
URL: https://github.com/apache/camel/pull/29495#discussion_r4514483104
##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MemoryTab.java:
##########
@@ -325,6 +334,16 @@ private void renderSparkline(Frame frame, Rect area,
IntegrationInfo info) {
}
}
+ if (axisW > 0) {
+ Style axis = Style.EMPTY.dim();
+ buf.setString(box.x(), inner.y(), top, axis);
+ if (chartH >= 5) {
+ String half = formatBytes(ceiling / 2);
+ buf.setString(box.x() + axisW - 1 - half.length(), inner.y() +
chartH / 2, half, axis);
Review Comment:
⚠️ **Negative X coordinate for 1G and 1M heap sizes.**
`formatBytes(ceiling)` for `1G` returns `"1G"` (2 chars → `axisW = 3`), but
`formatBytes(ceiling / 2)` returns `"512M"` (4 chars). The resulting X offset
`axisW - 1 - half.length() = 3 - 1 - 4 = -2` passes a negative column to
`buf.setString`, writing two columns before `box.x()`. Same problem for 1M (→
`"1M"` / `"512K"`). Guard the placement:
```suggestion
if (chartH >= 5) {
String half = formatBytes(ceiling / 2);
int halfX = box.x() + axisW - 1 - half.length();
if (halfX >= box.x()) {
buf.setString(halfX, inner.y() + chartH / 2, half, axis);
}
}
```
##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TimelineTab.java:
##########
@@ -853,6 +856,11 @@ static List<Line> stacked(List<long[]> series, List<Style>
styles, int rows, int
}
/** A sparkline of values (-1 is unknown, blank), relative to the highest.
*/
+ /** The height of the mean time sparkline: twice the average or the
slowest second, at least 10 ms. */
Review Comment:
⚠️ **Javadoc attached to wrong method.** In Java, only the last `/** */`
block before a declaration attaches to it. The original `spark()` Javadoc (line
858) is immediately followed by the new `meanScale()` Javadoc — so
`meanScale()` picks up the new Javadoc correctly, but `spark()` is now left
without documentation. Swap the two Javadocs so the existing `/** A sparkline
... */` comment sits directly before `spark()`:
```suggestion
/** The height of the mean time sparkline: twice the average or the
slowest second, at least 10 ms. */
```
(And move `/** A sparkline of values (-1 is unknown, blank), relative to the
highest. */` to the blank line immediately before `static String spark(...)`.)
--
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]