diff --git a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFNullDecompressor.java b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFNullDecompressor.java index 6ffc1f0acb7..9b5a746eec1 100644 --- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFNullDecompressor.java +++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFNullDecompressor.java @@ -136,12 +136,7 @@ public void decodeRaw(byte[] b, int lastRow = activeSrcHeight - 1; for (int y = 0; y < activeSrcHeight; y++) { - int bytesRead = stream.read(b, dstOffset, activeBytesPerRow); - if (bytesRead < 0) { - throw new EOFException(); - } else if (bytesRead != activeBytesPerRow) { - break; - } + stream.readFully(b, dstOffset, activeBytesPerRow); dstOffset += scanlineStride; // Skip unneeded bytes (row suffix + row prefix). @@ -154,17 +149,10 @@ public void decodeRaw(byte[] b, stream.seek(offset); int bytesPerRow = (srcWidth*bitsPerPixel + 7)/8; if(bytesPerRow == scanlineStride) { - if (stream.read(b, dstOffset, bytesPerRow*srcHeight) < 0) { - throw new EOFException(); - } + stream.readFully(b, dstOffset, bytesPerRow*srcHeight); } else { for (int y = 0; y < srcHeight; y++) { - int bytesRead = stream.read(b, dstOffset, bytesPerRow); - if (bytesRead < 0) { - throw new EOFException(); - } else if (bytesRead != bytesPerRow) { - break; - } + stream.readFully(b, dstOffset, bytesPerRow); dstOffset += scanlineStride; } }