--- 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) {