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 17:00:36 UTC

[tomcat] branch 8.5.x updated: NIO2 should use SocketTimeoutException

This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 12bfd3d  NIO2 should use SocketTimeoutException
12bfd3d is described below

commit 12bfd3de3eac97d230cc4170ac0ad782f35f1c7a
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.
    # Conflicts:
    #	java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
    #	webapps/docs/changelog.xml
---
 java/org/apache/tomcat/util/net/Nio2Endpoint.java | 5 ++++-
 webapps/docs/changelog.xml                        | 4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index b551659..3a63503 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.concurrent.ExecutionException;
@@ -1146,7 +1147,9 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel> {
             @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/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index bdc69cf..90297df 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -156,6 +156,10 @@
       <update>
         Sync with NIO2 async API from Tomcat 9 branch. (remm)
       </update>
+      <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