MiniDNS / minidns

DNS library for Android and Java SE
Other
226 stars 61 forks source link

ExceptionInInitializerError when /etc/resolv.conf isn't readable #99

Closed Scarsz closed 5 years ago

Scarsz commented 5 years ago

Not all users running my program have read access to /etc/resolv.conf. When they don't, the entire DnsClient class fails to load.

java.lang.ExceptionInInitializerError
    at github.scarsz.discordsrv.DiscordSRV.init(DiscordSRV.java:377)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.security.AccessControlException: access denied ("java.io.FilePermission" "/etc/resolv.conf" "read")
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
    at java.security.AccessController.checkPermission(AccessController.java:886)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
    at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
    at java.io.File.exists(File.java:814)
    at org.minidns.dnsserverlookup.UnixUsingEtcResolvConf.isAvailable(UnixUsingEtcResolvConf.java:98)
    at org.minidns.DnsClient.addDnsServerLookupMechanism(DnsClient.java:395)
    at org.minidns.DnsClient.(DnsClient.java:55)
    ... 2 more
Flowdalic commented 5 years ago

Thanks for the report. Yes MiniDNS should handle this more gracefully.