[JAVA-4423] DefaultDnsResolver should conditionally set Context.PROVIDER_URL to "dns:" Created: 10/Dec/21  Updated: 28/Oct/23  Resolved: 11/Jan/22

Status: Closed
Project: Java Driver
Component/s: Connection Management
Affects Version/s: None
Fix Version/s: 4.5.0

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

Issue Links:
Problem/Incident
is caused by JAVA-3402 Unable to use mongo+srv scheme when j... Closed
Backwards Compatibility: Minor Change
Documentation Changes: Not Needed

 Description   

Based on Oracle documentation on DNS Service Provider for the JNDI, Context.PROVIDER_URL ("java.naming.provider.url") may be used to specify a set of DNS servers to use. Currently, our DefaultDnsResolver always sets this environment property to "dns:" when creating InitialDirContext. This means that if a user specifies a URI with the dns scheme as a value of this property to override the set of DNS servers, the driver ignores that. Maybe we should only set Context.PROVIDER_URL if its value is not already a URI with the dns scheme.



 Comments   
Comment by Githook User [ 11/Jan/22 ]

Author:

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

Message: Only override Context.PROVIDER_URL if the default isn't supported (#853)

JAVA-4423
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/30eb7947bb1ee61194af59bf5271e3e219029d4d

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