cvictory opened a new pull request, #3314:
URL: https://github.com/apache/dubbo-go/pull/3314
## Bug
- **Symptom**: JSON-RPC server panics with nil pointer dereference when a
request targets an unregistered service path
- **Root cause**: `ExporterMap().Load(path)` in `serveRequest()` discards
the `ok` return value. When path is not registered, `exporter` is nil, and the
type assertion `exporter.(*JsonrpcExporter)` panics.
- **Issue**: #3310
## Fix
- Check the `ok` return value from `ExporterMap().Load(path)`
- When `!ok`, return `perrors.Errorf("service not found: %s", path)` instead
of proceeding to type-assert a nil value
## Verification
- **New test**: `TestHandlePkg_UnregisteredPath` — sends valid JSON-RPC
request to unregistered path, asserts HTTP 500 with "service not found" (no
panic)
- **Existing tests**: All 6 `TestHandlePkg_ContentType` sub-tests pass
- **Full package**: All 9 tests in `protocol/jsonrpc` pass
- **Static analysis**: `go vet ./protocol/jsonrpc/` passes
Closes #3310
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]