This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new a90659f8eb Partial fix for BZ 69920. Writer and OutputStream.
a90659f8eb is described below
commit a90659f8ebcac6ab0aa90232614d0807f0bca1a6
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 e83a052822..f8a159fd09 100644
--- a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
+++ b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
@@ -1038,9 +1038,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"));
}
}
@@ -1116,9 +1116,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 c3ab657109..315bac00b5 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -208,6 +208,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]