apache / apache/dubbo

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

Open
#11,157 6 comments 0 reactions 0 assignees View on GitHub
help wanted type/bug
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

- [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.

### Environment

* Dubbo version: 2.7.3
* Operating System version: xxx
* Java version: xxx

### Steps to reproduce this issue

1. 编写request

public class xxxxxxRequest implements Serializable {
private static final long serialVersionUID = 1L;
private List ids;
}
泛化调用
"request": {
"ids": [1]
}
2. ![image](https://user-images.githubusercontent.com/26264536/207911883-73482c62-9987-45c7-98fe-5875de59ad90.png)
4. ![image](https://user-images.githubusercontent.com/26264536/207912387-a73c4ab2-480c-4062-ab7b-1aeb920b6a6f.png)

Pls. provide [GitHub address] to reproduce this issue.

### Expected Behavior
正确的抛出类型转换错误而不是在调用for循环的时候抛类型转换错误

### Actual Behavior

If there is an exception, please attach the exception trace:

```
Just put your stack trace here!
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the generic invocation with a request whose ids field is List but whose input contains the integer 1. Trace where deserialization or type conversion occurs before the for loop; done means the type-conversion error is raised at the correct boundary rather than during iteration.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.