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
Currently using Jersey 2.35 (does not seem fixed in current release 3.1.1) we're encountering an unexpected behavior while using Jersey's Microprofile RestClient implementation. We're trying to issue requests to an enpoint accepting nullable application/x-www-form-urlencoded parameters and we're getting a NullPointerException each time we're trying to pass a null (@FormParam) parameter.
The issue seems to be caused by org.glassfish.jersey.microprofile.restclient.FormParamModel class that resolve the parameter value as Object and tries to call resolvedValue.toString() without a null-check.
Resulting exception : java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "Object.toString()" because "resolvedValue" is null
Caused by: java.lang.NullPointerException: Cannot invoke "Object.toString()" because "resolvedValue" is null
at org.glassfish.jersey.microprofile.restclient.FormParamModel.handleParameter(FormParamModel.java:48)
at org.glassfish.jersey.microprofile.restclient.FormParamModel.handleParameter(FormParamModel.java:31)
at org.glassfish.jersey.microprofile.restclient.MethodModel.lambda$handleForm$4(MethodModel.java:213)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at org.glassfish.jersey.microprofile.restclient.MethodModel.handleForm(MethodModel.java:213)
at org.glassfish.jersey.microprofile.restclient.MethodModel.invokeMethod(MethodModel.java:172)
at org.glassfish.jersey.microprofile.restclient.InterceptorInvocationContext.proceed(InterceptorInvocationContext.java:110)
at org.glassfish.jersey.microprofile.restclient.RestClientModel.invokeMethod(RestClientModel.java:69)
at org.glassfish.jersey.microprofile.restclient.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:70)
...
The text was updated successfully, but these errors were encountered:
jbescos
added a commit
to jbescos/jersey
that referenced
this issue
Feb 9, 2023
Currently using Jersey 2.35 (does not seem fixed in current release 3.1.1) we're encountering an unexpected behavior while using Jersey's Microprofile RestClient implementation. We're trying to issue requests to an enpoint accepting nullable
application/x-www-form-urlencoded
parameters and we're getting a NullPointerException each time we're trying to pass a null (@FormParam) parameter.The issue seems to be caused by
org.glassfish.jersey.microprofile.restclient.FormParamModel
class that resolve the parameter value asObject
and tries to callresolvedValue.toString()
without a null-check.jersey/ext/microprofile/mp-rest-client/src/main/java/org/glassfish/jersey/microprofile/restclient/FormParamModel.java
Line 48 in dc51308
Here is our setup :
Given the following resource :
The resulting client throws an exception when called with null value for
param
:Resulting exception :
java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "Object.toString()" because "resolvedValue" is null
The text was updated successfully, but these errors were encountered: