Skip to content

Commit 64f321b

Browse files
committed
Let subclasses of CountingInputStream.afterRead(int) throw IOException
1 parent 245509b commit 64f321b

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ The <action> type attribute can be add,update,fix,remove.
8484
<action dev="ggregory" type="fix" issue="IO-818" due-to="Gary Gregory">NullInputStream breaks InputStream's read method contract.</action>
8585
<action dev="ggregory" type="fix" due-to="Elliotte Rusty Harold">Javadoc shouldn't reference 1.x behavior #539.</action>
8686
<action dev="ggregory" type="fix" issue="IO-829" due-to="Elliotte Rusty Harold, Gary Gregory">Don't decode and reencode characters in a potentially different charset in AbstractOrigin.CharSequenceOrigin.getReader(Charset).</action>
87+
<action dev="ggregory" type="fix" due-to="Gary Gregory">Let subclasses of CountingInputStream.afterRead(int) throw IOException.</action>
8788
<!-- Add -->
8889
<action dev="ggregory" type="add" due-to="Gary Gregory">Add and use PathUtils.getFileName(Path, Function&lt;Path, R&gt;).</action>
8990
<action dev="ggregory" type="add" due-to="Gary Gregory">Add and use PathUtils.getFileNameString().</action>

src/main/java/org/apache/commons/io/input/CountingInputStream.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ public CountingInputStream(final InputStream in) {
4747
* Adds the number of read bytes to the count.
4848
*
4949
* @param n number of bytes read, or -1 if no more bytes are available
50+
* @throws IOException Not thrown here but subclasses may throw.
5051
* @since 2.0
5152
*/
5253
@Override
53-
protected synchronized void afterRead(final int n) {
54+
protected synchronized void afterRead(final int n) throws IOException {
5455
if (n != EOF) {
5556
count += n;
5657
}

0 commit comments

Comments
 (0)