1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +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

@ -477,7 +477,7 @@ public class Cache<K, V> implements Map<K, V> {
return false;
}
final CacheObject cacheObject = (CacheObject) o;
final CacheObject<?> cacheObject = (CacheObject<?>) o;
return object.equals(cacheObject.object);

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]);

View file

@ -32,7 +32,7 @@ import java.util.*;
public class ObservableReader extends Reader {
Reader wrappedReader = null;
List listeners = new ArrayList();
List<ReaderListener> listeners = new ArrayList<ReaderListener>();
public ObservableReader(Reader wrappedReader) {
this.wrappedReader = wrappedReader;

View file

@ -32,7 +32,7 @@ import java.util.*;
public class ObservableWriter extends Writer {
Writer wrappedWriter = null;
List listeners = new ArrayList();
List<WriterListener> listeners = new ArrayList<WriterListener>();
public ObservableWriter(Writer wrappedWriter) {
this.wrappedWriter = wrappedWriter;

View file

@ -307,7 +307,7 @@ public class PacketParserUtils {
}
else if (provider instanceof Class) {
iqPacket = (IQ)PacketParserUtils.parseWithIntrospection(elementName,
(Class)provider, parser);
(Class<?>)provider, parser);
}
}
}
@ -769,7 +769,7 @@ public class PacketParserUtils {
}
else if (provider instanceof Class) {
return (PacketExtension)parseWithIntrospection(
elementName, (Class)provider, parser);
elementName, (Class<?>)provider, parser);
}
}
// No providers registered, so use a default extension.
@ -814,7 +814,7 @@ public class PacketParserUtils {
}
public static Object parseWithIntrospection(String elementName,
Class objectClass, XmlPullParser parser) throws Exception
Class<?> objectClass, XmlPullParser parser) throws Exception
{
boolean done = false;
Object object = objectClass.newInstance();
@ -825,7 +825,7 @@ public class PacketParserUtils {
String stringValue = parser.nextText();
PropertyDescriptor descriptor = new PropertyDescriptor(name, objectClass);
// Load the class type of the property.
Class propertyType = descriptor.getPropertyType();
Class<?> propertyType = descriptor.getPropertyType();
// Get the value of the property by converting it from a
// String to the correct object type.
Object value = decode(propertyType, stringValue);
@ -850,7 +850,7 @@ public class PacketParserUtils {
* @return the String value decoded into the specified type.
* @throws Exception If decoding failed due to an error.
*/
private static Object decode(Class type, String value) throws Exception {
private static Object decode(Class<?> type, String value) throws Exception {
if (type.getName().equals("java.lang.String")) {
return value;
}