JDK-8215443 : The use of TransportContext.fatal() leads to bad coding style
  • Type: Bug
  • Component: security-libs
  • Sub-Component: javax.net.ssl
  • Affected Version: 11,12,13
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-12-15
  • Updated: 2020-09-16
  • Resolved: 2018-12-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12 JDK 13 JDK 8
11.0.4Fixed 12 b25Fixed 13Fixed 8u271Fixed
Related Reports
Relates :  
Description
The TransportContext.fatal() always throw exception.  The code that use the method looks a little bit unusual:

     shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, "...");
     return null;    // make the complier happy 

The return statement is never get executed.  However, if remove the return statement, the compiler may not happy with it, or the code reader will continue read more of the code and lead to confusing logic.

Maybe, using throw statement directly could be an alternative improvement:
-     shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, "...");
-     return null;    // make the complier happy 
+    throw  shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, "...");
Comments
After all, this does not affect 8u, because TLS 1.3 implementation picked up all the affected files in this changeset from 11.0.7 version, which already includes this backport. See JDK-8245468. Therefore, openjdk8u-WNF.
16-09-2020

For 8u, this depends on JDK-8196584 being backported first.
29-07-2020

Fix Request Backporting this cleanup change to 11u opens up the way to cleanly backport actual bugfixes: JDK-8215790 and JDK-8219389 -- which would otherwise fail due to rewired control flow. Patch applies cleanly to 11u and passes jdk_security test suite.
12-03-2019