snowdrop-zen / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
1 stars 0 forks source link

Multiple file upload using Quarkus and RestEasy reactive #335

Closed snowdrop-bot closed 3 years ago

snowdrop-bot commented 3 years ago

Trying to upload multiple files along with file details . want to map the request to POJO

public class MulitipleDocumentDetailsRequest implements Serializable {

    private static final long serialVersionUID = 1L;

    @RestForm("fileUpload")
    private List<FileUpload> fileUpload;

    @RestForm("fileDetails")
    @PartType(MediaType.APPLICATION_JSON)
    private List<FileDetails> fileDetails;

}

no of files uploading to the system is dynamic hence defined FileUpload as list.

endpoint:

       @POST
    @Path("/v1/checkinMultipleDoc")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    @Produces(MediaType.TEXT_PLAIN)
    public Response checkinMultipleDoc(@MultipartForm MulitipleDocumentDetailsRequest documentDetailsRequests){

       }

Exception:

2021-05-05 23:25:12,540 ERROR [org.jbo.res.rea.com.cor.AbstractResteasyReactiveContext] (executor-thread-1) Request failed: javax.ws.rs.WebApplicationException: HTTP 400 Bad Request
        at org.jboss.resteasy.reactive.server.handlers.ParameterHandler.handle(ParameterHandler.java:58)
        at org.jboss.resteasy.reactive.server.handlers.ParameterHandler.handle(ParameterHandler.java:14)
        at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:122)
        at io.quarkus.runtime.CleanableExecutor$CleaningRunnable.run(CleanableExecutor.java:231)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
        at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
        at java.lang.Thread.run(Thread.java:748)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
        at org.jboss.resteasy.reactive.server.handlers.ParameterHandler.handleResult(ParameterHandler.java:116)
        at org.jboss.resteasy.reactive.server.handlers.ParameterHandler.handle(ParameterHandler.java:52)
        ... 11 more

Details : Java version : 1.8 Quarkus version 1.13.0.Final


https://github.com/quarkusio/quarkus/issues/17025


$upstream:17025$