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
Java version/vendor(use: java -version)
openjdk version "21.0.3" 2024-04-16 LTS
OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode, sharing)
OS type/version
Windows 11
Description
When passing null as a query parameter value to Request.param, a NullPointerException is thrown. It happens when the value is wrapped in a List using List.of, which doesn't like null values.
I don't think this is intentional. With Jetty 11, null values were allowed. Also, the value is passed to a private method urlEncode, which allows null and is only used for query parameters:
When running the above code with Jetty 12, it throws the following exception:
Exception in thread "main" java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:233)
at java.base/java.util.ImmutableCollections$List12.<init>(ImmutableCollections.java:563)
at java.base/java.util.List.of(List.java:937)
at org.eclipse.jetty.util.Fields$Field.<init>(Fields.java:366)
at org.eclipse.jetty.util.Fields.lambda$add$0(Fields.java:225)
at java.base/java.util.HashMap.compute(HashMap.java:1324)
at org.eclipse.jetty.util.Fields.add(Fields.java:221)
at org.eclipse.jetty.client.transport.HttpRequest.param(HttpRequest.java:334)
at org.eclipse.jetty.client.transport.HttpRequest.param(HttpRequest.java:329)
...
It works fine with Jetty 11 though.
The text was updated successfully, but these errors were encountered:
Jetty version(s)
Jetty 12.0.10
Jetty Environment
core
Java version/vendor
(use: java -version)
openjdk version "21.0.3" 2024-04-16 LTS
OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode, sharing)
OS type/version
Windows 11
Description
When passing null as a query parameter value to
Request.param
, a NullPointerException is thrown. It happens when the value is wrapped in a List usingList.of
, which doesn't like null values.I don't think this is intentional. With Jetty 11, null values were allowed. Also, the value is passed to a private method
urlEncode
, which allows null and is only used for query parameters:jetty.project/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/transport/HttpRequest.java
Line 339 in 803fe5c
How to reproduce?
When running the above code with Jetty 12, it throws the following exception:
It works fine with Jetty 11 though.
The text was updated successfully, but these errors were encountered: