[Bug] Proxy ProducerProcessor throws IndexOutOfBoundsException for empty send message list
- Dominant language
- Java
- Stars
- 22.6k
- Forks
- 12k
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 27
Description
### Problem
`ProducerProcessor#sendMessage` reads the first message before validating the request payload:
```java
Message message = messageList.get(0);
```
`buildSendMessageRequestHeader` also reads `messageList.get(0)`. If an internal caller passes a null or empty message list, the method fails with a raw `NullPointerException` or `IndexOutOfBoundsException` instead of a controlled proxy error.
### Expected behavior
`sendMessage` should validate `messageList` before reading the first message and complete the returned future exceptionally with a `ProxyException` that has a clear message.
### Impact
Malformed send requests are harder to diagnose because they surface as generic collection exceptions rather than proxy-level validation failures.
### Suggested fix
- Add an early null/empty guard in `sendMessage`.
- Return a `ProxyException` with a clear message such as `message list is empty`.
- Add regression coverage for an empty message list.
Contributor guide
Research direction
Start with ProducerProcessor#sendMessage and buildSendMessageRequestHeader, focusing on their first access to messageList. Add regression coverage for a null or empty message list and verify that the returned future completes exceptionally with a ProxyException containing a clear message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design, distributed-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100