According to the Servlet spec, getCharacterEncoding() should never return null. Consequently, MockHttpServletResponse.characterEncoding should not be @Nullable.

Similarly, MockHttpServletResponse.reset() should set the characterEncoding to WebUtils.DEFAULT_CHARACTER_ENCODING instead of null.

Ensuring that characterEncoding is never null will also help to simplify the implementation of several methods in MockHttpServletResponse that currently have non-null checks for the characterEncoding.