Fix NPE in JavaxResolver

Attributes.get(String) could return 'null'. Take care of that case.
This commit is contained in:
Florian Schmaus 2014-05-03 11:17:51 +02:00
parent 9484fb9259
commit 7d72b9b770
1 changed files with 2 additions and 0 deletions

View File

@ -74,6 +74,8 @@ public class JavaxResolver implements DNSResolver {
Attributes dnsLookup = dirContext.getAttributes(name, new String[] { "SRV" });
Attribute srvAttribute = dnsLookup.get("SRV");
if (srvAttribute == null)
return res;
@SuppressWarnings("unchecked")
NamingEnumeration<String> srvRecords = (NamingEnumeration<String>) srvAttribute.getAll();
while (srvRecords.hasMore()) {