This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new dc2e2500f1 Partial fix for BZ 69920. Writer and OutputStream.
dc2e2500f1 is described below
commit dc2e2500f1ade3dd2db7ab37bed00044581ffa1a
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Jan 14 08:06:35 2026 +0000
Partial fix for BZ 69920. Writer and OutputStream.
Javadoc for Writer is clear IOException is thrown if called when closed
Javadoc for OutputStream suggests throwing IOE if used when closed.
Switch
OutputStream to IOE for consistency with Writer.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69920
---
.../org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java | 8 ++++----
webapps/docs/changelog.xml | 11 +++++++++++
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
index 8f3a56dc6b..196c023a97 100644
--- a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
+++ b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
@@ -1060,9 +1060,9 @@ public abstract class WsRemoteEndpointImplBase implements
RemoteEndpoint {
doWrite(true);
}
- private void checkOpen() {
+ private void checkOpen() throws IOException {
if (closed) {
- throw new
IllegalStateException(sm.getString("wsRemoteEndpoint.closedOutputStream"));
+ throw new
IOException(sm.getString("wsRemoteEndpoint.closedOutputStream"));
}
}
@@ -1138,9 +1138,9 @@ public abstract class WsRemoteEndpointImplBase implements
RemoteEndpoint {
doWrite(true);
}
- private void checkOpen() {
+ private void checkOpen() throws IOException {
if (closed) {
- throw new
IllegalStateException(sm.getString("wsRemoteEndpoint.closedWriter"));
+ throw new
IOException(sm.getString("wsRemoteEndpoint.closedWriter"));
}
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e9f59a605d..da742b1f17 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -211,6 +211,17 @@
</add>
</changelog>
</subsection>
+ <subsection name="WebSocket">
+ <changelog>
+ <fix>
+ <bug>69920</bug>: When attempting to write to a closed
+ <code>Writer</code> or <code>OutputStream</code> obtained from a
+ WebSocket session, throw an <code>IOException</code> rather than an
+ <code>IllegalStateExcpetion</code> as required by <code>Writer</code>
+ and strongly suggested by <code>OutputStream</code>. (markt)
+ </fix>
+ </changelog>
+ </subsection>
<subsection name="Other">
<changelog>
<update>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]