-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Resteasy Reactive - Using BeanParam with custom paramconverter throws NPE #21664
Labels
Milestone
Comments
/cc @FroMage, @geoand, @stuartwdouglas |
@Sgitario wanna take a look at this one? |
Looking |
Sgitario
added a commit
to Sgitario/quarkus
that referenced
this issue
Nov 25, 2021
The NPE happens here: https://github.com/quarkusio/quarkus/blob/e6ffbe43243f9c852c61aafc307515be0915c6c8/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ClassInjectorTransformer.java#L222. However, it's expected that the delegated converter is null when there are runtime converts. See related lines: https://github.com/quarkusio/quarkus/blob/bd87966540990fa68ec3769e22e67df1854b08a5/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java#L169 and https://github.com/quarkusio/quarkus/blob/bd87966540990fa68ec3769e22e67df1854b08a5/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java#L173. Therefore, as It's possible that the delegate is null when there are runtime converters, we check whether the delegate is null and if it is, we don't use it to avoid the NPE. The rest works as expected as proven in the test. Fixes quarkusio#21664
gsmet
pushed a commit
to gsmet/quarkus
that referenced
this issue
Nov 25, 2021
The NPE happens here: https://github.com/quarkusio/quarkus/blob/e6ffbe43243f9c852c61aafc307515be0915c6c8/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ClassInjectorTransformer.java#L222. However, it's expected that the delegated converter is null when there are runtime converts. See related lines: https://github.com/quarkusio/quarkus/blob/bd87966540990fa68ec3769e22e67df1854b08a5/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java#L169 and https://github.com/quarkusio/quarkus/blob/bd87966540990fa68ec3769e22e67df1854b08a5/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java#L173. Therefore, as It's possible that the delegate is null when there are runtime converters, we check whether the delegate is null and if it is, we don't use it to avoid the NPE. The rest works as expected as proven in the test. Fixes quarkusio#21664 (cherry picked from commit b66ba75)
Postremus
pushed a commit
to Postremus/quarkus
that referenced
this issue
Nov 25, 2021
The NPE happens here: https://github.com/quarkusio/quarkus/blob/e6ffbe43243f9c852c61aafc307515be0915c6c8/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ClassInjectorTransformer.java#L222. However, it's expected that the delegated converter is null when there are runtime converts. See related lines: https://github.com/quarkusio/quarkus/blob/bd87966540990fa68ec3769e22e67df1854b08a5/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java#L169 and https://github.com/quarkusio/quarkus/blob/bd87966540990fa68ec3769e22e67df1854b08a5/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java#L173. Therefore, as It's possible that the delegate is null when there are runtime converters, we check whether the delegate is null and if it is, we don't use it to avoid the NPE. The rest works as expected as proven in the test. Fixes quarkusio#21664
Postremus
pushed a commit
to Postremus/quarkus
that referenced
this issue
Nov 27, 2021
The NPE happens here: https://github.com/quarkusio/quarkus/blob/e6ffbe43243f9c852c61aafc307515be0915c6c8/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ClassInjectorTransformer.java#L222. However, it's expected that the delegated converter is null when there are runtime converts. See related lines: https://github.com/quarkusio/quarkus/blob/bd87966540990fa68ec3769e22e67df1854b08a5/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java#L169 and https://github.com/quarkusio/quarkus/blob/bd87966540990fa68ec3769e22e67df1854b08a5/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java#L173. Therefore, as It's possible that the delegate is null when there are runtime converters, we check whether the delegate is null and if it is, we don't use it to avoid the NPE. The rest works as expected as proven in the test. Fixes quarkusio#21664
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Describe the bug
I get a nullpointerexception, when I try to use a LocalDateTime as a QueryParam on a class used as BeanParam in resteasy-reactive.
LocalDateTime gets converted using my own ParamConverter + ParamConverterProvider.
The same paramconverts work fine on resteasy-classic.
When I use LocalDateTime QueryParam of the resource (without the beanparam indirection), the app starts fine.
Expected behavior
No response
Actual behavior
How to Reproduce?
Download the reproducer:
rr-paramconverter.zip
mvn quarkus:dev
Does not start, the exception from above is printed
In ReactiveGreetingResource, replace the beanparam with
@RestQuery LocalDateTime datetime
The app starts fine
Output of
uname -a
orver
MSYS_NT-10.0-19043 NANB7NLNVP2 3.1.7-340.x86_64 2021-03-26 22:17 UTC x86_64 Msys
Output of
java -version
MSYS_NT-10.0-19043 NANB7NLNVP2 3.1.7-340.x86_64 2021-03-26 22:17 UTC x86_64 Msys PS C:\workspaces\aviator\rr-paramconverter> java --version openjdk 17 2021-09-14 OpenJDK Runtime Environment Temurin-17+35 (build 17+35) OpenJDK 64-Bit Server VM Temurin-17+35 (build 17+35, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.4.2.Final, 2.5.0.CR1
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739) Maven home: C:\eclipse\tools\apache-maven Java version: 17, vendor: Eclipse Adoptium, runtime: C:\eclipse\tools\java\17 Default locale: de_DE, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Additional information
No response
The text was updated successfully, but these errors were encountered: