Unlike similar exceptions, MissingServletRequestPartException directly extends ServletException; whereas, the following extend MissingRequestValueException which extends ServletRequestBindingException which indirectly extends ServletException.

  • MissingServletRequestParameterException
  • MissingRequestHeaderException
  • ...

How about changing it if there is no good reason? 🤔

Comment From: sbrannen

That's a good question.

@rstoyanchev, do you have any objection to changing this?

Comment From: rstoyanchev

I think that would be okay but would probably require some changes in DefaultHandlerExceptionResolver and in ResponseEntityExceptionHandler. Those handle ServletRequestBindingException ahead of MissingServletRequestPartException, while some more concrete sub-classes are checked earlier. We'd probably need to move MissingServletRequestPartException up in the order as well to preserve the call to the protected method.

Comment From: heowc

Yes. I agree with that 👍

May I try to solve this issue?

Comment From: sbrannen

@heowc, if you feel comfortable with making the suggested changes and testing that the existing behavior is maintained, feel free to submit a PR.

Comment From: rstoyanchev

Superseded by #27948.