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

   ## What is the purpose of the change?
   
   
   ## 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
   
   #11157
   
   During generic invocation deserialization, when a request field is declared 
as a List<String> but the incoming payload contains numeric elements (e.g., 
[1]), Dubbo incorrectly realizes it as List<Integer>. This causes a late 
ClassCastException when iterating over the list inside user code. 
PojoUtils.realize() ignored the generic parameter when deserializing Collection 
fields. As a result, it always converted elements as Object instead of using 
the declared element type from ParameterizedType.
   
   Fix proposed: 
   -Added an else block to correct generic element type from ParameterizedType 
and realize elements using that type
   -Throw an early IllegalArgumentException if type conversion fails (instead 
of deferring it to user code)
   - Also added a test case testRealizeListGenericElementType() in 
PojoUtilsTest.java to verify that invalid element types trigger an early 
exception.
   
   


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