joaohmalves opened a new pull request, #16298: URL: https://github.com/apache/dubbo/pull/16298
Previously, passing a non-Serializable parameter to a Dubbo service resulted in a confusing error message. Now a clear IOException with the class name and 'must implement java.io.Serializable' is thrown at encode time in both request and response paths. Fixes #16293 ## What is the purpose of the change? This PR fixes a misleading error message when calling a Dubbo service with a parameter or return value that does not implement `java.io.Serializable`. Previously, the error was buried inside internal serialization layers and did not clearly indicate the root cause, making it hard to diagnose. Now a clear `IOException` containing the class name and `must implement java.io.Serializable` is thrown at encode time in both request and response paths. ### What is changed? - `DubboCodec.encodeRequestData()`: wraps `writeObject()` in a try/catch that intercepts the internal `IllegalArgumentException` and rethrows a clear `IOException` with the offending class name. - `DubboCodec.encodeResponseData()`: same treatment for the response path. - `DubboProtocolTest`: re-enabled `testNonSerializedParameter` and `testReturnNonSerialized` which were previously `@Disabled` because the expected behavior was not implemented. ### Verifying this change All tests in `dubbo-rpc-dubbo` module pass locally, including the two previously disabled tests that now validate the correct behavior. ## Checklist - [x] Make sure there is a [GitHub_issue](https://github.com/apache/dubbo/issues) field for the change. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit-test to verify your logic correction. If the new feature or significant change is committed, please remember to add sample in [dubbo samples](https://github.com/apache/dubbo-samples) project. - [x] Make sure gitHub actions can pass. [Why the workflow is failing and how to fix it?](../CONTRIBUTING.md) -- 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]
