[Bug] Proxy delay level parsing should tolerate extra whitespace
- Dominant language
- Java
- Stars
- 22.6k
- Forks
- 12k
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 27
Description
### Problem
`ProxyConfig.parseDelayLevel()` parses `messageDelayLevel` with `split(" ")`. If the configuration contains leading spaces, repeated spaces, tabs, or line breaks, the parser emits empty or combined tokens, throws, and leaves `delayLevelTable` partially populated or empty.
```java
String[] levelArray = levelString.split(" ");
for (int i = 0; i < levelArray.length; i++) {
String value = levelArray[i];
...
}
```
`messageDelayLevel` is a user-facing configuration and should tolerate ordinary whitespace formatting, especially in config files.
### Impact
Malformed whitespace can make delayed-message level computation incomplete in Proxy. In the worst case, a blank/whitespace-only value leaves the table empty and later `computeDelayLevel()` can fail when reading the last level.
### Expected behavior
Proxy should trim the config and split by `\s+`, ignore blank input safely, and keep valid delay levels when the same values are formatted with extra whitespace.
### Code evidence
- `proxy/src/main/java/org/apache/rocketmq/proxy/config/ProxyConfig.java`
### Suggested fix
Use whitespace-normalized parsing in `parseDelayLevel()` and add `ProxyConfig` tests for repeated whitespace / blank input.
Contributor guide
Research direction
Start with proxy/src/main/java/org/apache/rocketmq/proxy/config/ProxyConfig.java and inspect parseDelayLevel() and its callers. Add ProxyConfig tests covering repeated whitespace and blank input, then verify that valid delay levels remain complete and blank input is handled safely.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100