unbridled-41 opened a new pull request, #5424:
URL: https://github.com/apache/rocketmq-dashboard/pull/5424
## Problem / Evidence
`GET /api/dlq/export-excel` returns HTTP 502 for the entire group when any
single dead-letter message has a decoded body longer than 32,767 characters,
instead of producing a workbook.
- `instance/dlq/DLQMessageExcelRow.java:70` copied the full body into the
`Body` cell.
- `provider/apache/RocketMQDLQProvider.java:404` puts the whole decoded body
into the VO (`toUtf8Text(message.getBody())`), and `:357-366` wraps any write
failure as `throw new BusinessException(502, "Failed to export DLQ messages as
Excel: ...")`.
- EasyExcel 3.3.4 → POI 4.1.2 rejects cell text beyond
`SpreadsheetVersion.getMaxTextLength()`. Reproduced in a unit test:
```
WARN RocketMQDLQProvider -- Failed to build Excel export for group group-a:
The maximum length of cell contents (text) is 32767 characters
BusinessException: Failed to export DLQ messages as Excel: The maximum
length of cell contents (text) is 32767 characters
```
RocketMQ allows message bodies far larger than one spreadsheet cell, so a
single unlucky dead letter makes the whole group's export unusable.
## Root cause / Fix
The `Body` cell was written unbounded while every other cell is naturally
short. Clamp it to the spreadsheet limit with a visible `...[truncated]`
marker, backing off one character when the cut would land between a surrogate
pair so the cell never contains an unpaired half.
## Priority & scoring
PRIORITY 57 = 影响 20 (the export of a whole group fails, and the operator
cannot tell which message caused it) + 波及 6 (DLQ Excel export endpoint) + 可复现
20 (deterministic for a body over 32,767 chars) + 维护价值 11 (restores the
documented export contract).
FIX_CONFIDENCE 92: bounded clamp in one row mapper, with the exact POI
failure reproduced before the fix and the neighbouring row asserted intact
after.
## Tests
```
cd server && mvn -o test -Dtest=RocketMQDLQProviderTest
```
- Red before the fix: the new test errors with `BusinessException: Failed to
export DLQ messages as Excel: The maximum length of cell contents (text) is
32767 characters`.
- Green after: `Tests run: 46, Failures: 0, Errors: 0, Skipped: 0` (also
`-Dtest='org.apache.rocketmq.studio.instance.dlq.*Test'` → 44 passed).
- The regression test drives a real EasyExcel workbook read back and asserts
the oversized cell is clamped, ends with the marker, contains no unpaired
surrogate, and that the following row still exports its body intact.
- `mvn -o checkstyle:check` passes.
## Risk
Low. Only the `Body` cell content changes, and only when it exceeds a limit
that previously aborted the request. Exported bodies that fit are
byte-identical.
--
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]