jetty-ee11-servlet getParameter does not throw IllegalStateException (original) (raw)

Jetty version(s)

12.1.1

Jetty Environment

ee11

HTTP version

HTTP 1.1

Java version/vendor (use: java -version)

openjdk version "21.0.8" 2025-07-15 LTS
OpenJDK Runtime Environment Corretto-21.0.8.9.1 (build 21.0.8+9-LTS)
OpenJDK 64-Bit Server VM Corretto-21.0.8.9.1 (build 21.0.8+9-LTS, mixed mode, sharing)

OS type/version
Linux

Description

getParameter documents @throws IllegalStateException for invalid parameters, but Jetty throws BadMessageException, which does not extend IllegalStateException. It seems like Jetty should throw IllegalStateException by default, possibly with an option to restore the current behavior in case there is code dependent on the current exception hierarchy.

I found #11818 looking through issues, but it has no mention of IllegalStateException.

How to reproduce?
Make a request with ?x=%80, wrap getParameter in a try/catch, and expect to do custom handling (for example, send a custom JSON payload).

try {
  req.getParameter("x");
} catch (IllegalStateException e) {
  // custom handling
}