spring-projects/spring-framework — pull request #491 by bturner (2014-03-20 05:09:48+00:00)
Title: SPR-11581 Filter empty MIME types in BufferedImageHttpMessageConverter

When Oracle JAI is installed, `ImageIO.getReaderMIMETypes()` and `ImageIO.getWriterMIMETypes()` both return arrays with a leading empty string. It is unclear whether this is a valid behavior from `ImageIO` (the Javadocs are not specific), but it is not handled by `BufferedImageHttpMessageConverter`. That causes SpringMVC to fail to initialize when JAI is installed.

- When looping over `ImageIO getReaderMIMETypes()` and `getWriterMIMETypes()` strip out any empty strings in `BufferedImageHttpMessageConverter`

The static nature of `ImageIO` makes writing a test for this difficult. If anyone has a suggestion for how one might be written to make this patch acceptable, I'd be happy to write it.