]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/util/DNSUtil.java
upd: web of trust is not visible for organisations.
[gigi.git] / src / org / cacert / gigi / util / DNSUtil.java
index 816b24731bc576635096e30ab691b1fb9e5e6b9b..f1d5f9f3a86f9415aed483486ae857c5764c9dc2 100644 (file)
@@ -36,12 +36,16 @@ public class DNSUtil {
         env.put(Context.AUTHORITATIVE, "true");
         env.put(Context.PROVIDER_URL, "dns://" + server);
         InitialDirContext context = new InitialDirContext(env);
+        try {
 
-        Attributes dnsLookup = context.getAttributes(name, new String[] {
-            "TXT"
-        });
+            Attributes dnsLookup = context.getAttributes(name, new String[] {
+                "TXT"
+            });
+            return extractTextEntries(dnsLookup.get("TXT"));
+        } finally {
+            context.close();
+        }
 
-        return extractTextEntries(dnsLookup.get("TXT"));
     }
 
     private static String[] extractTextEntries(Attribute nsRecords) throws NamingException {