diff --git a/extensions/resteasy-reactive/rest-jaxb/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/runtime/serialisers/ServerJaxbMessageBodyReader.java b/extensions/resteasy-reactive/rest-jaxb/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/runtime/serialisers/ServerJaxbMessageBodyReader.java index 6a8226fba6d03..ab833016c9bc7 100644 --- a/extensions/resteasy-reactive/rest-jaxb/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/runtime/serialisers/ServerJaxbMessageBodyReader.java +++ b/extensions/resteasy-reactive/rest-jaxb/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/runtime/serialisers/ServerJaxbMessageBodyReader.java @@ -12,10 +12,12 @@ import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.Providers; import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.UnmarshalException; import jakarta.xml.bind.Unmarshaller; import org.jboss.resteasy.reactive.common.util.StreamUtil; @@ -73,6 +75,8 @@ protected Object unmarshal(InputStream entityStream, Class type) { JAXBElement item = getUnmarshall(type) .unmarshal(new StreamSource(entityStream), type); return item.getValue(); + } catch (UnmarshalException e) { + throw new WebApplicationException(e, Response.Status.BAD_REQUEST); } catch (JAXBException e) { throw new RuntimeException(e); }