Commit bb51c61c authored by Christian Schudt's avatar Christian Schudt

Java Generics: Fix various "unchecked" compiler warnings.

parent 9d3b8cfa
......@@ -54,7 +54,7 @@ public class Channel<T extends Packet> {
private static final Logger Log = LoggerFactory.getLogger(Channel.class);
private String name;
private ChannelHandler channelHandler;
private ChannelHandler<T> channelHandler;
ThreadPoolExecutor executor;
......@@ -68,7 +68,7 @@ public class Channel<T extends Packet> {
this.name = name;
this.channelHandler = channelHandler;
executor = new ThreadPoolExecutor(1, 8, 15, TimeUnit.SECONDS, new LinkedBlockingQueue());
executor = new ThreadPoolExecutor(1, 8, 15, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
}
/**
......
......@@ -81,7 +81,7 @@ public class MulticastRouter extends BasicModule implements ServerFeaturesProvid
* Cache for a day discovered information of remote servers. The local server will try
* to discover if remote servers support multicast service.
*/
private Cache cache;
private Cache<String, String> cache;
/**
* Packets that include recipients that belong to remote servers are not processed by
* the main thread since extra work is required. This variable holds the list of packets
......
......@@ -21,13 +21,14 @@
package org.jivesoftware.openfire;
import org.xmpp.packet.JID;
import org.xmpp.packet.Packet;
/**
*
*
* @author Matt Tucker
*/
public interface RoutableChannelHandler extends ChannelHandler {
public interface RoutableChannelHandler extends ChannelHandler<Packet> {
/**
* Returns the XMPP address. The address is used by services like the core
......
......@@ -33,13 +33,13 @@ import org.jivesoftware.openfire.component.InternalComponentManager;
import org.jivesoftware.openfire.container.AdminConsolePlugin;
import org.jivesoftware.openfire.container.Module;
import org.jivesoftware.openfire.container.PluginManager;
import org.jivesoftware.openfire.disco.*;
import org.jivesoftware.openfire.disco.*;
import org.jivesoftware.openfire.filetransfer.DefaultFileTransferManager;
import org.jivesoftware.openfire.filetransfer.FileTransferManager;
import org.jivesoftware.openfire.filetransfer.proxy.FileTransferProxy;
import org.jivesoftware.openfire.handler.*;
import org.jivesoftware.openfire.keystore.IdentityStoreConfig;
import org.jivesoftware.openfire.keystore.Purpose;
import org.jivesoftware.openfire.handler.*;
import org.jivesoftware.openfire.keystore.IdentityStoreConfig;
import org.jivesoftware.openfire.keystore.Purpose;
import org.jivesoftware.openfire.lockout.LockOutManager;
import org.jivesoftware.openfire.mediaproxy.MediaProxyService;
import org.jivesoftware.openfire.muc.MultiUserChatManager;
......@@ -54,22 +54,22 @@ import org.jivesoftware.openfire.transport.TransportHandler;
import org.jivesoftware.openfire.update.UpdateManager;
import org.jivesoftware.openfire.user.UserManager;
import org.jivesoftware.openfire.vcard.VCardManager;
import org.jivesoftware.util.*;
import org.jivesoftware.util.*;
import org.jivesoftware.util.cache.CacheFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmpp.packet.JID;
import java.io.*;
import java.lang.reflect.Method;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.io.*;
import java.lang.reflect.Method;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* The main XMPP server that will load, initialize and start all the server's
* modules. The server is unique in the JVM and could be obtained by using the
......@@ -376,8 +376,8 @@ public class XMPPServer {
// Update certificates (if required)
try {
// Check if keystore already has certificates for current domain
final IdentityStoreConfig storeConfig = (IdentityStoreConfig) SSLConfig.getInstance().getStoreConfig( Purpose.SOCKETBASED_IDENTITYSTORE );
storeConfig.ensureDomainCertificates( "DSA", "RSA" );
final IdentityStoreConfig storeConfig = (IdentityStoreConfig) SSLConfig.getInstance().getStoreConfig( Purpose.SOCKETBASED_IDENTITYSTORE );
storeConfig.ensureDomainCertificates( "DSA", "RSA" );
} catch (Exception e) {
logger.error("Error generating self-signed certificates", e);
}
......@@ -512,7 +512,7 @@ public class XMPPServer {
/**
* Loads a module.
*
* @param moduleName the name of the class that implements the Module interface.
* @param moduleName the name of the class that implements the Module interface.
*/
@SuppressWarnings("unchecked")
private void loadModule(String moduleName, String moduleImpl) {
......@@ -575,7 +575,7 @@ public class XMPPServer {
public void restart() {
if (isStandAlone() && isRestartable()) {
try {
Class wrapperClass = Class.forName(WRAPPER_CLASSNAME);
Class<?> wrapperClass = Class.forName(WRAPPER_CLASSNAME);
Method restartMethod = wrapperClass.getMethod("restart", (Class []) null);
restartMethod.invoke(null, (Object []) null);
}
......@@ -626,7 +626,7 @@ public class XMPPServer {
// if we're in a wrapper, we have to tell the wrapper to shut us down
if (isRestartable()) {
try {
Class wrapperClass = Class.forName(WRAPPER_CLASSNAME);
Class<?> wrapperClass = Class.forName(WRAPPER_CLASSNAME);
Method stopMethod = wrapperClass.getMethod("stop", Integer.TYPE);
stopMethod.invoke(null, 0);
}
......
......@@ -44,7 +44,7 @@ public class AuditManagerImpl extends BasicModule implements AuditManager {
private boolean auditPresence;
private boolean auditIQ;
private boolean auditXPath;
private List xpath = new LinkedList();
private List<String> xpath = new LinkedList<>();
private AuditorImpl auditor = null;
/**
* Max size in bytes that all audit log files may have. When the limit is reached
......@@ -63,7 +63,7 @@ public class AuditManagerImpl extends BasicModule implements AuditManager {
private int maxDays;
private int logTimeout;
private String logDir;
private Collection<String> ignoreList = new ArrayList<String>();
private Collection<String> ignoreList = new ArrayList<>();
private static final int MAX_TOTAL_SIZE = 1000;
private static final int MAX_FILE_SIZE = 10;
private static final int MAX_DAYS = -1;
......
......@@ -75,7 +75,7 @@ public class POP3AuthProvider implements AuthProvider {
private static final Logger Log = LoggerFactory.getLogger(POP3AuthProvider.class);
private Cache authCache = null;
private Cache<String, String> authCache = null;
private String host = null;
private String domain = null;
private int port = -1;
......
......@@ -1022,7 +1022,7 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM
//Tries to create an instance with the message
Exception exception;
try {
Class exceptionClass = Class.forName(className);
Class<?> exceptionClass = Class.forName(className);
if (message == null) {
exception = (Exception) exceptionClass.newInstance();
} else {
......
......@@ -41,6 +41,7 @@ import org.jivesoftware.openfire.stats.i18nStatistic;
import org.jivesoftware.util.ClassUtils;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.StringUtils;
import org.jivesoftware.util.cache.Cache;
import org.jivesoftware.util.cache.CacheFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -60,7 +61,7 @@ public class ProxyConnectionManager {
private static final String proxyTransferRate = "proxyTransferRate";
private Map<String, ProxyTransfer> connectionMap;
private Cache<String, ProxyTransfer> connectionMap;
private final Object connectionLock = new Object();
......
......@@ -57,10 +57,10 @@ public class XDataFormImpl {
private String type;
private String title;
private List instructions = new ArrayList();
private List fields = new ArrayList();
private List reportedFields = new ArrayList();
private List reportedItems = new ArrayList();
private List<String> instructions = new ArrayList<>();
private List<FormField> fields = new ArrayList<>();
private List<FormField> reportedFields = new ArrayList<>();
private List<List<FormField>> reportedItems = new ArrayList<>();
public XDataFormImpl() {
super();
......@@ -74,7 +74,7 @@ public class XDataFormImpl {
this.title = title;
}
public void setInstructions(List instructions) {
public void setInstructions(List<String> instructions) {
this.instructions = instructions;
}
......@@ -88,7 +88,7 @@ public class XDataFormImpl {
public Iterator getInstructions() {
synchronized (instructions) {
return Collections.unmodifiableList(new ArrayList(instructions)).iterator();
return Collections.unmodifiableList(new ArrayList<>(instructions)).iterator();
}
}
......@@ -109,7 +109,7 @@ public class XDataFormImpl {
public Iterator getFields() {
synchronized (fields) {
return Collections.unmodifiableList(new ArrayList(fields)).iterator();
return Collections.unmodifiableList(new ArrayList<>(fields)).iterator();
}
}
......@@ -135,7 +135,7 @@ public class XDataFormImpl {
}
}
public void addItemFields(ArrayList itemFields) {
public void addItemFields(List<FormField> itemFields) {
synchronized (reportedItems) {
// We are nesting a List (of fields) inside of the List of items
reportedItems.add(itemFields);
......@@ -245,7 +245,7 @@ public class XDataFormImpl {
while (itemElements.hasNext()) {
Element itemElement = (Element)itemElements.next();
Iterator itemFieldElements = itemElement.elementIterator("field");
ArrayList itemFields = new ArrayList();
ArrayList<FormField> itemFields = new ArrayList<>();
while (itemFieldElements.hasNext()) {
XFormFieldImpl field = new XFormFieldImpl();
field.parse((Element)itemFieldElements.next());
......
......@@ -31,7 +31,7 @@ import java.util.Collection;
*
* @author Matt Tucker
*/
public class GroupCollection extends AbstractCollection {
public class GroupCollection extends AbstractCollection<Group> {
private String[] elements;
......@@ -50,7 +50,7 @@ public class GroupCollection extends AbstractCollection {
}
@Override
public Iterator iterator() {
public Iterator<Group> iterator() {
return new GroupIterator();
}
......@@ -59,10 +59,10 @@ public class GroupCollection extends AbstractCollection {
return elements.length;
}
private class GroupIterator implements Iterator {
private class GroupIterator implements Iterator<Group> {
private int currentIndex = -1;
private Object nextElement = null;
private Group nextElement = null;
public boolean hasNext() {
// If we are at the end of the list, there can't be any more elements
......@@ -81,8 +81,8 @@ public class GroupCollection extends AbstractCollection {
return true;
}
public Object next() throws java.util.NoSuchElementException {
Object element;
public Group next() throws java.util.NoSuchElementException {
Group element;
if (nextElement != null) {
element = nextElement;
nextElement = null;
......@@ -105,10 +105,10 @@ public class GroupCollection extends AbstractCollection {
*
* @return the next available element.
*/
private Object getNextElement() {
private Group getNextElement() {
while (currentIndex + 1 < elements.length) {
currentIndex++;
Object element = null;
Group element = null;
try {
element = GroupManager.getInstance().getGroup(elements[currentIndex]);
}
......
......@@ -98,17 +98,17 @@ public class BrowserLauncher {
/**
* The com.apple.mrj.MRJFileUtils class
*/
private static Class mrjFileUtilsClass;
private static Class<?> mrjFileUtilsClass;
/**
* The com.apple.mrj.MRJOSType class
*/
private static Class mrjOSTypeClass;
private static Class<?> mrjOSTypeClass;
/**
* The com.apple.MacOS.AEDesc class
*/
private static Class aeDescClass;
private static Class<?> aeDescClass;
/**
* The <init>(int) method of com.apple.MacOS.AETarget
......@@ -345,19 +345,19 @@ public class BrowserLauncher {
switch (jvm) {
case MRJ_2_0:
try {
Class aeTargetClass = Class.forName("com.apple.MacOS.AETarget");
Class osUtilsClass = Class.forName("com.apple.MacOS.OSUtils");
Class appleEventClass = Class.forName("com.apple.MacOS.AppleEvent");
Class aeClass = Class.forName("com.apple.MacOS.ae");
Class<?> aeTargetClass = Class.forName("com.apple.MacOS.AETarget");
Class<?> osUtilsClass = Class.forName("com.apple.MacOS.OSUtils");
Class<?> appleEventClass = Class.forName("com.apple.MacOS.AppleEvent");
Class<?> aeClass = Class.forName("com.apple.MacOS.ae");
aeDescClass = Class.forName("com.apple.MacOS.AEDesc");
aeTargetConstructor = aeTargetClass.getDeclaredConstructor(new Class[]{int.class});
appleEventConstructor = appleEventClass.getDeclaredConstructor(new Class[]{int.class, int.class, aeTargetClass, int.class, int.class});
aeDescConstructor = aeDescClass.getDeclaredConstructor(new Class[]{String.class});
aeTargetConstructor = aeTargetClass.getDeclaredConstructor(int.class);
appleEventConstructor = appleEventClass.getDeclaredConstructor(int.class, int.class, aeTargetClass, int.class, int.class);
aeDescConstructor = aeDescClass.getDeclaredConstructor(String.class);
makeOSType = osUtilsClass.getDeclaredMethod("makeOSType", new Class[]{String.class});
putParameter = appleEventClass.getDeclaredMethod("putParameter", new Class[]{int.class, aeDescClass});
sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply", new Class[]{});
makeOSType = osUtilsClass.getDeclaredMethod("makeOSType", String.class);
putParameter = appleEventClass.getDeclaredMethod("putParameter", int.class, aeDescClass);
sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply");
Field keyDirectObjectField = aeClass.getDeclaredField("keyDirectObject");
keyDirectObject = (Integer)keyDirectObjectField.get(null);
......@@ -389,9 +389,9 @@ public class BrowserLauncher {
mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType");
Field systemFolderField = mrjFileUtilsClass.getDeclaredField("kSystemFolderType");
kSystemFolderType = systemFolderField.get(null);
findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder", new Class[]{mrjOSTypeClass});
getFileCreator = mrjFileUtilsClass.getDeclaredMethod("getFileCreator", new Class[]{File.class});
getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType", new Class[]{File.class});
findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder", mrjOSTypeClass);
getFileCreator = mrjFileUtilsClass.getDeclaredMethod("getFileCreator", File.class);
getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType", File.class);
}
catch (ClassNotFoundException cnfe) {
errorMessage = cnfe.getMessage();
......@@ -416,9 +416,9 @@ public class BrowserLauncher {
break;
case MRJ_3_0:
try {
Class linker = Class.forName("com.apple.mrj.jdirect.Linker");
Constructor constructor = linker.getConstructor(new Class[]{Class.class});
linkage = constructor.newInstance(new Object[]{BrowserLauncher.class});
Class<?> linker = Class.forName("com.apple.mrj.jdirect.Linker");
Constructor constructor = linker.getConstructor(Class.class);
linkage = constructor.newInstance(BrowserLauncher.class);
}
catch (ClassNotFoundException cnfe) {
errorMessage = cnfe.getMessage();
......@@ -444,7 +444,7 @@ public class BrowserLauncher {
case MRJ_3_1:
try {
mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");
openURL = mrjFileUtilsClass.getDeclaredMethod("openURL", new Class[]{String.class});
openURL = mrjFileUtilsClass.getDeclaredMethod("openURL", String.class);
}
catch (ClassNotFoundException cnfe) {
errorMessage = cnfe.getMessage();
......
......@@ -39,7 +39,7 @@ public final class GraphicUtils {
};
protected final static MediaTracker tracker = new MediaTracker(component);
private static Hashtable imageCache = new Hashtable();
private static Hashtable<String, Image> imageCache = new Hashtable<>();
private GraphicUtils() {
}
......
......@@ -104,8 +104,8 @@ public class XMPPServerInfoImpl implements XMPPServerInfo {
if (connectionManager == null) {
connectionManager = XMPPServer.getInstance().getConnectionManager();
}
return (Collection<ServerPort>) (connectionManager == null ?
Collections.emptyList() :
connectionManager.getPorts());
return connectionManager == null ?
Collections.<ServerPort>emptyList() :
connectionManager.getPorts();
}
}
\ No newline at end of file
......@@ -46,7 +46,7 @@ public class TransportHandler extends BasicModule implements ChannelHandler {
private static final Logger Log = LoggerFactory.getLogger(TransportHandler.class);
private Map<String, Channel> transports = new ConcurrentHashMap<String, Channel>();
private Map<String, Channel<Packet>> transports = new ConcurrentHashMap<>();
private PacketDeliverer deliverer;
......@@ -54,14 +54,14 @@ public class TransportHandler extends BasicModule implements ChannelHandler {
super("Transport handler");
}
public void addTransport(Channel transport) {
public void addTransport(Channel<Packet> transport) {
transports.put(transport.getName(), transport);
}
public void process(Packet packet) throws UnauthorizedException, PacketException {
boolean handled = false;
String host = packet.getTo().getDomain();
for (Channel channel : transports.values()) {
for (Channel<Packet> channel : transports.values()) {
if (channel.getName().equalsIgnoreCase(host)) {
channel.add(packet);
handled = true;
......
......@@ -471,26 +471,26 @@ public class User implements Cacheable, Externalizable, Result {
/**
* Map implementation that updates the database when properties are modified.
*/
private class PropertiesMap extends AbstractMap {
private class PropertiesMap extends AbstractMap<String, String> {
@Override
public Object put(Object key, Object value) {
Map<String,Object> eventParams = new HashMap<String,Object>();
Object answer;
String keyString = (String) key;
public String put(String key, String value) {
Map<String,Object> eventParams = new HashMap<>();
String answer;
String keyString = key;
synchronized (getName() + keyString.intern()) {
if (properties.containsKey(keyString)) {
String originalValue = properties.get(keyString);
answer = properties.put(keyString, (String)value);
updateProperty(keyString, (String)value);
answer = properties.put(keyString, value);
updateProperty(keyString, value);
// Configure event.
eventParams.put("type", "propertyModified");
eventParams.put("propertyKey", key);
eventParams.put("originalValue", originalValue);
}
else {
answer = properties.put(keyString, (String)value);
insertProperty(keyString, (String)value);
answer = properties.put(keyString, value);
insertProperty(keyString, value);
// Configure event.
eventParams.put("type", "propertyAdded");
eventParams.put("propertyKey", key);
......@@ -503,7 +503,7 @@ public class User implements Cacheable, Externalizable, Result {
}
@Override
public Set<Entry> entrySet() {
public Set<Entry<String, String>> entrySet() {
return new PropertiesEntrySet();
}
}
......@@ -511,26 +511,26 @@ public class User implements Cacheable, Externalizable, Result {
/**
* Set implementation that updates the database when properties are deleted.
*/
private class PropertiesEntrySet extends AbstractSet {
private class PropertiesEntrySet extends AbstractSet<Map.Entry<String, String>> {
@Override
public int size() {
public int size() {
return properties.entrySet().size();
}
@Override
public Iterator iterator() {
return new Iterator() {
public Iterator<Map.Entry<String, String>> iterator() {
return new Iterator<Map.Entry<String, String>>() {
Iterator iter = properties.entrySet().iterator();
Map.Entry current = null;
Iterator<Map.Entry<String, String>> iter = properties.entrySet().iterator();
Map.Entry<String,String> current = null;
public boolean hasNext() {
return iter.hasNext();
}
public Object next() {
current = (Map.Entry)iter.next();
public Map.Entry<String, String> next() {
current = iter.next();
return current;
}
......@@ -538,11 +538,11 @@ public class User implements Cacheable, Externalizable, Result {
if (current == null) {
throw new IllegalStateException();
}
String key = (String)current.getKey();
String key = current.getKey();
deleteProperty(key);
iter.remove();
// Fire event.
Map<String,Object> params = new HashMap<String,Object>();
Map<String,Object> params = new HashMap<>();
params.put("type", "propertyDeleted");
params.put("propertyKey", key);
UserEventDispatcher.dispatchEvent(User.this,
......
......@@ -30,7 +30,7 @@ import java.util.AbstractCollection;
*
* @author Matt Tucker
*/
public class UserCollection extends AbstractCollection {
public class UserCollection extends AbstractCollection<User> {
private String[] elements;
......@@ -42,7 +42,7 @@ public class UserCollection extends AbstractCollection {
}
@Override
public Iterator iterator() {
public Iterator<User> iterator() {
return new UserIterator();
}
......@@ -51,10 +51,10 @@ public class UserCollection extends AbstractCollection {
return elements.length;
}
private class UserIterator implements Iterator {
private class UserIterator implements Iterator<User> {
private int currentIndex = -1;
private Object nextElement = null;
private User nextElement = null;
public boolean hasNext() {
// If we are at the end of the list, there can't be any more elements
......@@ -73,8 +73,8 @@ public class UserCollection extends AbstractCollection {
return true;
}
public Object next() throws java.util.NoSuchElementException {
Object element;
public User next() throws java.util.NoSuchElementException {
User element;
if (nextElement != null) {
element = nextElement;
nextElement = null;
......@@ -97,10 +97,10 @@ public class UserCollection extends AbstractCollection {
*
* @return the next available element.
*/
private Object getNextElement() {
private User getNextElement() {
while (currentIndex + 1 < elements.length) {
currentIndex++;
Object element = null;
User element = null;
try {
element = UserManager.getInstance().getUser(elements[currentIndex]);
}
......
......@@ -176,13 +176,13 @@ public class ElementUtil {
}
// We found matching property, return names of children.
Iterator iter = element.elementIterator(propName[propName.length - 1]);
ArrayList props = new ArrayList();
ArrayList<String> props = new ArrayList<>();
while (iter.hasNext()) {
Element e = (Element) iter.next();
props.add(e.getName());
}
String[] childrenNames = new String[props.size()];
return (String[]) props.toArray(childrenNames);
return props.toArray(childrenNames);
}
/**
......@@ -280,13 +280,13 @@ public class ElementUtil {
return properties;
}
else {
List list = new ArrayList(15);
List<String> list = new ArrayList<>(15);
for (int i = 0; i < properties.length; i++) {
String propName = parent + "." + properties[i];
list.add(propName);
list.addAll(Arrays.asList(getRecursiveChildrenProperties(element, propName)));
}
return (String[]) list.toArray(new String[]{});
return list.toArray(new String[]{});
}
}
......@@ -370,13 +370,13 @@ public class ElementUtil {
* @return an array representation of the given Jive property.
*/
private static String[] parsePropertyName(String name) {
List propName = new ArrayList(5);
List<String> propName = new ArrayList<>(5);
// Use a StringTokenizer to tokenize the property name.
StringTokenizer tokenizer = new StringTokenizer(name, ".");
while (tokenizer.hasMoreTokens()) {
propName.add(tokenizer.nextToken());
}
return (String[]) propName.toArray(new String[propName.size()]);
return propName.toArray(new String[propName.size()]);
}
......
......@@ -87,12 +87,12 @@ public class FastDateFormat {
private static String cDefaultPattern;
private static TimeZone cDefaultTimeZone = TimeZone.getDefault();
private static Map cTimeZoneDisplayCache = new HashMap();
private static Map<Object, String> cTimeZoneDisplayCache = new HashMap<>();
private static Map cInstanceCache = new HashMap(7);
private static Map cDateInstanceCache = new HashMap(7);
private static Map cTimeInstanceCache = new HashMap(7);
private static Map cDateTimeInstanceCache = new HashMap(7);
private static Map<Object, FastDateFormat> cInstanceCache = new HashMap<>(7);
private static Map<Object, FastDateFormat> cDateInstanceCache = new HashMap<>(7);
private static Map<Object, FastDateFormat> cTimeInstanceCache = new HashMap<>(7);
private static Map<Object, FastDateFormat> cDateTimeInstanceCache = new HashMap<>(7);
public static FastDateFormat getInstance() {
return getInstance(getDefaultPattern(), null, null, null);
......@@ -178,7 +178,7 @@ public class FastDateFormat {
key = new Pair(key, symbols);
}
FastDateFormat format = (FastDateFormat)cInstanceCache.get(key);
FastDateFormat format = cInstanceCache.get(key);
if (format == null) {
if (locale == null) {
locale = Locale.getDefault();
......@@ -260,7 +260,7 @@ public class FastDateFormat {
key = new Pair(key, locale);
}
FastDateFormat format = (FastDateFormat)cTimeInstanceCache.get(key);
FastDateFormat format = cTimeInstanceCache.get(key);
if (format == null) {
int ts;
......@@ -310,8 +310,7 @@ public class FastDateFormat {
key = new Pair(key, locale);
}
FastDateFormat format =
(FastDateFormat)cDateTimeInstanceCache.get(key);
FastDateFormat format = cDateTimeInstanceCache.get(key);
if (format == null) {
int ds;
......@@ -355,7 +354,7 @@ public class FastDateFormat {
int style,
Locale locale) {
Object key = new TimeZoneDisplayKey(tz, daylight, style, locale);
String value = (String)cTimeZoneDisplayCache.get(key);
String value = cTimeZoneDisplayCache.get(key);
if (value == null) {
// This is a very slow call, so cache the results.
value = tz.getDisplayName(daylight, style, locale);
......@@ -376,7 +375,7 @@ public class FastDateFormat {
*/
private static List parse(String pattern, TimeZone timeZone, Locale locale,
DateFormatSymbols symbols) {
List rules = new ArrayList();
List<Rule> rules = new ArrayList<>();
String[] ERAs = symbols.getEras();
String[] months = symbols.getMonths();
......
......@@ -37,7 +37,7 @@ import java.util.*;
public class IntEnum extends Enum {
private int value;
protected static Hashtable enumTypes = new Hashtable();
protected static Hashtable<Class<?>, Map<Integer, IntEnum>> enumTypes = new Hashtable<>();
protected IntEnum(String name, int val) {
super(name);
......@@ -72,9 +72,9 @@ public class IntEnum extends Enum {
* @param enumeration The enum to be registered
*/
protected static void register(IntEnum enumeration) {
Map enums = (Map)enumTypes.get(enumeration.getClass());
Map<Integer, IntEnum> enums = enumTypes.get(enumeration.getClass());
if (enums == null) {
enums = new HashMap<Integer,Object>();
enums = new HashMap<>();
enumTypes.put(enumeration.getClass(), enums);
}
enums.put(enumeration.getValue(), enumeration);
......
......@@ -407,7 +407,7 @@ public class LocaleUtils {
* inserted into the pattern at the appropriate places.
* @return the localized string.
*/
public static String getLocalizedString(String key, List arguments) {
public static String getLocalizedString(String key, List<?> arguments) {
Locale locale = JiveGlobals.getLocale();
ResourceBundle bundle = ResourceBundle.getBundle(resourceBaseName, locale);
......@@ -470,7 +470,7 @@ public class LocaleUtils {
* used if the requested locale is not available)
* @return the localized string.
*/
public static String getLocalizedString(String key, String pluginName, List arguments, Locale locale, boolean fallback) {
public static String getLocalizedString(String key, String pluginName, List<?> arguments, Locale locale, boolean fallback) {
if (pluginName == null) {
return getLocalizedString(key, arguments);
}
......
......@@ -83,13 +83,13 @@ public class ParamUtils {
return new String[0];
}
else {
java.util.List values = new java.util.ArrayList(paramValues.length);
java.util.List<String> values = new java.util.ArrayList<>(paramValues.length);
for (int i = 0; i < paramValues.length; i++) {
if (paramValues[i] != null && !"".equals(paramValues[i])) {
values.add(paramValues[i]);
}
}
return (String[])values.toArray(new String[]{});
return values.toArray(new String[]{});
}
}
......
......@@ -70,7 +70,7 @@ public class XMLWriter extends XMLFilterImpl implements LexicalHandler {
private boolean inDTD;
/** The namespaces used for the current element when consuming SAX events */
private Map namespacesMap;
private Map<String, String> namespacesMap;
/**
* what is the maximum allowed character code
......@@ -493,7 +493,7 @@ public class XMLWriter extends XMLFilterImpl implements LexicalHandler {
@Override
public void startPrefixMapping(String prefix, String uri) throws SAXException {
if ( namespacesMap == null ) {
namespacesMap = new HashMap();
namespacesMap = new HashMap<>();
}
namespacesMap.put(prefix, uri);
super.startPrefixMapping(prefix, uri);
......
......@@ -121,7 +121,7 @@ public class CacheSizes {
* @param map the Map object to determine the size of.
* @return the size of the Map object.
*/
public static int sizeOfMap(Map map)
public static int sizeOfMap(Map<?,?> map)
throws CannotCalculateSizeException {
if (map == null) {
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment