harshkha3417 opened a new pull request, #7689:
URL: https://github.com/apache/shenyu/pull/7689

   ### What is the purpose of the change
   Fixes #6741.
   
   When a rule handle is not yet synchronized or has no configuration, 
`RULE_CACHED_HANDLE.get().obtainHandle(rule.getId())` returns `null`. This 
causes:
   1. `ApacheDubboPlugin.doDubboInvoker` to throw `NullPointerException` when 
calling `dubboRuleHandle.getTimeout()`.
   2. `ApacheDubboGrayLoadBalance.select` to throw `NullPointerException` when 
calling `dubboRuleHandle.getLoadBalance()`.
   
   ### Brief changelog
   - Guard against null `dubboRuleHandle` in `ApacheDubboPlugin.doDubboInvoker` 
before checking timeout.
   - Safely resolve the load balance algorithm in 
`ApacheDubboGrayLoadBalance.select` with a fallback to 
`LoadBalanceEnum.RANDOM.getName()` if `dubboRuleHandle` is absent.
   - Add unit test coverage in `ApacheDubboPluginTest` and 
`ApacheDubboGrayLoadBalanceTest` verifying both paths when `DubboRuleHandle` is 
absent.
   
   ### Verifying this change
   - Checked with `./mvnw checkstyle:check -pl 
shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo`
 (0 violations).
   - Ran all module unit tests via `./mvnw test -pl 
shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo
 -am` (all 55 tests passed).


-- 
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]

Reply via email to