You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
If an instance of a Handler.Wrapper without a child is allowed to start and begin handling requests, the error message is unclear.
java.lang.NullPointerException: Cannot invoke "org.eclipse.jetty.server.Request$Handler.handle(org.eclipse.jetty.server.Request, org.eclipse.jetty.server.Response, org.eclipse.jetty.util.Callback)" because "this._handler" is null
We should make the start of this kind of handler fail the start and throw a meaningful message that the Handler.Wrapper is missing a child.
The text was updated successfully, but these errors were encountered:
So we need a more meaningful message in RewriteHandler.LastRuleHandler if it starts with a null_handler.
It's possible to also put an IllegalStateException into Handler.Wrapper.doStart if the _handler is null but first we would have to check that the Handler.Wrapper instance is !dynamic (as if dynamic is true, starting without a handler set is allowed).
There is a use-case for optional handlers in Handler.Wrapper. The classic example is ServletHandler, which is a Wrapper, but typically does not have a nested Handler. This is only important for deployments without a default servlet.
janbartel
changed the title
Use of Handler.Wrapper without a child handler should produce a clear error message.
Use of RewriteHandler.LastRuleHandler without a child handler should produce a clear error message.
Sep 30, 2024
Jetty version(s)
12.0.13
Jetty Environment
Any
Java version/vendor
(use: java -version)
Any
OS type/version
Any
Description
If an instance of a
Handler.Wrapper
without a child is allowed to start and begin handling requests, the error message is unclear.java.lang.NullPointerException: Cannot invoke "org.eclipse.jetty.server.Request$Handler.handle(org.eclipse.jetty.server.Request, org.eclipse.jetty.server.Response, org.eclipse.jetty.util.Callback)" because "this._handler" is null
We should make the start of this kind of handler fail the start and throw a meaningful message that the
Handler.Wrapper
is missing a child.The text was updated successfully, but these errors were encountered: