src/java.base/share/classes/sun/security/ssl/TransportContext.java
changeset 53064 103ed9569fc8
parent 53056 9041178a0b69
child 53289 5022a4915fe9
--- a/src/java.base/share/classes/sun/security/ssl/TransportContext.java	Tue Dec 18 19:13:54 2018 +0530
+++ b/src/java.base/share/classes/sun/security/ssl/TransportContext.java	Tue Dec 18 12:08:51 2018 -0800
@@ -148,9 +148,8 @@
 
         ContentType ct = ContentType.valueOf(plaintext.contentType);
         if (ct == null) {
-            fatal(Alert.UNEXPECTED_MESSAGE,
+            throw fatal(Alert.UNEXPECTED_MESSAGE,
                 "Unknown content type: " + plaintext.contentType);
-            return;
         }
 
         switch (ct) {
@@ -164,7 +163,7 @@
                                 protocolVersion.useTLS13PlusSpec()) {
                             handshakeContext = new PostHandshakeContext(this);
                         } else {
-                            fatal(Alert.UNEXPECTED_MESSAGE,
+                            throw fatal(Alert.UNEXPECTED_MESSAGE,
                                     "Unexpected post-handshake message: " +
                                     SSLHandshake.nameOf(type));
                         }
@@ -185,7 +184,7 @@
                 if (consumer != null) {
                     consumer.consume(this, plaintext.fragment);
                 } else {
-                    fatal(Alert.UNEXPECTED_MESSAGE,
+                    throw fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unexpected content: " + plaintext.contentType);
                 }
         }
@@ -250,22 +249,22 @@
         }
     }
 
-    void fatal(Alert alert,
+    SSLException fatal(Alert alert,
             String diagnostic) throws SSLException {
-        fatal(alert, diagnostic, null);
+        return fatal(alert, diagnostic, null);
     }
 
-    void fatal(Alert alert, Throwable cause) throws SSLException {
-        fatal(alert, null, cause);
+    SSLException fatal(Alert alert, Throwable cause) throws SSLException {
+        return fatal(alert, null, cause);
     }
 
-    void fatal(Alert alert,
+    SSLException fatal(Alert alert,
             String diagnostic, Throwable cause) throws SSLException {
-        fatal(alert, diagnostic, false, cause);
+        return fatal(alert, diagnostic, false, cause);
     }
 
     // Note: close_notify is not delivered via fatal() methods.
-    void fatal(Alert alert, String diagnostic,
+    SSLException fatal(Alert alert, String diagnostic,
             boolean recvFatalAlert, Throwable cause) throws SSLException {
         // If we've already shutdown because of an error, there is nothing we
         // can do except rethrow the exception.