src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java
branchJDK-8145252-TLS13-branch
changeset 56712 bad9f4c7eeec
parent 56694 aa54a1f8e426
child 56717 e4fe7c97b1de
--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java	Fri Jun 08 16:51:30 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java	Fri Jun 08 19:43:11 2018 -0700
@@ -62,12 +62,16 @@
 
     @Override
     int bytesInCompletePacket() throws IOException {
-
         if (!hasHeader) {
             // read exactly one record
-            int really = read(is, temporary, 0, headerSize);
-            if (really < 0) {
-                // EOF: peer shut down incorrectly
+            try {
+                int really = read(is, temporary, 0, headerSize);
+                if (really < 0) {
+                    // EOF: peer shut down incorrectly
+                    return -1;
+                }
+            } catch (EOFException eofe) {
+                // The caller will handle EOF.
                 return -1;
             }
             hasHeader = true;