[JAVA-4915] Can't turn TLS off in connection string if enabled in TXT record Created: 23/Mar/23  Updated: 28/Oct/23  Resolved: 02/Aug/23

Status: Closed
Project: Java Driver
Component/s: Connection String
Affects Version/s: None
Fix Version/s: 4.11.0

Type: Bug Priority: Minor - P4
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Documentation Changes: Not Needed
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

A mongodb+srv connection string with tls=false query parameter throws an exception:

Conflicting tls and ssl parameter values are not allowed
java.lang.IllegalArgumentException: Conflicting tls and ssl parameter values are not allowed
	at com.mongodb.ConnectionString.initializeSslEnabled(ConnectionString.java:656)
	at com.mongodb.ConnectionString.translateOptions(ConnectionString.java:594)
	at com.mongodb.ConnectionString.<init>(ConnectionString.java:410)

Expected results: it should be possible to disable tls this way.

Workaround: use ssl=false instead

Note that mongodb+srv defaults to enabling TLS.



 Comments   
Comment by Jeffrey Yemin [ 02/Aug/23 ]

Not planning to backport this one.

Comment by Githook User [ 02/Aug/23 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Allow tls=false override with mongodb+srv protocol (#1165)

JAVA-4915
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/b212fb8a6edc7a5f26e93b12c0b73459ee59798f

Generated at Thu Feb 08 09:03:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.