Check if DnsCache is null in DnsNameResolver constructor.

Motivation:

We miss checking if DnsCache is null in DnsNameResolver constructor which will later then lead to a NPE. Better fail fast here.

Modifications:

Check for null and if so throw a NPE.

Result:

Fail fast.
This commit is contained in:
Norman Maurer 2017-01-16 13:06:13 +01:00
parent d37702aa69
commit d7ff71a3d1

View File

@ -196,7 +196,7 @@ public class DnsNameResolver extends InetNameResolver {
this.maxPayloadSize = checkPositive(maxPayloadSize, "maxPayloadSize");
this.optResourceEnabled = optResourceEnabled;
this.hostsFileEntriesResolver = checkNotNull(hostsFileEntriesResolver, "hostsFileEntriesResolver");
this.resolveCache = resolveCache;
this.resolveCache = checkNotNull(resolveCache, "resolveCache");
this.searchDomains = checkNotNull(searchDomains, "searchDomains").clone();
this.ndots = checkPositiveOrZero(ndots, "ndots");