You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is related to #20979. Looks to have been working in quarkus 2.3.2.Final, but the bug was interduced in quarkus 2.4.0.Final and is still present in quarkus 2.5.0.Final. Note that the code is fork'ed from @antoniomacri : antoniomacri/quarkus-completionstage-rolesallowed.
Consider the following method:
@RolesAllowed("protected-role")
@Path("/")
public class SampleResource {
@POST
@Path("protected")
@Consumes(MediaType.APPLICATION_JSON)
public CompletionStage<Response> getProtected(final Content data) throws Exception {
return CompletableFuture.completedFuture(Response.ok().build());
}
}
And consider that Content object's field name must not be null:
@Getter
@Setter
public class Content {
@NotNull
private String name;
}
When getProtected is called where Content object's field name is null, an unhandledAsynchronousException is thrown.
It is expected that exceptions are thrown in completionStages (in this case the @Valid throws the exception) and that these exceptions are correctly mapped. This do not look to be the case with RolesAllowedInterceptor.java:29 which calls the SecurityHandler.handle method(see below). It looks like the exception mapped is ignored on line 39:
As the request contains incomplete content, it is expected to receive a CompletionStage with a response with 400 Bad Request. And that the exception mapping is not ignored.
Actual behavior
An unhandledAsynchronousException from resteasy with the return code 500 is returned.
In a QuarkusTest shows this error:
AM org.jboss.resteasy.core.SynchronousDispatcher unhandledAsynchronousException
ERROR: RESTEASY002020: Unhandled asynchronous exception, sending back 500
Describe the bug
This issue is related to #20979. Looks to have been working in quarkus 2.3.2.Final, but the bug was interduced in quarkus 2.4.0.Final and is still present in quarkus 2.5.0.Final. Note that the code is fork'ed from @antoniomacri : antoniomacri/quarkus-completionstage-rolesallowed.
Consider the following method:
And consider that
Content
object's fieldname
must not be null:When
getProtected
is called whereContent
object's fieldname
isnull
, anunhandledAsynchronousException
is thrown.It is expected that exceptions are thrown in completionStages (in this case the
@Valid
throws the exception) and that these exceptions are correctly mapped. This do not look to be the case withRolesAllowedInterceptor.java:29
which calls the SecurityHandler.handle method(see below). It looks like the exception mapped is ignored on line 39:quarkus/extensions/security/runtime/src/main/java/io/quarkus/security/runtime/interceptor/SecurityHandler.java
Lines 25 to 49 in 31caccc
Expected behavior
As the request contains incomplete content, it is expected to receive a CompletionStage with a response with 400 Bad Request. And that the exception mapping is not ignored.
Actual behavior
An unhandledAsynchronousException from resteasy with the return code 500 is returned.
In a QuarkusTest shows this error:
AM org.jboss.resteasy.core.SynchronousDispatcher unhandledAsynchronousException
ERROR: RESTEASY002020: Unhandled asynchronous exception, sending back 500
How to Reproduce?
Find code to reproduce here
Output of
uname -a
orver
No response
Output of
java -version
java 11
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.5.0.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Maven 3.8.1
Additional information
No response
The text was updated successfully, but these errors were encountered: