quarkus: ConstraintViolationExceptions thrown bubble outside the reactive pipeline

Describe the bug

This came from #31400 - this comment specifically.

In Quarkus 2.x, if a ConstraintViolationException is thrown somewhere within a reactive pipeline, it flows through the pipeline as a failure (as it should).

In Quarkus 3, the exception bubbles out of/breaks the reactive pipeline completely.

Expected behavior

I would expect that if I have a reactive pipeline and a ConstraintViolationException is thrown somewhere, that the pipeline should not break. It should contain the exception as a failure.

Actual behavior

It doesn’t. The exception bubbles up.

How to Reproduce?

Reproducer: validation-breaks-reactive-pipeline.zip

The reproducer above contains 2 identical projects: rest-heroes-quarkus2 (for Quarkus 2) and rest-heroes-quarkus3 (for Quarkus 3).

Each contains an identical version of the application, which has been stripped down to barebones and only contains the pieces necessary to demonstrate the issue. Each project contains a single test class (HeroServiceTests) and single test (persistNullHero).

If you run ./mvnw clean verify from rest-heroes-quarkus2 you’ll see the test passes, as it should. The ConstraintViolationException flows through the reactive pipeline and is detected as a failure within the pipeline.

Running ./mvnw clean verify from rest-heroes-quarkus3 results in a failure:

HeroServiceTests.persistNullHero:24 » ConstraintViolation 1 constraint violation(s) occurred during method validation.
Constructor or Method: public io.smallrye.mutiny.Uni io.quarkus.sample.superheroes.hero.service.HeroService.persistHero(io.quarkus.sample.superheroes.hero.Hero)
Argument values: [null]
Constraint violations: 
 (1) Kind: PARAMETER
 parameter index: 0
 message: must not be null
 root bean: io.quarkus.sample.superheroes.hero.service.HeroService_Subclass@254a9f65
 property path: persistHero.hero
 constraint: @jakarta.validation.constraints.NotNull(message="{jakarta.validation.constraints.NotNull.message}", payload={}, groups={})

Output of uname -a or ver

Darwin edeandrea-m1pro 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar  6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64

Output of java -version

openjdk version "17.0.6" 2023-01-17
OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode)

Quarkus version or git rev

2.16.6.Final vs 3.0.0.CR2

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /Users/edeandre/.m2/wrapper/dists/apache-maven-3.8.4-bin/52ccbt68d252mdldqsfsn03jlf/apache-maven-3.8.4
Java version: 17.0.6, vendor: Eclipse Adoptium, runtime: /Users/edeandre/.sdkman/candidates/java/17.0.6-tem
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "13.3.1", arch: "aarch64", family: "mac"

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 18 (15 by maintainers)

Most upvoted comments

I couldn’t reproduce it.

hmmmm weird I’m having a hard time showing that it doesn’t break in Quarkus 2 😃 Let me play with it a bit more…