Bug: Possible null pointer dereference in org.springframework.http.converter.StringHttpMessageConverter.getContentTypeCharset(MediaType) due to return value of called method The return value from a method is dereferenced without a null check, and the return value of that method is one that should generally be checked for null. This may lead to a NullPointerException when the code is executed.

Comment From: sbrannen

The non-null value returned by contentType.getCharset() cannot change between the if condition check and the return statement. So this is not a bug; however, invoking contentType.getCharset() only once is certainly an improvement.

Comment From: sbrannen

This has been merged into master.

Thanks