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 2014/04/27 13:25:39 UTC

svn commit: r1590378 - in /tomcat/trunk/java/org/apache/coyote/http11: InternalNio2InputBuffer.java InternalNio2OutputBuffer.java upgrade/Nio2ServletInputStream.java upgrade/Nio2ServletOutputStream.java

Author: remm
Date: Sun Apr 27 11:25:39 2014
New Revision: 1590378

URL: http://svn.apache.org/r1590378
Log:
Since I looked at the traces, replace exception wrap with unwrap for IOException.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/InternalNio2InputBuffer.java
    tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
    tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java
    tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletOutputStream.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalNio2InputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNio2InputBuffer.java?rev=1590378&r1=1590377&r2=1590378&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNio2InputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNio2InputBuffer.java Sun Apr 27 11:25:39 2014
@@ -219,7 +219,13 @@ public class InternalNio2InputBuffer ext
                 try {
                     nRead = socket.getSocket().read(byteBuffer)
                             .get(socket.getTimeout(), TimeUnit.MILLISECONDS).intValue();
-                } catch (InterruptedException | ExecutionException e) {
+                } catch (ExecutionException e) {
+                    if (e.getCause() != null && e.getCause() instanceof IOException) {
+                        throw (IOException) e.getCause();
+                    } else {
+                        throw new IOException(e);
+                    }
+                } catch (InterruptedException e) {
                     throw new IOException(e);
                 } catch (TimeoutException e) {
                     throw new SocketTimeoutException();

Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java?rev=1590378&r1=1590377&r2=1590378&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java Sun Apr 27 11:25:39 2014
@@ -399,7 +399,13 @@ public class InternalNio2OutputBuffer ex
                         throw new EOFException(sm.getString("iob.failedwrite"));
                     }
                 }
-            } catch (InterruptedException | ExecutionException e) {
+            } catch (ExecutionException e) {
+                if (e.getCause() != null && e.getCause() instanceof IOException) {
+                    throw (IOException) e.getCause();
+                } else {
+                    throw new IOException(e);
+                }
+            } catch (InterruptedException e) {
                 throw new IOException(e);
             } catch (TimeoutException e) {
                 throw new SocketTimeoutException();

Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java?rev=1590378&r1=1590377&r2=1590378&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java Sun Apr 27 11:25:39 2014
@@ -206,7 +206,15 @@ public class Nio2ServletInputStream exte
                 nRead = channel.read(readBuffer)
                         .get(wrapper.getTimeout(), TimeUnit.MILLISECONDS).intValue();
                 readPending = false;
-            } catch (InterruptedException | ExecutionException e) {
+            } catch (ExecutionException e) {
+                if (e.getCause() != null && e.getCause() instanceof IOException) {
+                    onError(e.getCause());
+                    throw (IOException) e.getCause();
+                } else {
+                    onError(e);
+                    throw new IOException(e);
+                }
+            } catch (InterruptedException e) {
                 onError(e);
                 throw new IOException(e);
             } catch (TimeoutException e) {

Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletOutputStream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletOutputStream.java?rev=1590378&r1=1590377&r2=1590378&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletOutputStream.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletOutputStream.java Sun Apr 27 11:25:39 2014
@@ -129,7 +129,15 @@ public class Nio2ServletOutputStream ext
             buffer.flip();
             try {
                 written = channel.write(buffer).get(socketWrapper.getTimeout(), TimeUnit.MILLISECONDS).intValue();
-            } catch (InterruptedException | ExecutionException e) {
+            } catch (ExecutionException e) {
+                if (e.getCause() != null && e.getCause() instanceof IOException) {
+                    onError(e.getCause());
+                    throw (IOException) e.getCause();
+                } else {
+                    onError(e);
+                    throw new IOException(e);
+                }
+            } catch (InterruptedException e) {
                 onError(e);
                 throw new IOException(e);
             } catch (TimeoutException e) {
@@ -161,7 +169,15 @@ public class Nio2ServletOutputStream ext
             } else {
                 throw new TimeoutException();
             }
-        } catch (InterruptedException | ExecutionException e) {
+        } catch (ExecutionException e) {
+            if (e.getCause() != null && e.getCause() instanceof IOException) {
+                onError(e.getCause());
+                throw (IOException) e.getCause();
+            } else {
+                onError(e);
+                throw new IOException(e);
+            }
+        } catch (InterruptedException e) {
             onError(e);
             throw new IOException(e);
         } catch (TimeoutException e) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org