HADOOP-15764. [JDK10] Migrate from sun.net.dns.ResolverConfiguration to the replacement. Contributed by Akira Ajisaka.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/429a07e0 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/429a07e0 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/429a07e0 Branch: refs/heads/YARN-1011 Commit: 429a07e08c8c919b1679c0a80df73d147d95e8a6 Parents: 3da94a3 Author: Ewan Higgs <[email protected]> Authored: Thu Sep 20 15:13:55 2018 +0200 Committer: Ewan Higgs <[email protected]> Committed: Thu Sep 20 15:13:55 2018 +0200 ---------------------------------------------------------------------- .../hadoop-client-minicluster/pom.xml | 17 ++++------------- .../hadoop-client-runtime/pom.xml | 11 +++++++++++ hadoop-common-project/hadoop-common/pom.xml | 5 +++++ .../org/apache/hadoop/security/SecurityUtil.java | 19 +++++++++++++------ 4 files changed, 33 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/429a07e0/hadoop-client-modules/hadoop-client-minicluster/pom.xml ---------------------------------------------------------------------- diff --git a/hadoop-client-modules/hadoop-client-minicluster/pom.xml b/hadoop-client-modules/hadoop-client-minicluster/pom.xml index ea8d680..70fca8a 100644 --- a/hadoop-client-modules/hadoop-client-minicluster/pom.xml +++ b/hadoop-client-modules/hadoop-client-minicluster/pom.xml @@ -318,6 +318,10 @@ <groupId>commons-net</groupId> <artifactId>commons-net</artifactId> </exclusion> + <exclusion> + <groupId>dnsjava</groupId> + <artifactId>dnsjava</artifactId> + </exclusion> </exclusions> </dependency> <!-- Add optional runtime dependency on the in-development timeline server module @@ -773,19 +777,6 @@ <exclude>ehcache-core.xsd</exclude> </excludes> </filter> - - <!-- remove utility classes which are not required from - dnsjava --> - <filter> - <artifact>dnsjava:dnsjava</artifact> - <excludes> - <excldue>dig*</excldue> - <exclude>jnamed*</exclude> - <exlcude>lookup*</exlcude> - <exclude>update*</exclude> - </excludes> - </filter> - </filters> <!-- relocate classes from mssql-jdbc --> http://git-wip-us.apache.org/repos/asf/hadoop/blob/429a07e0/hadoop-client-modules/hadoop-client-runtime/pom.xml ---------------------------------------------------------------------- diff --git a/hadoop-client-modules/hadoop-client-runtime/pom.xml b/hadoop-client-modules/hadoop-client-runtime/pom.xml index 532fae9..bfa6c15 100644 --- a/hadoop-client-modules/hadoop-client-runtime/pom.xml +++ b/hadoop-client-modules/hadoop-client-runtime/pom.xml @@ -212,6 +212,17 @@ <exclude>ccache.txt</exclude> </excludes> </filter> + <!-- remove utility classes which are not required from + dnsjava --> + <filter> + <artifact>dnsjava:dnsjava</artifact> + <excludes> + <exclude>dig*</exclude> + <exclude>jnamed*</exclude> + <exclude>lookup*</exclude> + <exclude>update*</exclude> + </excludes> + </filter> </filters> <relocations> <relocation> http://git-wip-us.apache.org/repos/asf/hadoop/blob/429a07e0/hadoop-common-project/hadoop-common/pom.xml ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/pom.xml b/hadoop-common-project/hadoop-common/pom.xml index 695dcde..1e6da92 100644 --- a/hadoop-common-project/hadoop-common/pom.xml +++ b/hadoop-common-project/hadoop-common/pom.xml @@ -324,6 +324,11 @@ <artifactId>mockwebserver</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>dnsjava</groupId> + <artifactId>dnsjava</artifactId> + <scope>compile</scope> + </dependency> </dependencies> <build> http://git-wip-us.apache.org/repos/asf/hadoop/blob/429a07e0/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java index 0de334a..9fea535 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java @@ -27,6 +27,7 @@ import java.net.URI; import java.net.UnknownHostException; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -52,8 +53,9 @@ import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.util.ZKUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -//this will need to be replaced someday when there is a suitable replacement -import sun.net.dns.ResolverConfiguration; +import org.xbill.DNS.Name; +import org.xbill.DNS.ResolverConfig; + import com.google.common.annotations.VisibleForTesting; import com.google.common.net.InetAddresses; @@ -584,10 +586,15 @@ public final class SecurityUtil { * hadoop.security.token.service.use_ip=false */ protected static class QualifiedHostResolver implements HostResolver { - @SuppressWarnings("unchecked") - private List<String> searchDomains = - ResolverConfiguration.open().searchlist(); - + private List<String> searchDomains; + { + ResolverConfig resolverConfig = ResolverConfig.getCurrentConfig(); + searchDomains = new ArrayList<>(); + for (Name name : resolverConfig.searchPath()) { + searchDomains.add(name.toString()); + } + } + /** * Create an InetAddress with a fully qualified hostname of the given * hostname. InetAddress does not qualify an incomplete hostname that --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
