This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git
The following commit(s) were added to refs/heads/master by this push:
new 88f75b8 [IO-617] Add classes Added TaggedReader, ClosedReader and
BrokenReader. #85.
88f75b8 is described below
commit 88f75b884e579d7cdf8448bd4c2a0e15191850f2
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Aug 9 14:07:31 2019 -0400
[IO-617] Add classes Added TaggedReader, ClosedReader and BrokenReader.
#85.
- Javadoc: Close HTML tags.
- Format: Line width 120.
---
.../org/apache/commons/io/input/BrokenReader.java | 1 +
.../org/apache/commons/io/input/ClosedReader.java | 12 ++++------
.../org/apache/commons/io/input/TaggedReader.java | 27 ++++++++++------------
.../apache/commons/io/input/TaggedReaderTest.java | 11 ++++-----
4 files changed, 22 insertions(+), 29 deletions(-)
diff --git a/src/main/java/org/apache/commons/io/input/BrokenReader.java
b/src/main/java/org/apache/commons/io/input/BrokenReader.java
index 2b7c42e..d13e401 100644
--- a/src/main/java/org/apache/commons/io/input/BrokenReader.java
+++ b/src/main/java/org/apache/commons/io/input/BrokenReader.java
@@ -25,6 +25,7 @@ import java.io.Reader;
* <p>
* This class is mostly useful for testing error handling in code that uses a
* reader.
+ * </p>
*
* @since 2.7
*/
diff --git a/src/main/java/org/apache/commons/io/input/ClosedReader.java
b/src/main/java/org/apache/commons/io/input/ClosedReader.java
index a425e0a..dc906b8 100644
--- a/src/main/java/org/apache/commons/io/input/ClosedReader.java
+++ b/src/main/java/org/apache/commons/io/input/ClosedReader.java
@@ -22,12 +22,10 @@ import java.io.IOException;
import java.io.Reader;
/**
- * Closed reader. This reader returns EOF to all attempts to read
- * something from it.
+ * Closed reader. This reader returns EOF to all attempts to read something
from it.
* <p>
- * Typically uses of this class include testing for corner cases in methods
- * that accept readers and acting as a sentinel value instead of a
- * {@code null} reader.
+ * Typically uses of this class include testing for corner cases in methods
that accept readers and acting as a sentinel
+ * value instead of a {@code null} reader.
* </p>
*
* @since 2.7
@@ -43,8 +41,8 @@ public class ClosedReader extends Reader {
* Returns -1 to indicate that the stream is closed.
*
* @param cbuf ignored
- * @param off ignored
- * @param len ignored
+ * @param off ignored
+ * @param len ignored
* @return always -1
*/
@Override
diff --git a/src/main/java/org/apache/commons/io/input/TaggedReader.java
b/src/main/java/org/apache/commons/io/input/TaggedReader.java
index b771792..0227dd9 100644
--- a/src/main/java/org/apache/commons/io/input/TaggedReader.java
+++ b/src/main/java/org/apache/commons/io/input/TaggedReader.java
@@ -24,10 +24,10 @@ import java.util.UUID;
import org.apache.commons.io.TaggedIOException;
/**
- * A reader decorator that tags potential exceptions so that the
- * reader that caused the exception can easily be identified. This is
- * done by using the {@link TaggedIOException} class to wrap all thrown
- * {@link IOException}s. See below for an example of using this class.
+ * A reader decorator that tags potential exceptions so that the reader that
caused the exception can easily be
+ * identified. This is done by using the {@link TaggedIOException} class to
wrap all thrown {@link IOException}s. See
+ * below for an example of using this class.
+ *
* <pre>
* TaggedReader reader = new TaggedReader(...);
* try {
@@ -44,10 +44,10 @@ import org.apache.commons.io.TaggedIOException;
* }
* </pre>
* <p>
- * Alternatively, the {@link #throwIfCauseOf(Throwable)} method can be
- * used to let higher levels of code handle the exception caused by this
- * reader while other processing errors are being taken care of at this
- * lower level.
+ * Alternatively, the {@link #throwIfCauseOf(Throwable)} method can be used to
let higher levels of code handle the
+ * exception caused by this reader while other processing errors are being
taken care of at this lower level.
+ * </p>
+ *
* <pre>
* TaggedReader reader = new TaggedReader(...);
* try {
@@ -81,19 +81,16 @@ public class TaggedReader extends ProxyReader {
* Tests if the given exception was caused by this reader.
*
* @param exception an exception
- * @return {@code true} if the exception was thrown by this reader,
- * {@code false} otherwise
+ * @return {@code true} if the exception was thrown by this reader, {@code
false} otherwise
*/
public boolean isCauseOf(final Throwable exception) {
return TaggedIOException.isTaggedWith(exception, tag);
}
/**
- * Re-throws the original exception thrown by this reader. This method
- * first checks whether the given exception is a {@link TaggedIOException}
- * wrapper created by this decorator, and then unwraps and throws the
- * original wrapped exception. Returns normally if the exception was
- * not thrown by this reader.
+ * Re-throws the original exception thrown by this reader. This method
first checks whether the given exception is a
+ * {@link TaggedIOException} wrapper created by this decorator, and then
unwraps and throws the original wrapped
+ * exception. Returns normally if the exception was not thrown by this
reader.
*
* @param throwable an exception
* @throws IOException original exception, if any, thrown by this reader
diff --git a/src/test/java/org/apache/commons/io/input/TaggedReaderTest.java
b/src/test/java/org/apache/commons/io/input/TaggedReaderTest.java
index 6be26c8..d5d6a97 100644
--- a/src/test/java/org/apache/commons/io/input/TaggedReaderTest.java
+++ b/src/test/java/org/apache/commons/io/input/TaggedReaderTest.java
@@ -32,7 +32,7 @@ import org.junit.Test;
/**
* JUnit Test Case for {@link TaggedReader}.
*/
-public class TaggedReaderTest {
+public class TaggedReaderTest {
@Test
public void testEmptyReader() throws IOException {
@@ -61,8 +61,7 @@ public class TaggedReaderTest {
@Test
public void testBrokenReader() {
final IOException exception = new IOException("test exception");
- final TaggedReader reader =
- new TaggedReader(new BrokenReader(exception));
+ final TaggedReader reader = new TaggedReader(new
BrokenReader(exception));
// Test the ready() method
try {
@@ -114,13 +113,11 @@ public class TaggedReaderTest {
final TaggedReader reader = new TaggedReader(closed);
assertFalse(reader.isCauseOf(exception));
- assertFalse(reader.isCauseOf(
- new TaggedIOException(exception, UUID.randomUUID())));
+ assertFalse(reader.isCauseOf(new TaggedIOException(exception,
UUID.randomUUID())));
reader.throwIfCauseOf(exception);
- reader.throwIfCauseOf(
- new TaggedIOException(exception, UUID.randomUUID()));
+ reader.throwIfCauseOf(new TaggedIOException(exception,
UUID.randomUUID()));
reader.close();
}