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

TOMEE-4375 - Fix NPEs in SavedRequest #1328

Merged
merged 3 commits into from
Aug 5, 2024
Merged

TOMEE-4375 - Fix NPEs in SavedRequest #1328

merged 3 commits into from
Aug 5, 2024

Conversation

mpuening
Copy link
Contributor

No description provided.

@mpuening
Copy link
Contributor Author

Stack trace fetching "Content-Type" header:

java.lang.NullPointerException: Cannot invoke "java.util.List.get(int)" because the return value of "java.util.Map.get(Object)" is null
org.apache.tomee.security.http.SavedRequest$1.getHeader(SavedRequest.java:110)
jakarta.servlet.http.HttpServletRequestWrapper.getHeader(HttpServletRequestWrapper.java:83)
com.sun.faces.context.RequestHeaderMap.get(RequestHeaderMap.java:48)
com.sun.faces.context.RequestHeaderMap.get(RequestHeaderMap.java:32)
java.base/java.util.Collections$UnmodifiableMap.get(Collections.java:1656)
jakarta.faces.application.ViewHandler.calculateCharacterEncoding(ViewHandler.java:363)
jakarta.faces.application.ViewHandler.initView(ViewHandler.java:236)
com.sun.faces.application.view.MultiViewHandler.initView(MultiViewHandler.java:110)
jakarta.faces.application.ViewHandlerWrapper.initView(ViewHandlerWrapper.java:81)
com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:95)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:131)
jakarta.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:691)
jakarta.faces.webapp.FacesServlet.service(FacesServlet.java:449)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:67)

Copy link
Member

@jungm jungm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice PR!
I've commented a few minor details I would still like to see changed. Also getHeaderNames() is not included in your changes

}

@Override
public String getHeader(String name) {
return headers.get(name).get(0);
List<String> header = headers.get(name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in getHeaders(String) you assume headersmay be null, this check is missing here

@rzo1 rzo1 changed the title Fix NPEs in SavedRequest TOMEE-4375 - Fix NPEs in SavedRequest Jul 27, 2024
@jungm
Copy link
Member

jungm commented Jul 28, 2024

@mpuening can you fix getHeaderNames() as well? Then it should look good I think

@rzo1 rzo1 merged commit e6a1219 into apache:main Aug 5, 2024
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

Successfully merging this pull request may close these issues.

3 participants