[BUG] SofaProxyService casts null RPC result placeholder to GenericObject
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
- severity: Medium
- files: `shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/proxy/SofaProxyService.java:95-113`
- description: When `ret` is null, the code sets `result = Constants.SOFA_RPC_RESULT_EMPTY` (a `String`), then immediately does `GenericObject genericObject = (GenericObject) result;`. Casting the placeholder `String` to `GenericObject` throws `ClassCastException` → `ShenyuException` 500.
- impact: Any sofa RPC method that returns null yields a 500 instead of an empty success response.
- suggested_fix: Only cast to `GenericObject` when `result` is non-null and actually a `GenericObject`.
- confidence: High
- related_existing: none
---
_Identified during the 2026-08-02 deep re-scan; full list in [`docs/scan2-2026-08-02/06-medium-tiers.md`](docs/scan2-2026-08-02/06-medium-tiers.md)._
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/proxy/SofaProxyService.java:95-113 and trace the null `ret` branch. Verify that a null SOFA RPC result no longer causes a `GenericObject` cast failure, and that the request produces an empty success response instead of a 500.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100