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

NPE in AtmosphereRequestImpl.wrap #2501

Closed
mcollovati opened this issue Feb 13, 2024 · 0 comments
Closed

NPE in AtmosphereRequestImpl.wrap #2501

mcollovati opened this issue Feb 13, 2024 · 0 comments
Assignees

Comments

@mcollovati
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants