< prev index next >

src/share/classes/sun/security/ssl/SSLSocketImpl.java

Print this page
rev 14406 : 8239798: SSLSocket closes socket both socket endpoints on a SocketTimeoutException
Reviewed-by: xuelei
Contributed-by: alexey@azul.com verghese@amazon.com

@@ -432,10 +432,12 @@
                 //
                 // Handle handshake messages only, need no application data.
                 if (!conContext.isNegotiated) {
                     readHandshakeRecord();
                 }
+            } catch (InterruptedIOException iioe) {
+                handleException(iioe);
             } catch (IOException ioe) {
                 throw conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "Couldn't kickstart handshaking", ioe);
             } catch (Exception oe) {    // including RuntimeException
                 handleException(oe);

@@ -1293,16 +1295,15 @@
                         conContext.isNegotiated) {
                     return 0;
                 }
             } catch (SSLException ssle) {
                 throw ssle;
+            } catch (InterruptedIOException iioe) {
+                // don't change exception in case of timeouts or interrupts
+                throw iioe;
             } catch (IOException ioe) {
-                if (!(ioe instanceof SSLException)) {
                     throw new SSLException("readHandshakeRecord", ioe);
-                } else {
-                    throw ioe;
-                }
             }
         }
 
         return -1;
     }

@@ -1359,10 +1360,13 @@
                         buffer.position() > 0) {
                     return buffer;
                 }
             } catch (SSLException ssle) {
                 throw ssle;
+            } catch (InterruptedIOException iioe) {
+                // don't change exception in case of timeouts or interrupts
+                throw iioe;
             } catch (IOException ioe) {
                 if (!(ioe instanceof SSLException)) {
                     throw new SSLException("readApplicationRecord", ioe);
                 } else {
                     throw ioe;
< prev index next >