IPv6 Nameservers in resolv.conf

Guenther Niess niess at uni-potsdam.de
Tue Oct 12 08:03:49 PDT 2010


Hi,
Linux systems don't require and moreover don't allow to use IPv6
literal host names within delimiting brackets for nameservers in
/etc/resolv.conf. So IPv6 entries have the form:
  nameserver 2001:0db8:85a3:08d3:1319:8a2e:0370:7344
Now, when I try to use a nameserver a NumberFormatException is thrown:
java.lang.NumberFormatException: For input string: "0db8:85a3:08d3:1319:8a2e:0370:7344"
  at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
  at java.lang.Integer.parseInt(Integer.java:481)
  at java.lang.Integer.parseInt(Integer.java:514)
  at com.sun.jndi.dns.DnsClient.<init>(DnsClient.java:122)
  at com.sun.jndi.dns.Resolver.<init>(Resolver.java:61)
  at com.sun.jndi.dns.DnsContext.getResolver(DnsContext.java:570)
  at com.sun.jndi.dns.DnsContext.c_getAttributes(DnsContext.java:430)
  at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:231)
  at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:139)
  at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:127)
  at javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:140)
  at NSLookup.main(NSLookup.java:14)

So I think the JDK should handle IPv6 nameservers and therefore I
attached a small patch which works fine for me.

Best regards
Guenther

PS: I submitted a bug report on bugs.sun.com two months ago (Review ID:
1854941) with no response. So I'm trying this list, maybe the bug 
database isn't used any more.


More information about the jdk7-dev mailing list