From 9ef4115fe75c88bcb9b2ff6901f17d299684b700 Mon Sep 17 00:00:00 2001 From: Anisha Nagarajan Date: Mon, 22 Sep 2014 11:25:33 +0400 Subject: [PATCH] 6588417: Incorrect javadoc: no @throws or @exception tag in javax.* Fix remaining missing @throws tags. Reviewed-by: prr --- .../imageio/stream/FileCacheImageInputStream.java | 7 +++++-- .../classes/javax/imageio/stream/MemoryCache.java | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java index b581de9d0f8..d6b7f537bca 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java @@ -87,7 +87,7 @@ public class FileCacheImageInputStream extends ImageInputStreamImpl { * null. * @exception IllegalArgumentException if cacheDir is * non-null but is not a directory. - * @exception IOException if a cache file cannot be created. + * @throws IOException if a cache file cannot be created. */ public FileCacheImageInputStream(InputStream stream, File cacheDir) throws IOException { @@ -122,6 +122,9 @@ public class FileCacheImageInputStream extends ImageInputStreamImpl { * or the end of the source is reached. The return value * is equal to the smaller of pos and the * length of the source file. + * + * @throws IOException if an I/O error occurs while reading from the + * source file */ private long readUntil(long pos) throws IOException { // We've already got enough data cached @@ -244,7 +247,7 @@ public class FileCacheImageInputStream extends ImageInputStreamImpl { * and removing the cache file. The source InputStream * is not closed. * - * @exception IOException if an error occurs. + * @throws IOException if an error occurs. */ public void close() throws IOException { super.close(); diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCache.java b/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCache.java index 48c5e50ea19..026424faa8f 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCache.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCache.java @@ -82,6 +82,8 @@ class MemoryCache { * or the end of the source is reached. The return value * is equal to the smaller of pos and the * length of the source. + * + * @throws IOException if there is no more memory for cache */ public long loadFromStream(InputStream stream, long pos) throws IOException { @@ -143,6 +145,8 @@ class MemoryCache { * the requested data is not in the cache (including if pos * is in a block already disposed), or if either pos or * len is < 0. + * @throws IOException if there is an I/O exception while writing to the + * stream */ public void writeToStream(OutputStream stream, long pos, long len) throws IOException { @@ -177,6 +181,8 @@ class MemoryCache { /** * Ensure that there is space to write a byte at the given position. + * + * throws IOException if there is no more memory left for cache */ private void pad(long pos) throws IOException { long currIndex = cacheStart + cache.size() - 1; @@ -197,7 +203,7 @@ class MemoryCache { * the incoming data. * * @param b an array of bytes containing data to be written. - * @param off the starting offset withing the data array. + * @param off the starting offset within the data array. * @param len the number of bytes to be written. * @param pos the cache position at which to begin writing. * @@ -205,6 +211,7 @@ class MemoryCache { * @exception IndexOutOfBoundsException if off, * len, or pos are negative, * or if off+len > b.length. + * @throws IOException if there is an I/O error while writing to the cache */ public void write(byte[] b, int off, int len, long pos) throws IOException { @@ -248,6 +255,7 @@ class MemoryCache { * @param pos the cache position at which to begin writing. * * @exception IndexOutOfBoundsException if pos is negative. + * @throws IOException if there is an I/O error while writing to the cache */ public void write(int b, long pos) throws IOException { if (pos < 0) { @@ -279,6 +287,9 @@ class MemoryCache { * Returns the single byte at the given position, as an * int. Returns -1 if this position has * not been cached or has been disposed. + * + * @throws IOException if an I/O error occurs while reading from the byte + * array */ public int read(long pos) throws IOException { if (pos >= length) { @@ -304,6 +315,8 @@ class MemoryCache { * off + len > b.length or if any portion of the * requested data is not in the cache (including if * pos is in a block that has already been disposed). + * @throws IOException if an I/O exception occurs while reading from the + * byte array */ public void read(byte[] b, int off, int len, long pos) throws IOException {