src/java.base/share/classes/sun/security/ssl/SSLEngineInputRecord.java
branchJDK-8145252-TLS13-branch
changeset 56717 e4fe7c97b1de
parent 56704 c3ee22c3a0f6
child 56784 6210466cf1ac
--- a/src/java.base/share/classes/sun/security/ssl/SSLEngineInputRecord.java	Sat Jun 09 21:52:54 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SSLEngineInputRecord.java	Sun Jun 10 13:36:40 2018 -0700
@@ -228,15 +228,6 @@
         }
 
         //
-        // check for handshake fragment
-        //
-        if (contentType != ContentType.HANDSHAKE.id &&
-                handshakeBuffer != null && handshakeBuffer.hasRemaining()) {
-            throw new SSLProtocolException(
-                    "Expected to get a handshake fragment");
-        }
-
-        //
         // Decrypt the fragment
         //
         int recLim = srcPos + SSLRecord.headerSize + contentLen;
@@ -261,6 +252,16 @@
         }
 
         //
+        // check for handshake fragment
+        //
+        if (contentType != ContentType.HANDSHAKE.id &&
+                handshakeBuffer != null && handshakeBuffer.hasRemaining()) {
+            throw new SSLProtocolException(
+                    "Expecting a handshake fragment, but received " +
+                    ContentType.nameOf(contentType));
+        }
+
+        //
         // parse handshake messages
         //
         if (contentType == ContentType.HANDSHAKE.id) {