Commit 2626e28
Fix misleading NPE when request parameter is not Serializable (#16299)
* Fix misleading NPE when request parameter is not Serializable
When a Dubbo service is called with non-serializable parameters, the
invocation deserialization fails silently and `path` becomes null. This
null path is then passed to GroupServiceKeyCache which uses a
ConcurrentHashMap that does not accept null keys, resulting in a
confusing NullPointerException.
Added a null check for `path` in DubboProtocol.getInvoker() to throw
a clear RemotingException with a meaningful message pointing users to
the actual cause (non-serializable parameters).
Fixes #16293
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Make null path error message generic to avoid misleading diagnosis
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent b16c837 commit 2626e28
2 files changed
Lines changed: 27 additions & 0 deletions
File tree
- dubbo-rpc/dubbo-rpc-dubbo/src
- main/java/org/apache/dubbo/rpc/protocol/dubbo
- test/java/org/apache/dubbo/rpc/protocol/dubbo
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
293 | 302 | | |
294 | 303 | | |
295 | 304 | | |
| |||
dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
| |||
281 | 284 | | |
282 | 285 | | |
283 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
284 | 302 | | |
285 | 303 | | |
286 | 304 | | |
| |||
0 commit comments