java.lang.NullPointerException in HttpServletRequestDelegator.getParameter(HttpServletRequestDelegator.java:160)
On an OIDC Callback i.e.
http://localhost:8080/MyApplication/index.html?code=0.AXMAlS8XEZqje0-SJMahHR5cJCFY7Ad5WTJDkKCbZUg-0LdzAH8....
the following line (160) in HttpServletRequestDelegator.java
String[] values = requestData.getParameters().get(name);
throws a java.lang.NullPointerException when accessing a request parameter which is not in the GET request sent bei OIDC server, i.e.
request.getParameter("action")
Could this be fixed?
By using an explicit callback servlet which does not use request.getParameter(... and redirects to the main application URL, there is no NPE anymore:
response.sendRedirect(request.getHeader("x-forwarded-proto") + "://" + request.getHeader("x-forwarded-host") + request.getContextPath());
Servlet is behind a reverse proxy, that's why the X-headers are used.
But maybe HttpServletRequestDelegator.getParameter should return null (just like in ServletRequest) when parameter name is not found.