if (readers.hasNext()) {
reader = readers.next();
reader.addIIOReadProgressListener(this);
reader.setInput(input);
ImageReadParam param = reader.getDefaultReadParam();
<BUG>bufferedImage = reader.getImageTypes(0).next().createBufferedImage(reader.getWidth(0), reader.getHeight(0));
</BUG>
param.setDestination(bufferedImage);
try {
<BUG>reader.read(0, param);
if (isCancelled()) {</BUG>
return null;

if (readers.hasNext()) {
reader = readers.next();
reader.addIIOReadProgressListener(this);
reader.setInput(input);
ImageReadParam param = reader.getDefaultReadParam();
BufferedImage bufferedImage = reader.getImageTypes(0).next().createBufferedImage(reader.getWidth(0), reader.getHeight(0));
param.setDestination(bufferedImage);
try {
bufferedImage = reader.read(0, param);
if (isCancelled()) {
return null;
