Skip to content
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 client: optional FormParameters throw error when null #23872

Closed
pravussum opened this issue Feb 22, 2022 · 1 comment · Fixed by #23876
Closed

RestEasy Reactive client: optional FormParameters throw error when null #23872

pravussum opened this issue Feb 22, 2022 · 1 comment · Fixed by #23876
Labels
area/rest-client kind/bug Something isn't working
Milestone

Comments

@pravussum
Copy link
Contributor

pravussum commented Feb 22, 2022

Describe the bug

When using a reactive restclient created from an interface, it's not possible to call a method with an optional form parameter when the actual value of the parameter is null.
It gives the following error:

java.lang.IllegalStateException: Form parameter 'formParam' could not be converted to 'String' for REST Client interface 'org.acme.GreetingResourceApi'. A proper implementation of 'javax.ws.rs.ext.ParamConverter' needs to be returned by a 'javax.ws.rs.ext.ParamConverterProvider' that is registered with the client via the @RegisterProvider annotation on the REST Client interface.

Expected behavior

The service method can be called without error and the value of the delivered parameter value is null.

Actual behavior

The error message from the bug description.

How to Reproduce?

Clone the following reproducer project:
https://github.com/pravussum/quarkus-restclient-reactive-formparam-repro

The test ReactiveGreetingResourceTest shows the good case (form param not null) and the error case (sent form param is null).

Output of uname -a or ver

5.13.0-27-generic #29-Ubuntu SMP Wed Jan 12 17:36:47 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk-15.0.2

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.7.1

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

Maven 3.8.4

Additional information

The JaxrsClientReactiveProcessor.addFormParam() method does a "isString" check on the null value returned from the converter, which obviously fails and leads to the given error message.
The null case should be handled properly here (neither throwing an exception, nor adding the parameter to the formParams map).

@pravussum pravussum added the kind/bug Something isn't working label Feb 22, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 22, 2022

/cc @FroMage, @geoand, @stuartwdouglas

geoand added a commit to geoand/quarkus that referenced this issue Feb 22, 2022
geoand added a commit to geoand/quarkus that referenced this issue Feb 22, 2022
geoand added a commit to geoand/quarkus that referenced this issue Feb 22, 2022
geoand added a commit to geoand/quarkus that referenced this issue Feb 22, 2022
@quarkus-bot quarkus-bot bot added this to the 2.8 - main milestone Feb 22, 2022
geoand added a commit that referenced this issue Feb 22, 2022
Allow null values for query, cookies, headers and form params for Reactive REST Client
@gsmet gsmet modified the milestones: 2.8 - main, 2.7.3.Final Feb 28, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest-client kind/bug Something isn't working
Projects
None yet
3 participants