Skip to content

Commit d423093

Browse files
committed
Simplifying conditions check
1 parent fcdfa23 commit d423093

2 files changed

Lines changed: 2 additions & 9 deletions

File tree

driver-core/src/main/com/mongodb/internal/connection/DefaultSdamServerDescriptionManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ private void handleException(final SdamIssue sdamIssue, final boolean beforeHand
143143
// clear the pool as they're not related to overload.
144144
// TLS configuration errors (certificate validation, protocol mismatches) should also clear the pool
145145
// as they indicate configuration issues, not server overload.
146-
if (beforeHandshake && (sdamIssue.relatedToNetworkNotTimeout() || sdamIssue.relatedToNetworkTimeout())
147-
&& !sdamIssue.relatedToAuth() && !sdamIssue.relatedToTlsConfigurationError()) {
146+
if (beforeHandshake && !sdamIssue.relatedToAuth() && !sdamIssue.relatedToTlsConfigurationError()) {
148147
// Don't update server description to Unknown
149148
// Don't invalidate the connection pool
150149
// Apply error labels for backpressure

driver-core/src/main/com/mongodb/internal/connection/SdamServerDescriptionManager.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,7 @@ boolean relatedToTlsConfigurationError() {
186186
|| cause instanceof CertPathValidatorException
187187
|| cause instanceof SSLPeerUnverifiedException
188188
|| cause instanceof SSLProtocolException) {
189-
return true; // Certificate/peer validation failure or protocol error
190-
}
191-
192-
// Check for SunCertPathBuilderException by class name to avoid compile-time dependency on internal classes
193-
String className = cause.getClass().getName();
194-
if (className.equals("sun.security.provider.certpath.SunCertPathBuilderException")) {
195-
return true; // Certificate path building failure
189+
return true;
196190
}
197191

198192
// SSLHandshakeException can be either network or config, so we check the message

0 commit comments

Comments
 (0)