NPE in AtmosphereRequestImpl.wrap
mcollovati opened this issue · 0 comments
Describe the bug
In AtmosphereRequestImpl.wrap
the request attributes are copied into LocalAttributes
instance of request builder one by one. LocalAttributes
internally stores attributes in a ConcurrentHashMap
, that does not accept null keys or value.
On Jetty 12 a request may contain a null value for an attribute named org.eclipse.jetty.multipartConfig
. In this situation the wrap
call fails with the following error:
Caused by: java.lang.NullPointerException: null
at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011) ~[na:na]
at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006) ~[na:na]
at org.atmosphere.cpr.AtmosphereRequest$LocalAttributes.put(AtmosphereRequest.java:589) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar:3.0.3.slf4jvaadin2]
at org.atmosphere.cpr.AtmosphereRequestImpl.wrap(AtmosphereRequestImpl.java:1450) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar:3.0.3.slf4jvaadin2]
at com.vaadin.flow.server.communication.PushRequestHandler.handleRequest(PushRequestHandler.java:292) ~[flow-server-24.3.5.jar:24.3.5]
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1574) ~[flow-server-24.3.5.jar:24.3.5]
... 55 common frames omitted
Additional note: the wrap
method currently calls attributeWithoutException
to prevent a potential NPE when getting the attribute from the request (#1732).
Atmosphere Info
- version: 3.0.3.slf4jvaadin2
Expected behavior
wrap
does not fail if there are request attribute keys associated with null values. It could probably ignore the attribute.
Systems (please complete the following information):
- OS: Linux
- Java version and distribution: Temurin-17.0.7+7
- Serveur name and version Jetty 12.0.5
Additional context
Original issue on Vaadin Flow: vaadin/flow#18345