You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2026/01/28 21:03:50 UTC
(commons-net) 05/05: TelnetInputStream now restores the current thread's interrupt flag when catching InterruptedException.
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-net.git
commit 827e87c848dea005047295a4328fe0d2b8e3a629
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Jan 28 16:03:39 2026 -0500
TelnetInputStream now restores the current thread's interrupt flag when
catching InterruptedException.
---
src/changes/changes.xml | 1 +
src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 1ef82c49..b5fa87a9 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -68,6 +68,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix malformed Javadoc comments.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">IMAPExportMbox now restores the current thread's interrupt flag when catching InterruptedException.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">IOUtil.readWrite() now restores the current thread's interrupt flag when catching InterruptedException.</action>
+ <action type="fix" dev="ggregory" due-to="Gary Gregory">TelnetInputStream now restores the current thread's interrupt flag when catching InterruptedException.</action>
<!-- ADD -->
<action type="add" dev="ggregory" due-to="Gary Gregory">Add DatagramSocketClient.getDefaultTimeoutDuration() and deprecate getDefaultTimeout().</action>
<!-- UPDATE -->
diff --git a/src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java b/src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java
index 36ebda62..755b740e 100644
--- a/src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java
+++ b/src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java
@@ -149,6 +149,7 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable {
try {
queue.wait();
} catch (final InterruptedException e) {
+ Thread.currentThread().interrupt();
throw e;
}
}
@@ -197,6 +198,7 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable {
queue.wait();
readIsWaiting = false;
} catch (final InterruptedException e) {
+ Thread.currentThread().interrupt();
throw new InterruptedIOException("Fatal thread interruption during read.");
}
} else {
@@ -218,7 +220,7 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable {
try {
queue.wait(100);
} catch (final InterruptedException interrupted) {
- // Ignored
+ Thread.currentThread().interrupt();
}
}
return EOF;
@@ -229,6 +231,7 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable {
processChar(ch);
}
} catch (final InterruptedException e) {
+ Thread.currentThread().interrupt();
if (isClosed) {
return EOF;
}
@@ -508,6 +511,7 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable {
try {
queue.wait(100);
} catch (final InterruptedException interrupted) {
+ Thread.currentThread().interrupt();
if (isClosed) {
break _outerLoop;
}
@@ -529,6 +533,7 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable {
try {
notify = processChar(ch);
} catch (final InterruptedException e) {
+ Thread.currentThread().interrupt();
if (isClosed) {
break _outerLoop;
}