This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new de13e47a28 Partial fix for BZ 69920. Writer and OutputStream.
de13e47a28 is described below
commit de13e47a28213ff85bc5db06df3a3a82fe9be458
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 b14279eebe..8ba7f884fd 100644
--- a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
+++ b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
@@ -1059,9 +1059,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"));
}
}
@@ -1137,9 +1137,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 be5da91c85..64d14705b3 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -209,6 +209,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>
<add>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]