Community
Participate
Working Groups
Build Identifier: 7.4.5 If an exception is thrown in Request.extractParameters() after _paramsExtracted is set to true and before _parameters is set, then the Request is left in an invalid state. Either _parameters should be set right after _paramsExtracted is set to true or it should be set in a "finally" block. The specific exception that I am seeing is in the _uri.decodeQueryTo() call which is throwing an IllegalArgumentException. Reproducible: Sometimes
I think the setting of true before the extraction is correct. If the extraction fails, then there is no point leaving it false and thus trying to extract again. However, there might be something better we can do about that illegal argument exception. Any chance of giving us an actual stack trace?
Below is a stack trace. What happens is that an exception is thrown in Request.extractParameters() and my logging code catches that exception and then tries to get the parameters to log them. java.lang.NullPointerException at org.eclipse.jetty.server.Request.getParameterNames(Request.java:683) at javax.servlet.ServletRequestWrapper.getParameterNames(ServletRequestWrapper.java:189) at fschmidt.util.servlet.ServletUtils.getQueryString(ServletUtils.java:55) at fschmidt.util.servlet.ServletUtils.getCurrentURL(ServletUtils.java:83) at fschmidt.util.servlet.ServletUtils.getCurrentURL(ServletUtils.java:77) at fschmidt.util.servlet.JtpContextServlet.getCurrentURL(JtpContextServlet.java:589) at fschmidt.util.servlet.JtpContextServlet.access$300(JtpContextServlet.java:52) at fschmidt.util.servlet.JtpContextServlet$JtpServletException.<init>(JtpContextServlet.java:582) at fschmidt.util.servlet.JtpContextServlet$JtpServletException.<init>(JtpContextServlet.java:580) at fschmidt.util.servlet.JtpContextServlet.handleException(JtpContextServlet.java:545) at fschmidt.util.servlet.JtpContextServlet.getAuthorizationKey(JtpContextServlet.java:510) at fschmidt.util.servlet.JtpContextServlet.service2(JtpContextServlet.java:425) at fschmidt.util.servlet.JtpContextServlet.service(JtpContextServlet.java:332) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:538) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1352) at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:77) at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:178) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323) at cachingfilter.CachingFilter.doFilter(CachingFilter.java:157) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323) at fschmidt.util.servlet.BadBotFilter.doFilter(BadBotFilter.java:74) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323) at nabble.view.lib.NabbleErrorFilter.doFilter(NabbleErrorFilter.java:21) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:476) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:937) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:871) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110) at org.eclipse.jetty.server.Server.handle(Server.java:346) at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:589) at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1065) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:823) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220) at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:535) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)
Michael, you can look at this one. I think the key thing to ensure is _parameters is always non null after a call to extractParameters... even if it is empty.
Greetings, It would be very helpful if you can also provide the part of the log that precedes the stack trace that you gave us earlier. I am trying to create a test harness that would reproduce the conditions under which the exception occurred, and need to know what actually caused the issue. It also would be very interesting to know in what part of your application this exception occurred. Are you by chance redirecting request to a custom JSP error page (or servlet) that attempts to list the request parameter values? -Michael
Fixed for 7.5.2. Even if exception thrown during parsing of params, a call to any of the getParam*() methods will not return null.