File tree Expand file tree Collapse file tree
main/com/mongodb/internal/connection
test/unit/com/mongodb/internal/connection Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,23 +82,8 @@ private static boolean isTlsConfigurationError(final MongoSocketException t) {
8282 }
8383 if (cause instanceof SSLHandshakeException ) {
8484 String message = cause .getMessage ();
85- if (message != null ) {
86- String lowerMessage = message .toLowerCase (Locale .ROOT );
87- if (lowerMessage .contains ("certificate" )
88- || lowerMessage .contains ("verify" )
89- || lowerMessage .contains ("trust" )
90- || lowerMessage .contains ("hostname" )
91- || lowerMessage .contains ("protocol" )
92- || lowerMessage .contains ("cipher" )
93- // PKIX path building/validation failures surface as SSLHandshakeException
94- // when the underlying CertPath* cause is not in the chain.
95- || lowerMessage .contains ("pkix" )
96- // Any "Received fatal alert: X" from OpenJDK's JSSE provider means the
97- // server actively answered with a TLS protocol error — not an overload
98- // signal. Catches all 25 RFC handshake alert descriptions in one rule.
99- || lowerMessage .contains ("received fatal alert" )) {
100- return true ;
101- }
85+ if (message != null && message .toLowerCase (Locale .ROOT ).contains ("received fatal alert" )) {
86+ return true ;
10287 }
10388 }
10489 cause = cause .getCause ();
Original file line number Diff line number Diff line change @@ -87,8 +87,16 @@ static Stream<Named<Throwable>> localTlsConfigErrorShouldNotBeLabeled() {
8787 named (new CertPathValidatorException ("validation failed" )),
8888 named (new SSLPeerUnverifiedException ("peer not verified" )),
8989 named (new SSLProtocolException ("protocol error" )),
90- named (new SSLHandshakeException ("PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: "
91- + "unable to find valid certification path to requested target" ))
90+ named (initCause (
91+ new SSLHandshakeException ("SSLHandshakeException invoking https://1.2.3.4:8443/api/methodName: "
92+ + "sun.security.validator.ValidatorException: PKIX path building failed" ),
93+ initCause (
94+ new SSLHandshakeException ("sun.security.validator.ValidatorException: "
95+ + "PKIX path building failed: "
96+ + "sun.security.provider.certpath.SunCertPathBuilderException: "
97+ + "unable to find valid certification path to requested target" ),
98+ new CertPathBuilderException (
99+ "unable to find valid certification path to requested target" ))))
92100 );
93101 }
94102
You can’t perform that action at this time.
0 commit comments