Buggy code:
public abstract class AbstractMessageConverterMethodProcessor extends AbstractMessageConverterMethodArgumentResolver implements HandlerMethodReturnValueHandler { private static final MediaType MEDIA_TYPE_APPLICATION = new MediaType ( "application" ) ; private final ContentNegotiationManager contentNegotiationManager ; protected AbstractMessageConverterMethodProcessor ( List < HttpMessageConverter < ? > > messageConverters ) { } protected AbstractMessageConverterMethodProcessor ( List < HttpMessageConverter < ? > > messageConverters , ContentNegotiationManager manager ) { } protected ServletServerHttpResponse createOutputMessage ( NativeWebRequest webRequest ) { } protected < T > void writeWithMessageConverters ( T returnValue , MethodParameter returnType , NativeWebRequest webRequest ) throws IOException , HttpMediaTypeNotAcceptableException { } @ SuppressWarnings ( "unchecked" ) protected < T > void writeWithMessageConverters ( T returnValue , MethodParameter returnType , ServletServerHttpRequest inputMessage , ServletServerHttpResponse outputMessage ) throws IOException , HttpMediaTypeNotAcceptableException { Class < ? > returnValueClass = returnValue . getClass ( ) ; HttpServletRequest servletRequest = inputMessage . getServletRequest ( ) ; List < MediaType > requestedMediaTypes = getAcceptableMediaTypes ( servletRequest ) ; List < MediaType > producibleMediaTypes = getProducibleMediaTypes ( servletRequest , returnValueClass ) ; Set < MediaType > compatibleMediaTypes = new LinkedHashSet < MediaType > ( ) ; for ( MediaType r : requestedMediaTypes ) { for ( MediaType p : producibleMediaTypes ) { if ( r . isCompatibleWith ( p ) ) { compatibleMediaTypes . add ( getMostSpecificMediaType ( r , p ) ) ; } } } if ( compatibleMediaTypes . isEmpty ( ) ) { <START_BUG> throw new HttpMediaTypeNotAcceptableException ( allSupportedMediaTypes ) ; <END_BUG> } List < MediaType > mediaTypes = new ArrayList < MediaType > ( compatibleMediaTypes ) ; MediaType . sortBySpecificityAndQuality ( mediaTypes ) ; MediaType selectedMediaType = null ; for ( MediaType mediaType : mediaTypes ) { if ( mediaType . isConcrete ( ) ) { selectedMediaType = mediaType ; break ; } else if ( ( mediaType . equals ( ALL ) ) || ( mediaType . equals ( AbstractMessageConverterMethodProcessor . MEDIA_TYPE_APPLICATION ) ) ) { selectedMediaType = MediaType . APPLICATION_OCTET_STREAM ; break ; } } if ( selectedMediaType != null ) { selectedMediaType = selectedMediaType . removeQualityValue ( ) ; for ( HttpMessageConverter < ? > messageConverter : messageConverters ) { if ( messageConverter . canWrite ( returnValueClass , selectedMediaType ) ) { ( ( HttpMessageConverter < T > ) ( messageConverter ) ) . write ( returnValue , selectedMediaType , outputMessage ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( ( ( ( ( ( ( "Written<seq2seq4repair_space>[" + returnValue ) + "]<seq2seq4repair_space>as<seq2seq4repair_space>\"" ) + selectedMediaType ) + "\"<seq2seq4repair_space>using<seq2seq4repair_space>[" ) + messageConverter ) + "]" ) ) ; } return ; } } } throw new HttpMediaTypeNotAcceptableException ( allSupportedMediaTypes ) ; } @ SuppressWarnings ( "unchecked" ) protected List < MediaType > getProducibleMediaTypes ( HttpServletRequest request , Class < ? > returnValueClass ) { } private List < MediaType > getAcceptableMediaTypes ( HttpServletRequest request ) throws HttpMediaTypeNotAcceptableException { } private MediaType getMostSpecificMediaType ( MediaType acceptType , MediaType produceType ) { } }

Fix:
throw new HttpMediaTypeNotAcceptableException ( producibleMediaTypes ) ;