You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2019/03/06 16:21:29 UTC
[tomcat] branch master updated: NIO2 should use
SocketTimeoutException
This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new 0969485 NIO2 should use SocketTimeoutException
0969485 is described below
commit 09694859e475c7bdb2a522fb4325bf06b4e80193
Author: remm <re...@apache.org>
AuthorDate: Wed Mar 6 17:21:19 2019 +0100
NIO2 should use SocketTimeoutException
Harmonize on SocketTimeoutException instead of mixing it with
InterruptedByTimeout. Remove exception replacement in websockets code.
---
java/org/apache/tomcat/util/net/Nio2Endpoint.java | 5 ++++-
.../apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java | 4 ----
webapps/docs/changelog.xml | 4 ++++
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index bba8d97..7bd7191 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -30,6 +30,7 @@ import java.nio.channels.AsynchronousSocketChannel;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.CompletionHandler;
import java.nio.channels.FileChannel;
+import java.nio.channels.InterruptedByTimeoutException;
import java.nio.channels.NetworkChannel;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
@@ -1172,7 +1173,9 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS
@Override
public void failed(Throwable exc, OperationState<A> state) {
IOException ioe;
- if (exc instanceof IOException) {
+ if (exc instanceof InterruptedByTimeoutException) {
+ ioe = new SocketTimeoutException();
+ } else if (exc instanceof IOException) {
ioe = (IOException) exc;
} else {
ioe = new IOException(exc);
diff --git a/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java b/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
index 30a10a6..301d25c 100644
--- a/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
+++ b/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
@@ -21,7 +21,6 @@ import java.io.IOException;
import java.net.SocketTimeoutException;
import java.nio.ByteBuffer;
import java.nio.channels.CompletionHandler;
-import java.nio.channels.InterruptedByTimeoutException;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
@@ -110,9 +109,6 @@ public class WsRemoteEndpointImplServer extends WsRemoteEndpointImplBase {
}
@Override
public void failed(Throwable exc, Void attachment) {
- if (exc instanceof InterruptedByTimeoutException) {
- exc = new SocketTimeoutException();
- }
if (block) {
SendResult sr = new SendResult(exc);
handler.onResult(sr);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 914b36b..86830b0 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -115,6 +115,10 @@
<a href="https://bugs.openjdk.java.net/browse/JDK-8157404">JRE KeyStore
loading bug</a>. (markt)
</add>
+ <fix>
+ NIO2 should try to use SocketTimeoutException everywhere rather than a
+ mix of it and InterruptedByTimeout. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="WebSocket">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org