Skip to content

Instantly share code, notes, and snippets.

@lpellegr
Created January 14, 2020 19:12
Show Gist options
  • Save lpellegr/c1948b7a96b3487271a610ff7241dca7 to your computer and use it in GitHub Desktop.
Save lpellegr/c1948b7a96b3487271a610ff7241dca7 to your computer and use it in GitHub Desktop.
DnsJava Issue #8
import org.xbill.DNS.Lookup;
import org.xbill.DNS.Record;
import org.xbill.DNS.TextParseException;
import org.xbill.DNS.Type;
public class DnsJavaTryOut {
public static void main(String[] args) throws TextParseException {
Record[] records = new Lookup("4.4.8.8.in-addr.arpa", Type.PTR).run();
for (Record record : records) {
System.out.println(record);
}
}
}
@lpellegr
Copy link
Author

The library dnsjava is imported in a Gradle project using Jitpack (the artifact is built from the latest commit in the master branch):

repositories {
    mavenCentral()
    maven { url 'https://jitpack.io' }
}

implementation 'com.github.dnsjava:dnsjava:6fc49f31fb'

@lpellegr
Copy link
Author

Here is the output:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.xbill.DNS.config.SunJvmResolverConfigProvider (file:/home/lpellegr/.gradle/caches/modules-2/files-2.1/com.github.dnsjava/dnsjava/6fc49f31fb/d19ccf80683298b133819ccc11b1b032f34ffcc/dnsjava-6fc49f31fb.jar) to method sun.net.dns.ResolverConfiguration.open()
WARNING: Please consider reporting this to the maintainers of org.xbill.DNS.config.SunJvmResolverConfigProvider
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
4.4.8.8.in-addr.arpa. 7270 IN PTR dns.google.

when the code is run with the following Java version:

$ java --version
openjdk 13.0.1 2019-10-15
OpenJDK Runtime Environment AdoptOpenJDK (build 13.0.1+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13.0.1+9, mixed mode, sharing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment