NaraSky opened a new pull request, #15740:
URL: https://github.com/apache/dubbo/pull/15740

   ## What does this PR do?
   Fixes the inconsistency between the default implementations of 
`ObjectOutput.writeEvent` and `ObjectInput.readEvent` in Dubbo's serialization 
layer. The original `writeEvent` used `writeObject(data)`, which mismatched 
`readEvent`'s `readUTF()`, leading to `IndexOutOfBoundsException` in components 
like `dubbo-serialization-fury`.
   
   ## Changes
   - Modify `writeEvent(Object data)` in `DefaultObjectOutput` to use 
`writeUTF((String) data)` instead of `writeObject(data)`.
   - This ensures symmetry with `readEvent()` in `DefaultObjectInput`, 
restoring normal functionality for affected serialization components.
   
   ## How to test
   1. Clone the branch and run `mvn clean test` to verify all tests pass.
   2. Reproduce the issue: Use a service with `dubbo-serialization-fury` 
enabled; invoke a method emitting an event—previously threw 
`IndexOutOfBoundsException`.
   3. After fix: The event serializes/deserializes correctly without exceptions.
   - Added/Updated unit test: `TestDefaultObjectOutput#testWriteEvent` (covers 
edge cases like empty strings and special chars).
   
   ## Related Issue
   Fixes #15737
   
   ## Checklist
   - [x] Code follows [Dubbo code 
style](https://github.com/apache/dubbo/blob/master/dubbo_codestyle_for_idea.xml).
   - [x] Tests added/updated and pass locally.
   - [x] Rebased on upstream/master (no conflicts).
   - [ ] (Optional) Signed off by CLA if first contribution.
   
   Thanks for reviewing! 🚀


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

Reply via email to