davsclaus opened a new pull request, #27980: URL: https://github.com/apache/camel/pull/27980
Found while testing `camel cmd receive` for [CAMEL-23688](https://issues.apache.org/jira/browse/CAMEL-23688). ### The bug `ReceiveDevConsole` takes the timestamps of the first and the last message of a dump (`messages.get(0)`, `messages.get(size - 1)`) without checking that there is a message. A dump with nothing received yet, or nothing since the last dump (the messages are removed on dump by default), fails with `IndexOutOfBoundsException: Index 0 out of bounds for length 0`, in both the text and the JSON output. The CLI connector of an integration dumps the console all the time while receiving is on, so this failed (and was swallowed) on every look without a new message, and a dump through the HTTP dev console (`/q/dev/receive?dump=true`) failed instead of answering an empty list. ### The fix The timestamps are taken only when the dump has messages; the dump of nothing is `[]` (text) and `"messages": []` (JSON). The other dev consoles that dump (browse, trace, event) already check for an empty list. ### Test `ReceiveDevConsoleTest.testDumpWithoutMessages`: a started console with nothing received dumps an empty list, as text and JSON. Without the fix it fails with the `IndexOutOfBoundsException`. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DDRLJAyf8cDXSg8iX785My -- 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]
