Added patch from JAI_IMAGEIO_CORE-182

See https://java.net/jira/browse/JAI_IMAGEIO_CORE-182