Skip to content

[Bug] Proxy delay level parsing should tolerate extra whitespace #10808

Description

@Aias00

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.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions