Add '@SuppressWarnings("unused") // Possibly thrown from subclasses' to
eliminate compiler warnings.
MODIFY
src/main/java/org/apache/commons/io/DirectoryWalker.java
src/main/java/org/apache/commons/io/DirectoryWalker.java
@@ -442,6 +442,7 @@ protected final void checkIfCancelled(final File file, final int depth, final Co
* @return true if the walk has been cancelled
* @throws IOException if an I/O Error occurs
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected boolean handleIsCancelled(
final File file, final int depth, final Collection<T> results) throws IOException {
// do nothing - overridable by subclass
@@ -479,6 +480,7 @@ protected void handleCancelled(final File startDirectory, final Collection<T> re
* @param results the collection of result objects, may be updated
* @throws IOException if an I/O Error occurs
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void handleStart(final File startDirectory, final Collection<T> results) throws IOException {
// do nothing - overridable by subclass
}
@@ -500,6 +502,7 @@ protected void handleStart(final File startDirectory, final Collection<T> result
* @return true to process this directory, false to skip this directory
* @throws IOException if an I/O Error occurs
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected boolean handleDirectory(final File directory, final int depth, final Collection<T> results) throws
IOException {
// do nothing - overridable by subclass
@@ -517,6 +520,7 @@ protected boolean handleDirectory(final File directory, final int depth, final C
* @param results the collection of result objects, may be updated
* @throws IOException if an I/O Error occurs
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void handleDirectoryStart(final File directory, final int depth, final Collection<T> results) throws
IOException {
// do nothing - overridable by subclass
@@ -535,6 +539,7 @@ protected void handleDirectoryStart(final File directory, final int depth, final
* @throws IOException if an I/O Error occurs
* @since 2.0
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected File[] filterDirectoryContents(final File directory, final int depth, final File... files) throws
IOException {
return files;
@@ -551,6 +556,7 @@ protected void handleDirectoryStart(final File directory, final int depth, final
* @param results the collection of result objects, may be updated
* @throws IOException if an I/O Error occurs
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void handleFile(final File file, final int depth, final Collection<T> results) throws IOException {
// do nothing - overridable by subclass
}
@@ -566,6 +572,7 @@ protected void handleFile(final File file, final int depth, final Collection<T>
* @param results the collection of result objects, may be updated
* @throws IOException if an I/O Error occurs
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void handleRestricted(final File directory, final int depth, final Collection<T> results) throws
IOException {
// do nothing - overridable by subclass
@@ -582,6 +589,7 @@ protected void handleRestricted(final File directory, final int depth, final Col
* @param results the collection of result objects, may be updated
* @throws IOException if an I/O Error occurs
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void handleDirectoryEnd(final File directory, final int depth, final Collection<T> results) throws
IOException {
// do nothing - overridable by subclass
@@ -596,6 +604,7 @@ protected void handleDirectoryEnd(final File directory, final int depth, final C
* @param results the collection of result objects, may be updated
* @throws IOException if an I/O Error occurs
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void handleEnd(final Collection<T> results) throws IOException {
// do nothing - overridable by subclass
}

MODIFY
src/main/java/org/apache/commons/io/input/ObservableInputStream.java
src/main/java/org/apache/commons/io/input/ObservableInputStream.java
* on the {@link ObservableInputStream}, and will return a value.
* @param pByte The value, which is being returned. This will never be -1 (EOF),
* because, in that case, {@link #finished()} will be invoked instead.
- * @throws IOException if an I/O error occurs
+ * @throws IOException if an I/O error occurs.
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
public void data(final int pByte) throws IOException {
// noop
}
@@ -62,8 +63,9 @@ public void data(final int pByte) throws IOException {
* data has been stored.
* @param pOffset The offset within the byte array, where data has been stored.
* @param pLength The number of bytes, which have been stored in the byte array.
- * @throws IOException if an I/O error occurs
+ * @throws IOException if an I/O error occurs.
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
public void data(final byte[] pBuffer, final int pOffset, final int pLength) throws IOException {
// noop
}
@@ -73,16 +75,18 @@ public void data(final byte[] pBuffer, final int pOffset, final int pLength) thr
* This method may be called multiple times, if the reader keeps invoking
* either of the read methods, and they will consequently keep returning
* EOF.
- * @throws IOException if an I/O error occurs
+ * @throws IOException if an I/O error occurs.
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
public void finished() throws IOException {
// noop
}
/**
* Called to indicate that the {@link ObservableInputStream} has been closed.
- * @throws IOException if an I/O error occurs
+ * @throws IOException if an I/O error occurs.
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
public void closed() throws IOException {
// noop
}
@@ -90,7 +94,7 @@ public void closed() throws IOException {
/**
* Called to indicate that an error occurred on the underlying stream.
* @param pException the exception to throw
- * @throws IOException if an I/O error occurs
+ * @throws IOException if an I/O error occurs.
*/
public void error(final IOException pException) throws IOException {
throw pException;

MODIFY
src/main/java/org/apache/commons/io/input/ProxyInputStream.java
src/main/java/org/apache/commons/io/input/ProxyInputStream.java
@@ -197,6 +197,7 @@ public boolean markSupported() {
* @param n number of bytes that the caller asked to be read
* @throws IOException if the pre-processing fails
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void beforeRead(final int n) throws IOException {
// no-op
}
@@ -218,6 +219,7 @@ protected void beforeRead(final int n) throws IOException {
* @param n number of bytes read, or -1 if the end of stream was reached
* @throws IOException if the post-processing fails
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void afterRead(final int n) throws IOException {
// no-op
}

MODIFY
src/main/java/org/apache/commons/io/input/ProxyReader.java
src/main/java/org/apache/commons/io/input/ProxyReader.java
@@ -223,6 +223,7 @@ public boolean markSupported() {
* @param n number of chars that the caller asked to be read
* @throws IOException if the pre-processing fails
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void beforeRead(final int n) throws IOException {
// noop
}
@@ -244,6 +245,7 @@ protected void beforeRead(final int n) throws IOException {
* @param n number of chars read, or -1 if the end of stream was reached
* @throws IOException if the post-processing fails
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void afterRead(final int n) throws IOException {
// noop
}

MODIFY
src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java
src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java
@@ -274,6 +274,7 @@ public void removeListener(final FileAlterationListener listener) {
*
* @throws Exception if an error occurs
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
public void initialize() throws Exception {
rootEntry.refresh(rootEntry.getFile());
final FileEntry[] children = doListFiles(rootEntry.getFile(), rootEntry);
@@ -285,6 +286,7 @@ public void initialize() throws Exception {
*
* @throws Exception if an error occurs
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
public void destroy() throws Exception {
// noop
}

MODIFY
src/main/java/org/apache/commons/io/output/ProxyCollectionWriter.java
src/main/java/org/apache/commons/io/output/ProxyCollectionWriter.java
@@ -64,6 +64,7 @@ public ProxyCollectionWriter(final Writer... writers) {
* @param n number of chars written
* @throws IOException if the post-processing fails
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void afterWrite(final int n) throws IOException {
// noop
}
@@ -140,6 +141,7 @@ public Writer append(final CharSequence csq, final int start, final int end) thr
* @param n number of chars to be written
* @throws IOException if the pre-processing fails
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void beforeWrite(final int n) throws IOException {
// noop
}

MODIFY
src/main/java/org/apache/commons/io/output/ProxyOutputStream.java
src/main/java/org/apache/commons/io/output/ProxyOutputStream.java
@@ -130,6 +130,7 @@ public void close() throws IOException {
* @param n number of bytes to be written
* @throws IOException if the pre-processing fails
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void beforeWrite(final int n) throws IOException {
// noop
}
@@ -148,6 +149,7 @@ protected void beforeWrite(final int n) throws IOException {
* @param n number of bytes written
* @throws IOException if the post-processing fails
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void afterWrite(final int n) throws IOException {
// noop
}

MODIFY
src/main/java/org/apache/commons/io/output/ProxyWriter.java
src/main/java/org/apache/commons/io/output/ProxyWriter.java
@@ -222,6 +222,7 @@ public void close() throws IOException {
* @param n number of chars to be written
* @throws IOException if the pre-processing fails
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void beforeWrite(final int n) throws IOException {
// noop
}
@@ -241,6 +242,7 @@ protected void beforeWrite(final int n) throws IOException {
* @param n number of chars written
* @throws IOException if the post-processing fails
*/
+ @SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void afterWrite(final int n) throws IOException {
// noop
}

Add '@SuppressWarnings("unused") // Possibly thrown from subclasses' to
eliminate compiler warnings.