Skip to content

Commit 841618a

Browse files
committed
TelnetInputStream.read() doesn't preserve the original
InterruptedException as the cause of its InterruptedIOException.
1 parent d4de715 commit 841618a

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ The <action> type attribute can be add,update,fix,remove.
7070
<action type="fix" dev="ggregory" due-to="Gary Gregory">IOUtil.readWrite() now restores the current thread's interrupt flag when catching InterruptedException.</action>
7171
<action type="fix" dev="ggregory" due-to="Gary Gregory">TelnetInputStream now restores the current thread's interrupt flag when catching InterruptedException.</action>
7272
<action type="fix" dev="ggregory" due-to="Jianwei Guo, Gary Gregory" issue="NET-740">FTP fails to parse listings for Linux vsftpd in Chinese or Japanese #393.</action>
73+
<action type="fix" dev="ggregory" due-to="Gary Gregory">TelnetInputStream.read() doesn't preserve the original InterruptedException as the cause of its InterruptedIOException.</action>
7374
<!-- ADD -->
7475
<action type="add" dev="ggregory" due-to="Gary Gregory">Add DatagramSocketClient.getDefaultTimeoutDuration() and deprecate getDefaultTimeout().</action>
7576
<!-- UPDATE -->

src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,9 @@ public int read() throws IOException {
199199
readIsWaiting = false;
200200
} catch (final InterruptedException e) {
201201
Thread.currentThread().interrupt();
202-
throw new InterruptedIOException("Fatal thread interruption during read.");
202+
final InterruptedIOException interruptedIoException = new InterruptedIOException("Fatal thread interruption during read.");
203+
interruptedIoException.initCause(e);
204+
throw interruptedIoException;
203205
}
204206
} else {
205207
// alreadyread = false;

0 commit comments

Comments
 (0)