You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "ghostly72 (via GitHub)" <gi...@apache.org> on 2026/01/04 18:57:08 UTC

[PR] #11157: Throw early type mismatch for List deserialization [dubbo]

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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] #11157: Throw early type mismatch for List deserialization [dubbo]

Posted by "zrlw (via GitHub)" <gi...@apache.org>.
zrlw commented on PR #15963:
URL: https://github.com/apache/dubbo/pull/15963#issuecomment-3727273774

   this approach fundamentally conflicts with Dubbo’s design: Map is taken as generialized type for any java Object.


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] #11157: Throw early type mismatch for List deserialization [dubbo]

Posted by "zrlw (via GitHub)" <gi...@apache.org>.
zrlw closed pull request #15963:  #11157: Throw early type mismatch for List<T> deserialization
URL: https://github.com/apache/dubbo/pull/15963


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] #11157: Throw early type mismatch for List deserialization [dubbo]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #15963:
URL: https://github.com/apache/dubbo/pull/15963#issuecomment-3710890747

   ## [Codecov](https://app.codecov.io/gh/apache/dubbo/pull/15963?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `0%` with `5 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 32.19%. Comparing base ([`ac1621f`](https://app.codecov.io/gh/apache/dubbo/commit/ac1621f9a0470054c0308c47f84c7668f6bc2868?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`25a0c28`](https://app.codecov.io/gh/apache/dubbo/commit/25a0c288b0e9934e0f663203780a92abc1c83c1b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on 3.3.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/dubbo/pull/15963?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [.../java/org/apache/dubbo/common/utils/PojoUtils.java](https://app.codecov.io/gh/apache/dubbo/pull/15963?src=pr&el=tree&filepath=dubbo-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fdubbo%2Fcommon%2Futils%2FPojoUtils.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vdXRpbHMvUG9qb1V0aWxzLmphdmE=) | 0.00% | [5 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo/pull/15963?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   > :exclamation:  There is a different number of reports uploaded between BASE (ac1621f) and HEAD (25a0c28). Click for more details.
   > 
   > <details><summary>HEAD has 5 uploads less than BASE</summary>
   >
   >| Flag | BASE (ac1621f) | HEAD (25a0c28) |
   >|------|------|------|
   >|unit-tests-java17|1|0|
   >|unit-tests-java8|1|0|
   >|unit-tests-java25|1|0|
   >|unit-tests-java11|1|0|
   >|unit-tests-java21|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff              @@
   ##                3.3   #15963       +/-   ##
   =============================================
   - Coverage     58.78%   32.19%   -26.60%     
   - Complexity       15    10146    +10131     
   =============================================
     Files          1938     1941        +3     
     Lines         88698    88625       -73     
     Branches      13387    13283      -104     
   =============================================
   - Hits          52143    28531    -23612     
   - Misses        30901    55932    +25031     
   + Partials       5654     4162     -1492     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/dubbo/pull/15963/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [samples-tests-java21](https://app.codecov.io/gh/apache/dubbo/pull/15963/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `32.14% <0.00%> (?)` | |
   | [samples-tests-java8](https://app.codecov.io/gh/apache/dubbo/pull/15963/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `29.80% <0.00%> (?)` | |
   | [unit-tests-java11](https://app.codecov.io/gh/apache/dubbo/pull/15963/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit-tests-java17](https://app.codecov.io/gh/apache/dubbo/pull/15963/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit-tests-java21](https://app.codecov.io/gh/apache/dubbo/pull/15963/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit-tests-java25](https://app.codecov.io/gh/apache/dubbo/pull/15963/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit-tests-java8](https://app.codecov.io/gh/apache/dubbo/pull/15963/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/dubbo/pull/15963?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org