title: Java DNS API not working
body: <p>I cant seem to figure out how to get this code to work properly.  Am I doing something wrong? the program fails on the Record[] records = lookup.run(); line.</p>
  
  <pre><code>import java.util.Iterator;
  
      import org.xbill.DNS.ARecord;
      import org.xbill.DNS.Lookup;
      import org.xbill.DNS.Record;
      import org.xbill.DNS.TXTRecord;
      import org.xbill.DNS.TextParseException;
      import org.xbill.DNS.Type;
      Lookup lookup;
      try {
          lookup = new Lookup("google.com", Type.ANY);
          Record[] records = lookup.run();
  
          if (lookup.getResult() == Lookup.SUCCESSFUL) {
              String responseMessage = null;
              String listingType = null;
              for (int i = 0; i &lt; records.length; i++) {
                  if (records[i] instanceof TXTRecord) {
                      TXTRecord txt = (TXTRecord) records[i];
  
                      for (Iterator j = txt.getStrings().iterator(); j.hasNext();) {
                          responseMessage += (String) j.next();
                      }
                  } else if (records[i] instanceof ARecord) {
                      listingType = ((ARecord) records[i]).getAddress()
                              .getHostAddress();
                  }
              }
          }
      }catch (TextParseException e) {
          e.printStackTrace();
      }
  </code></pre>