1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 09:39:39 +02:00

SMACK-363 Applied code cleanup patches for many generics related issues.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13325 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
rcollier 2012-10-26 10:47:55 +00:00
parent 6dc64671e2
commit e08c8afe44
109 changed files with 577 additions and 605 deletions

View file

@ -28,6 +28,7 @@ import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
/**
* Utilty class to perform DNS lookups for XMPP services.
*
@ -39,13 +40,13 @@ public class DNSUtil {
* Create a cache to hold the 100 most recently accessed DNS lookups for a period of
* 10 minutes.
*/
private static Map cache = new Cache(100, 1000*60*10);
private static Map<String, HostAddress> cache = new Cache<String, HostAddress>(100, 1000*60*10);
private static DirContext context;
static {
try {
Hashtable env = new Hashtable();
Hashtable<String, String> env = new Hashtable<String, String>();
env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");
context = new InitialDirContext(env);
}
@ -97,9 +98,9 @@ public class DNSUtil {
try {
Attributes dnsLookup = context.getAttributes("_xmpp-client._tcp." + domain, new String[]{"SRV"});
Attribute srvAttribute = dnsLookup.get("SRV");
NamingEnumeration srvRecords = srvAttribute.getAll();
NamingEnumeration<String> srvRecords = (NamingEnumeration<String>) srvAttribute.getAll();
while(srvRecords.hasMore()) {
String srvRecord = (String) srvRecords.next();
String srvRecord = srvRecords.next();
String [] srvRecordEntries = srvRecord.split(" ");
int priority = Integer.parseInt(srvRecordEntries[srvRecordEntries.length - 4]);
int port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);