Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] dubbo RequestBody list Deserialization failure #14466

Closed
4 tasks done
smalltalkhyb opened this issue Jul 23, 2024 · 2 comments
Closed
4 tasks done

[Bug] dubbo RequestBody list Deserialization failure #14466

smalltalkhyb opened this issue Jul 23, 2024 · 2 comments
Assignees

Comments

@smalltalkhyb
Copy link

Pre-check

  • I am sure that all the content I provide is in English.

Search before asking

  • I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

JDK 17 <dubbo3.version>3.3.0-beta.4</dubbo3.version>

Steps to reproduce this issue

scene

we use triple protocol

send request like :

curl --location 'http://127.0.0.1:8080/oss/batchSyncFileInfo' \ --header 'x-mse-tag: xingzhihe' \ --header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \ --header 'Content-Type: application/json' \ --data '[{ "platform": 2, "fileName": "ocr-1721699518782.png", "directoryId": "62871482305351680", "uniqueFileName": "E0FC312A-C065-4F5A-86CB-85DBA6A9AC26-1721699520039_.ocr-1721699518782.png", "ossFileKey": "temp/E0FC312A-C065-4F5A-86CB-85DBA6A9AC26-1721699520039_.ocr-1721699518782.png", "fileSize": 3 }]'

but result error:

org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.util.ArrayList<?>] to type [@org.springframework.web.bind.annotation.RequestBody @jakarta.validation.Valid java.util.List<cn.itbox.uap.sys.setting.application.model.OssSyncFileInfoRequest>] for value '[{platform=2, fileName=ocr-1721699518782.png, directoryId=62871482305351680, uniqueFileName=E0FC312A-C065-4F5A-86CB-85DBA6A9AC26-1721699520039_.ocr-1721699518782.png, ossFileKey=temp/E0FC312A-C065-4F5A-86CB-85DBA6A9AC26-1721699520039_.ocr-1721699518782.png, fileSize=3}]'

code


 @PostMapping(value = "/oss/batchSyncFileInfo")
    List<OssSyncFileInfoResponse> batchSyncFileInfo(@RequestBody @Valid List<OssSyncFileInfoRequest> list) throws IOException;


    @Override
    public List<OssSyncFileInfoResponse> batchSyncFileInfo(@RequestBody @Valid List<OssSyncFileInfoRequest> list) throws IOException {
        List<OssSyncFileInfoResponse> result = new ArrayList<>();
        for (OssSyncFileInfoRequest fileInfo : list) {
            result.add(this.syncFileInfo(fileInfo));
        }
        return result;
    }

OssSyncFileInfoRequest is defined

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class OssSyncFileInfoRequest implements Serializable {

    /**
     * 原始文件名
     */
    @NotBlank(message = "fileName 不能为空")
    private String fileName;
    /**
     * 文件唯一名
     */
    @NotBlank(message = "uniqueFileName 不能为空")
    private String uniqueFileName;

    /**
     * oss的文件唯一标识
     */
    @NotBlank(message = "ossFileKey 不能为空")
    private String ossFileKey;

    /**
     * 从基础平台获取的目录id
     */
    @NotNull(message = "directoryId 不能为空")
    private Long directoryId;

    /**
     * 文件大小
     */
    @NotNull(message = "fileSize 不能为空")
    @Positive(message = "fileSize 超出范围")
    private Long fileSize;

    /**
     * 哪个平台上传的 1.B端,2ios,3安卓
     */
    @Range(min = 1, max = 3, message = "platform 超出范围")
    private Integer platform;


    /**
     * 是否解压
     */
    private Boolean shouldUnzip = false;

    /**
     * 文件的md5值
     */
    private String md5;

}`

What you expected to happen

return result

···
{
"code": "0000",
"message": "suceess",
"data": null,
"success": true,
"timestamp": 1721720506935
}
···

Anything else

debug info

image

image

image

image

Correct code

we repair and expend this ,now is run ok

image

Are you willing to submit a pull request to fix on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

@smalltalkhyb smalltalkhyb added component/need-triage Need maintainers to triage type/need-triage Need maintainers to triage labels Jul 23, 2024
@oxsean oxsean self-assigned this Jul 23, 2024
@oxsean
Copy link
Collaborator

oxsean commented Jul 23, 2024

Thanks for report, I will take a look.

@oxsean oxsean removed type/need-triage Need maintainers to triage component/need-triage Need maintainers to triage labels Jul 23, 2024
@oxsean oxsean mentioned this issue Jul 25, 2024
8 tasks
@oxsean
Copy link
Collaborator

oxsean commented Jul 30, 2024

@smalltalkhyb fixed in latest 3.3 branch, could you please build and test again?

@AlbumenJ AlbumenJ closed this as completed Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants