|
@@ -126,12 +126,14 @@ public class SRVRecord implements Comparable<SRVRecord> {
|
126
|
126
|
env.put("java.naming.provider.url", "dns:");
|
127
|
127
|
final Attribute attr = new InitialDirContext(env).getAttributes(host, new String [] { "SRV" }).get("SRV");
|
128
|
128
|
|
129
|
|
- final NamingEnumeration ne = attr.getAll();
|
130
|
|
- while (ne.hasMore()) {
|
131
|
|
- try {
|
132
|
|
- final SRVRecord record = new SRVRecord((String)ne.next());
|
133
|
|
- result.add(record);
|
134
|
|
- } catch (final NamingException nex) { /* Ignore if invalid. */ }
|
|
129
|
+ if (attr != null) {
|
|
130
|
+ final NamingEnumeration ne = attr.getAll();
|
|
131
|
+ while (ne.hasMore()) {
|
|
132
|
+ try {
|
|
133
|
+ final SRVRecord record = new SRVRecord((String)ne.next());
|
|
134
|
+ result.add(record);
|
|
135
|
+ } catch (final NamingException nex) { /* Ignore if invalid. */ }
|
|
136
|
+ }
|
135
|
137
|
}
|
136
|
138
|
} catch (final NamingException nex) { /* Ignore errors. */ }
|
137
|
139
|
|