apache / apache/shenyu

[BUG] TimerAfterPredicateJudge inconsistent with TimerBeforePredicateJudge on empty paramName

Open
#6,555 2 comments 0 reactions 1 assignee Claimed by @yykaue View on GitHub
plugin: divide priority: medium type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

## Description
`TimerBeforePredicateJudge` guards with `if (!StringUtils.hasLength(paramName))` (true for both `null` and `""`), falling back to `LocalDateTime.now()`. `TimerAfterPredicateJudge` guards with `if (Objects.isNull(paramName))` (true for `null` only). When `paramName` is an empty string (not null), `TimerAfter` skips the `now()` branch and calls `DateUtils.parseLocalDateTime(realData)`, where `realData` is built from the empty param name — throwing a date-parse exception.

## Location
```
shenyu-plugin-base/.../condition/judge/TimerAfterPredicateJudge.java:36
TimerBeforePredicateJudge.java:36
```

## Impact
A `TimerAfter` rule condition persisted with an empty-string `paramName` fails with an exception during request-time matching; the rule is effectively treated as not-matching, silently dropping traffic that should have been allowed after the configured time.

## Suggested fix
Make `TimerAfterPredicateJudge` use `if (!StringUtils.hasLength(paramName))` like `TimerBefore`.

## Related existing issue(s)
None

_Identified during the 2026-08-02 audit; full list in [`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.