Commit 6cc1e42d authored by Christian Schudt's avatar Christian Schudt

Merge pull request #330 from sco0ter/java7

Java 7: Replace explicit type with diamond operator <>
parents 57e8de7c a27bbb04
...@@ -124,7 +124,7 @@ public class MINAStatCollector { ...@@ -124,7 +124,7 @@ public class MINAStatCollector {
// add all current sessions // add all current sessions
polledSessions = new ConcurrentLinkedQueue<IoSession>(); polledSessions = new ConcurrentLinkedQueue<>();
Map<Long, IoSession> sessions = service.getManagedSessions(); Map<Long, IoSession> sessions = service.getManagedSessions();
if (sessions != null) { if (sessions != null) {
......
...@@ -59,7 +59,7 @@ public class AdminConsole { ...@@ -59,7 +59,7 @@ public class AdminConsole {
private static Element generatedModel; private static Element generatedModel;
static { static {
overrideModels = new LinkedHashMap<String,Element>(); overrideModels = new LinkedHashMap<>();
load(); load();
// Detect when a new auth provider class is set to ClearspaceAuthProvider // Detect when a new auth provider class is set to ClearspaceAuthProvider
......
...@@ -60,7 +60,7 @@ public class LdapGroupTester { ...@@ -60,7 +60,7 @@ public class LdapGroupTester {
* @return fist N groups found in the LDAP. * @return fist N groups found in the LDAP.
*/ */
public Collection<Group> getGroups(int maxGroups) { public Collection<Group> getGroups(int maxGroups) {
Collection<Group> groups = new ArrayList<Group>(); Collection<Group> groups = new ArrayList<>();
LdapContext ctx = null; LdapContext ctx = null;
try { try {
ctx = manager.getContext(); ctx = manager.getContext();
......
...@@ -91,7 +91,7 @@ public class LdapUserTester { ...@@ -91,7 +91,7 @@ public class LdapUserTester {
* @throws NamingException if something goes wrong.... * @throws NamingException if something goes wrong....
*/ */
public List<String> getSample(int maxSample) throws NamingException { public List<String> getSample(int maxSample) throws NamingException {
List<String> usernames = new ArrayList<String>(); List<String> usernames = new ArrayList<>();
LdapContext ctx = null; LdapContext ctx = null;
try { try {
...@@ -153,7 +153,7 @@ public class LdapUserTester { ...@@ -153,7 +153,7 @@ public class LdapUserTester {
* @return a list of attributes and their LDAP values found in LDAP for the specified username. * @return a list of attributes and their LDAP values found in LDAP for the specified username.
*/ */
public Map<String, String> getAttributes(String username) { public Map<String, String> getAttributes(String username) {
Map<String, String> userAttributes = new HashMap<String, String>(); Map<String, String> userAttributes = new HashMap<>();
// Un-escape username. // Un-escape username.
username = JID.unescapeNode(username); username = JID.unescapeNode(username);
DirContext ctx = null; DirContext ctx = null;
...@@ -161,7 +161,7 @@ public class LdapUserTester { ...@@ -161,7 +161,7 @@ public class LdapUserTester {
String userDN = manager.findUserDN(username); String userDN = manager.findUserDN(username);
// Build list of attributes to load from LDAP // Build list of attributes to load from LDAP
Map<String, PropertyMapping> ldapMappings = getLdapAttributes(); Map<String, PropertyMapping> ldapMappings = getLdapAttributes();
Set<String> fields = new HashSet<String>(); Set<String> fields = new HashSet<>();
for (PropertyMapping mapping : ldapMappings.values()) { for (PropertyMapping mapping : ldapMappings.values()) {
fields.addAll(mapping.getFields()); fields.addAll(mapping.getFields());
} }
...@@ -208,7 +208,7 @@ public class LdapUserTester { ...@@ -208,7 +208,7 @@ public class LdapUserTester {
} }
private Map<String, PropertyMapping> getLdapAttributes() { private Map<String, PropertyMapping> getLdapAttributes() {
Map<String, PropertyMapping> map = new HashMap<String, PropertyMapping>(); Map<String, PropertyMapping> map = new HashMap<>();
if (profile.getName() != null && profile.getName().trim().length() > 0) { if (profile.getName() != null && profile.getName().trim().length() > 0) {
map.put(NAME, new PropertyMapping(profile.getName())); map.put(NAME, new PropertyMapping(profile.getName()));
...@@ -300,7 +300,7 @@ public class LdapUserTester { ...@@ -300,7 +300,7 @@ public class LdapUserTester {
/** /**
* LDAP fields that compose the user property * LDAP fields that compose the user property
*/ */
private Collection<String> fields = new ArrayList<String>(); private Collection<String> fields = new ArrayList<>();
public PropertyMapping(String displayFormat) { public PropertyMapping(String displayFormat) {
......
...@@ -68,8 +68,8 @@ public class LoginLimitManager { ...@@ -68,8 +68,8 @@ public class LoginLimitManager {
*/ */
private LoginLimitManager() { private LoginLimitManager() {
// Set up initial maps // Set up initial maps
attemptsPerIP = new ConcurrentHashMap<String,Long>(); attemptsPerIP = new ConcurrentHashMap<>();
attemptsPerUsername = new ConcurrentHashMap<String,Long>(); attemptsPerUsername = new ConcurrentHashMap<>();
// Max number of attempts per ip address that can be performed in given time frame (10 attempts default) // Max number of attempts per ip address that can be performed in given time frame (10 attempts default)
maxAttemptsPerIP = JiveGlobals.getLongProperty("adminConsole.maxAttemptsPerIP", 10); maxAttemptsPerIP = JiveGlobals.getLongProperty("adminConsole.maxAttemptsPerIP", 10);
......
...@@ -36,7 +36,7 @@ import java.util.concurrent.CopyOnWriteArrayList; ...@@ -36,7 +36,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
*/ */
public class PluginFilter implements Filter { public class PluginFilter implements Filter {
private static List<SimpleFilter> pluginFilters = new CopyOnWriteArrayList<SimpleFilter>(); private static List<SimpleFilter> pluginFilters = new CopyOnWriteArrayList<>();
/** /**
* Adds a filter to the list of filters that will be run on every request. * Adds a filter to the list of filters that will be run on every request.
......
...@@ -51,8 +51,8 @@ public class CachedPreparedStatement { ...@@ -51,8 +51,8 @@ public class CachedPreparedStatement {
* Constructs a new CachedPreparedStatement. * Constructs a new CachedPreparedStatement.
*/ */
public CachedPreparedStatement() { public CachedPreparedStatement() {
params = new ArrayList<Object>(); params = new ArrayList<>();
types = new ArrayList<Integer>(); types = new ArrayList<>();
} }
/** /**
......
...@@ -66,7 +66,7 @@ public class SequenceManager { ...@@ -66,7 +66,7 @@ public class SequenceManager {
"UPDATE ofID SET id=? WHERE idType=? AND id=?"; "UPDATE ofID SET id=? WHERE idType=? AND id=?";
// Statically startup a sequence manager for each of the sequence counters. // Statically startup a sequence manager for each of the sequence counters.
private static Map<Integer, SequenceManager> managers = new ConcurrentHashMap<Integer, SequenceManager>(); private static Map<Integer, SequenceManager> managers = new ConcurrentHashMap<>();
static { static {
new SequenceManager(JiveConstants.ROSTER, 5); new SequenceManager(JiveConstants.ROSTER, 5);
......
...@@ -64,10 +64,10 @@ public class IQRouter extends BasicModule { ...@@ -64,10 +64,10 @@ public class IQRouter extends BasicModule {
private RoutingTable routingTable; private RoutingTable routingTable;
private MulticastRouter multicastRouter; private MulticastRouter multicastRouter;
private String serverName; private String serverName;
private List<IQHandler> iqHandlers = new ArrayList<IQHandler>(); private List<IQHandler> iqHandlers = new ArrayList<>();
private Map<String, IQHandler> namespace2Handlers = new ConcurrentHashMap<String, IQHandler>(); private Map<String, IQHandler> namespace2Handlers = new ConcurrentHashMap<>();
private Map<String, IQResultListener> resultListeners = new ConcurrentHashMap<String, IQResultListener>(); private Map<String, IQResultListener> resultListeners = new ConcurrentHashMap<>();
private Map<String, Long> resultTimeout = new ConcurrentHashMap<String, Long>(); private Map<String, Long> resultTimeout = new ConcurrentHashMap<>();
private SessionManager sessionManager; private SessionManager sessionManager;
private UserManager userManager; private UserManager userManager;
......
...@@ -108,7 +108,7 @@ public class JMXManager { ...@@ -108,7 +108,7 @@ public class JMXManager {
setContainer(new MBeanContainer(ManagementFactory.getPlatformMBeanServer())); setContainer(new MBeanContainer(ManagementFactory.getPlatformMBeanServer()));
int jmxPort = JMXManager.getPort(); int jmxPort = JMXManager.getPort();
String jmxUrl = "/jndi/rmi://localhost:" + jmxPort + "/jmxrmi"; String jmxUrl = "/jndi/rmi://localhost:" + jmxPort + "/jmxrmi";
Map<String, Object> env = new HashMap<String, Object>(); Map<String, Object> env = new HashMap<>();
if (JMXManager.isSecure()) { if (JMXManager.isSecure()) {
env.put("jmx.remote.authenticator", new JMXAuthenticator() { env.put("jmx.remote.authenticator", new JMXAuthenticator() {
@Override @Override
......
...@@ -68,13 +68,13 @@ class LocalSessionManager { ...@@ -68,13 +68,13 @@ class LocalSessionManager {
* Map that holds sessions that has been created but haven't been authenticated yet. The Map * Map that holds sessions that has been created but haven't been authenticated yet. The Map
* will hold client sessions. * will hold client sessions.
*/ */
private Map<String, LocalClientSession> preAuthenticatedSessions = new ConcurrentHashMap<String, LocalClientSession>(); private Map<String, LocalClientSession> preAuthenticatedSessions = new ConcurrentHashMap<>();
/** /**
* The sessions contained in this List are component sessions. For each connected component * The sessions contained in this List are component sessions. For each connected component
* this Map will keep the component's session. * this Map will keep the component's session.
*/ */
private List<LocalComponentSession> componentsSessions = new CopyOnWriteArrayList<LocalComponentSession>(); private List<LocalComponentSession> componentsSessions = new CopyOnWriteArrayList<>();
/** /**
* Map of connection multiplexer sessions grouped by connection managers. Each connection * Map of connection multiplexer sessions grouped by connection managers. Each connection
...@@ -84,7 +84,7 @@ class LocalSessionManager { ...@@ -84,7 +84,7 @@ class LocalSessionManager {
* will become unavailable. * will become unavailable.
*/ */
private Map<String, LocalConnectionMultiplexerSession> connnectionManagerSessions = private Map<String, LocalConnectionMultiplexerSession> connnectionManagerSessions =
new ConcurrentHashMap<String, LocalConnectionMultiplexerSession>(); new ConcurrentHashMap<>();
/** /**
* The sessions contained in this Map are server sessions originated by a remote server. These * The sessions contained in this Map are server sessions originated by a remote server. These
...@@ -94,7 +94,7 @@ class LocalSessionManager { ...@@ -94,7 +94,7 @@ class LocalSessionManager {
* Key: streamID, Value: the IncomingServerSession associated to the streamID. * Key: streamID, Value: the IncomingServerSession associated to the streamID.
*/ */
private final Map<String, LocalIncomingServerSession> incomingServerSessions = private final Map<String, LocalIncomingServerSession> incomingServerSessions =
new ConcurrentHashMap<String, LocalIncomingServerSession>(); new ConcurrentHashMap<>();
public Map<String, LocalClientSession> getPreAuthenticatedSessions() { public Map<String, LocalClientSession> getPreAuthenticatedSessions() {
...@@ -134,7 +134,7 @@ class LocalSessionManager { ...@@ -134,7 +134,7 @@ class LocalSessionManager {
public void stop() { public void stop() {
try { try {
// Send the close stream header to all connected connections // Send the close stream header to all connected connections
Set<LocalSession> sessions = new HashSet<LocalSession>(); Set<LocalSession> sessions = new HashSet<>();
sessions.addAll(preAuthenticatedSessions.values()); sessions.addAll(preAuthenticatedSessions.values());
sessions.addAll(componentsSessions); sessions.addAll(componentsSessions);
for (LocalIncomingServerSession incomingSession : incomingServerSessions.values()) { for (LocalIncomingServerSession incomingSession : incomingServerSessions.values()) {
......
...@@ -90,19 +90,19 @@ public class MulticastRouter extends BasicModule implements ServerFeaturesProvid ...@@ -90,19 +90,19 @@ public class MulticastRouter extends BasicModule implements ServerFeaturesProvid
* pending to be sent. * pending to be sent.
*/ */
private Map<String, Collection<Packet>> remotePackets = private Map<String, Collection<Packet>> remotePackets =
new HashMap<String, Collection<Packet>>(); new HashMap<>();
/** /**
* Keeps the list of nodes discovered in remote servers. This information is used * Keeps the list of nodes discovered in remote servers. This information is used
* when discovering whether remote servers support multicast service or not. * when discovering whether remote servers support multicast service or not.
* Note: key=domain, value=list of nodes * Note: key=domain, value=list of nodes
*/ */
private Map<String, Collection<String>> nodes = new ConcurrentHashMap<String, Collection<String>>(); private Map<String, Collection<String>> nodes = new ConcurrentHashMap<>();
/** /**
* Keeps an association of node and server where the node was discovered. This information * Keeps an association of node and server where the node was discovered. This information
* is used when discovering whether remote servers support multicast service or not. * is used when discovering whether remote servers support multicast service or not.
* Note: key=node, value=domain of remote server * Note: key=node, value=domain of remote server
*/ */
private Map<String, String> roots = new ConcurrentHashMap<String, String>(); private Map<String, String> roots = new ConcurrentHashMap<>();
public MulticastRouter() { public MulticastRouter() {
super("Multicast Packet Router"); super("Multicast Packet Router");
...@@ -112,8 +112,8 @@ public class MulticastRouter extends BasicModule implements ServerFeaturesProvid ...@@ -112,8 +112,8 @@ public class MulticastRouter extends BasicModule implements ServerFeaturesProvid
} }
public void route(Packet packet) { public void route(Packet packet) {
Set<String> remoteServers = new HashSet<String>(); Set<String> remoteServers = new HashSet<>();
List<String> targets = new ArrayList<String>(); List<String> targets = new ArrayList<>();
Packet localBroadcast = packet.createCopy(); Packet localBroadcast = packet.createCopy();
Element addresses = getAddresses(localBroadcast); Element addresses = getAddresses(localBroadcast);
String localDomain = "@" + server.getServerInfo().getXMPPDomain(); String localDomain = "@" + server.getServerInfo().getXMPPDomain();
...@@ -152,7 +152,7 @@ public class MulticastRouter extends BasicModule implements ServerFeaturesProvid ...@@ -152,7 +152,7 @@ public class MulticastRouter extends BasicModule implements ServerFeaturesProvid
synchronized (domain.intern()) { synchronized (domain.intern()) {
Collection<Packet> packets = remotePackets.get(domain); Collection<Packet> packets = remotePackets.get(domain);
if (packets == null) { if (packets == null) {
packets = new ArrayList<Packet>(); packets = new ArrayList<>();
remotePackets.put(domain, packets); remotePackets.put(domain, packets);
shouldDiscover = true; shouldDiscover = true;
} }
...@@ -260,7 +260,7 @@ public class MulticastRouter extends BasicModule implements ServerFeaturesProvid ...@@ -260,7 +260,7 @@ public class MulticastRouter extends BasicModule implements ServerFeaturesProvid
// to each address // to each address
for (Packet packet : packets) { for (Packet packet : packets) {
Element addresses = getAddresses(packet); Element addresses = getAddresses(packet);
List<String> targets = new ArrayList<String>(); List<String> targets = new ArrayList<>();
for (Iterator it=addresses.elementIterator("address");it.hasNext();) { for (Iterator it=addresses.elementIterator("address");it.hasNext();) {
Element address = (Element) it.next(); Element address = (Element) it.next();
...@@ -365,14 +365,14 @@ public class MulticastRouter extends BasicModule implements ServerFeaturesProvid ...@@ -365,14 +365,14 @@ public class MulticastRouter extends BasicModule implements ServerFeaturesProvid
} }
else { else {
// Keep the list of items found in the requested domain // Keep the list of items found in the requested domain
List<String> jids = new ArrayList<String>(); List<String> jids = new ArrayList<>();
for (Element item : items) { for (Element item : items) {
String jid = item.attributeValue("jid"); String jid = item.attributeValue("jid");
jids.add(jid); jids.add(jid);
// Add that this item was found for the following domain // Add that this item was found for the following domain
roots.put(jid, domain); roots.put(jid, domain);
} }
nodes.put(domain, new CopyOnWriteArrayList<String>(jids)); nodes.put(domain, new CopyOnWriteArrayList<>(jids));
// Send disco#info to each discovered item // Send disco#info to each discovered item
for (Element item : items) { for (Element item : items) {
......
...@@ -103,7 +103,7 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene ...@@ -103,7 +103,7 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene
/** /**
* Pool of SAX Readers. SAXReader is not thread safe so we need to have a pool of readers. * Pool of SAX Readers. SAXReader is not thread safe so we need to have a pool of readers.
*/ */
private BlockingQueue<SAXReader> xmlReaders = new LinkedBlockingQueue<SAXReader>(POOL_SIZE); private BlockingQueue<SAXReader> xmlReaders = new LinkedBlockingQueue<>(POOL_SIZE);
/** /**
* Constructs a new offline message store. * Constructs a new offline message store.
...@@ -181,7 +181,7 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene ...@@ -181,7 +181,7 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene
* @return An iterator of packets containing all offline messages. * @return An iterator of packets containing all offline messages.
*/ */
public Collection<OfflineMessage> getMessages(String username, boolean delete) { public Collection<OfflineMessage> getMessages(String username, boolean delete) {
List<OfflineMessage> messages = new ArrayList<OfflineMessage>(); List<OfflineMessage> messages = new ArrayList<>();
SAXReader xmlReader = null; SAXReader xmlReader = null;
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
......
...@@ -50,7 +50,7 @@ public class OfflineMessageStrategy extends BasicModule implements ServerFeature ...@@ -50,7 +50,7 @@ public class OfflineMessageStrategy extends BasicModule implements ServerFeature
private static int quota = 100*1024; // Default to 100 K. private static int quota = 100*1024; // Default to 100 K.
private static Type type = Type.store_and_bounce; private static Type type = Type.store_and_bounce;
private static List<OfflineMessageListener> listeners = new CopyOnWriteArrayList<OfflineMessageListener>(); private static List<OfflineMessageListener> listeners = new CopyOnWriteArrayList<>();
private OfflineMessageStore messageStore; private OfflineMessageStore messageStore;
private JID serverAddress; private JID serverAddress;
......
...@@ -73,7 +73,7 @@ public class PrivateStorage extends BasicModule implements UserEventListener { ...@@ -73,7 +73,7 @@ public class PrivateStorage extends BasicModule implements UserEventListener {
/** /**
* Pool of SAX Readers. SAXReader is not thread safe so we need to have a pool of readers. * Pool of SAX Readers. SAXReader is not thread safe so we need to have a pool of readers.
*/ */
private BlockingQueue<SAXReader> xmlReaders = new LinkedBlockingQueue<SAXReader>(POOL_SIZE); private BlockingQueue<SAXReader> xmlReaders = new LinkedBlockingQueue<>(POOL_SIZE);
/** /**
* Constructs a new PrivateStore instance. * Constructs a new PrivateStore instance.
......
...@@ -34,7 +34,7 @@ import java.util.List; ...@@ -34,7 +34,7 @@ import java.util.List;
public class ServerPort { public class ServerPort {
private int port; private int port;
private List<String> names = new ArrayList<String>(1); private List<String> names = new ArrayList<>(1);
private String address; private String address;
private boolean secure; private boolean secure;
private String algorithm; private String algorithm;
......
...@@ -237,7 +237,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/ ...@@ -237,7 +237,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/
* @return all sessions originated from connection managers. * @return all sessions originated from connection managers.
*/ */
public List<ConnectionMultiplexerSession> getConnectionMultiplexerSessions() { public List<ConnectionMultiplexerSession> getConnectionMultiplexerSessions() {
List<ConnectionMultiplexerSession> sessions = new ArrayList<ConnectionMultiplexerSession>(); List<ConnectionMultiplexerSession> sessions = new ArrayList<>();
// Add sessions of CMs connected to this JVM // Add sessions of CMs connected to this JVM
sessions.addAll(localSessionManager.getConnnectionManagerSessions().values()); sessions.addAll(localSessionManager.getConnnectionManagerSessions().values());
// Add sessions of CMs connected to other cluster nodes // Add sessions of CMs connected to other cluster nodes
...@@ -262,7 +262,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/ ...@@ -262,7 +262,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/
* whose domain matches the specified domain. * whose domain matches the specified domain.
*/ */
public List<ConnectionMultiplexerSession> getConnectionMultiplexerSessions(String domain) { public List<ConnectionMultiplexerSession> getConnectionMultiplexerSessions(String domain) {
List<ConnectionMultiplexerSession> sessions = new ArrayList<ConnectionMultiplexerSession>(); List<ConnectionMultiplexerSession> sessions = new ArrayList<>();
// Add sessions of CMs connected to this JVM // Add sessions of CMs connected to this JVM
for (String address : localSessionManager.getConnnectionManagerSessions().keySet()) { for (String address : localSessionManager.getConnnectionManagerSessions().keySet()) {
JID jid = new JID(address); JID jid = new JID(address);
...@@ -454,7 +454,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/ ...@@ -454,7 +454,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/
lock.lock(); lock.lock();
List<String> streamIDs = hostnameSessionsCache.get(hostname); List<String> streamIDs = hostnameSessionsCache.get(hostname);
if (streamIDs == null) { if (streamIDs == null) {
streamIDs = new ArrayList<String>(); streamIDs = new ArrayList<>();
} }
streamIDs.add(streamID); streamIDs.add(streamID);
hostnameSessionsCache.put(hostname, streamIDs); hostnameSessionsCache.put(hostname, streamIDs);
...@@ -468,7 +468,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/ ...@@ -468,7 +468,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/
lock.lock(); lock.lock();
Set<String> validatedDomains = validatedDomainsCache.get(streamID); Set<String> validatedDomains = validatedDomainsCache.get(streamID);
if (validatedDomains == null) { if (validatedDomains == null) {
validatedDomains = new HashSet<String>(); validatedDomains = new HashSet<>();
} }
boolean added = validatedDomains.add(hostname); boolean added = validatedDomains.add(hostname);
if (added) { if (added) {
...@@ -516,7 +516,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/ ...@@ -516,7 +516,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/
lock.lock(); lock.lock();
Set<String> validatedDomains = validatedDomainsCache.get(streamID); Set<String> validatedDomains = validatedDomainsCache.get(streamID);
if (validatedDomains == null) { if (validatedDomains == null) {
validatedDomains = new HashSet<String>(); validatedDomains = new HashSet<>();
} }
validatedDomains.remove(hostname); validatedDomains.remove(hostname);
if (!validatedDomains.isEmpty()) { if (!validatedDomains.isEmpty()) {
...@@ -787,7 +787,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/ ...@@ -787,7 +787,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/
public Collection<ClientSession> getSessions(SessionResultFilter filter) { public Collection<ClientSession> getSessions(SessionResultFilter filter) {
List<ClientSession> results = new ArrayList<ClientSession>(); List<ClientSession> results = new ArrayList<>();
if (filter != null) { if (filter != null) {
// Grab all the matching sessions // Grab all the matching sessions
results.addAll(getSessions()); results.addAll(getSessions());
...@@ -795,7 +795,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/ ...@@ -795,7 +795,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/
// Now we have a copy of the references so we can spend some time // Now we have a copy of the references so we can spend some time
// doing the rest of the filtering without locking out session access // doing the rest of the filtering without locking out session access
// so let's iterate and filter each session one by one // so let's iterate and filter each session one by one
List<ClientSession> filteredResults = new ArrayList<ClientSession>(); List<ClientSession> filteredResults = new ArrayList<>();
for (ClientSession session : results) { for (ClientSession session : results) {
// Now filter on creation date if needed // Now filter on creation date if needed
filteredResults.add(session); filteredResults.add(session);
...@@ -811,7 +811,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/ ...@@ -811,7 +811,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/
// Now generate the final list. I believe it's faster to to build up a new // Now generate the final list. I believe it's faster to to build up a new
// list than it is to remove items from head and tail of the sorted tree // list than it is to remove items from head and tail of the sorted tree
List<ClientSession> finalResults = new ArrayList<ClientSession>(); List<ClientSession> finalResults = new ArrayList<>();
int startIndex = filter.getStartIndex(); int startIndex = filter.getStartIndex();
Iterator<ClientSession> sortedIter = filteredResults.iterator(); Iterator<ClientSession> sortedIter = filteredResults.iterator();
for (int i = 0; sortedIter.hasNext() && finalResults.size() < maxResults; i++) { for (int i = 0; sortedIter.hasNext() && finalResults.size() < maxResults; i++) {
...@@ -860,7 +860,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/ ...@@ -860,7 +860,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/
} }
else { else {
// Collect the sessions associated to the found stream IDs // Collect the sessions associated to the found stream IDs
List<IncomingServerSession> sessions = new ArrayList<IncomingServerSession>(); List<IncomingServerSession> sessions = new ArrayList<>();
for (String streamID : streamIDs) { for (String streamID : streamIDs) {
// Search in local hosted sessions // Search in local hosted sessions
IncomingServerSession session = localSessionManager.getIncomingServerSession(streamID); IncomingServerSession session = localSessionManager.getIncomingServerSession(streamID);
...@@ -893,7 +893,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/ ...@@ -893,7 +893,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/
} }
public Collection<ClientSession> getSessions(String username) { public Collection<ClientSession> getSessions(String username) {
List<ClientSession> sessionList = new ArrayList<ClientSession>(); List<ClientSession> sessionList = new ArrayList<>();
if (username != null && serverName != null) { if (username != null && serverName != null) {
List<JID> addresses = routingTable.getRoutes(new JID(username, serverName, null, true), null); List<JID> addresses = routingTable.getRoutes(new JID(username, serverName, null, true), null);
for (JID address : addresses) { for (JID address : addresses) {
...@@ -986,7 +986,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/ ...@@ -986,7 +986,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/
* @return a collection with the established sessions from external components. * @return a collection with the established sessions from external components.
*/ */
public Collection<ComponentSession> getComponentSessions() { public Collection<ComponentSession> getComponentSessions() {
List<ComponentSession> sessions = new ArrayList<ComponentSession>(); List<ComponentSession> sessions = new ArrayList<>();
// Add sessions of external components connected to this JVM // Add sessions of external components connected to this JVM
sessions.addAll(localSessionManager.getComponentsSessions()); sessions.addAll(localSessionManager.getComponentsSessions());
// Add sessions of external components connected to other cluster nodes // Add sessions of external components connected to other cluster nodes
...@@ -1616,7 +1616,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/ ...@@ -1616,7 +1616,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/
lock.lock(); lock.lock();
List<String> streamIDs = hostnameSessionsCache.get(hostname); List<String> streamIDs = hostnameSessionsCache.get(hostname);
if (streamIDs == null) { if (streamIDs == null) {
streamIDs = new ArrayList<String>(); streamIDs = new ArrayList<>();
} }
streamIDs.add(streamID); streamIDs.add(streamID);
hostnameSessionsCache.put(hostname, streamIDs); hostnameSessionsCache.put(hostname, streamIDs);
...@@ -1630,7 +1630,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/ ...@@ -1630,7 +1630,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener/
lock.lock(); lock.lock();
Set<String> validatedDomains = validatedDomainsCache.get(streamID); Set<String> validatedDomains = validatedDomainsCache.get(streamID);
if (validatedDomains == null) { if (validatedDomains == null) {
validatedDomains = new HashSet<String>(); validatedDomains = new HashSet<>();
} }
boolean added = validatedDomains.add(hostname); boolean added = validatedDomains.add(hostname);
if (added) { if (added) {
......
...@@ -119,12 +119,12 @@ public class XMPPServer { ...@@ -119,12 +119,12 @@ public class XMPPServer {
/** /**
* All modules loaded by this server * All modules loaded by this server
*/ */
private Map<String, Module> modules = new LinkedHashMap<String, Module>(); private Map<String, Module> modules = new LinkedHashMap<>();
/** /**
* Listeners that will be notified when the server has started or is about to be stopped. * Listeners that will be notified when the server has started or is about to be stopped.
*/ */
private List<XMPPServerListener> listeners = new CopyOnWriteArrayList<XMPPServerListener>(); private List<XMPPServerListener> listeners = new CopyOnWriteArrayList<>();
/** /**
* Location of the home directory. All configuration files should be * Location of the home directory. All configuration files should be
...@@ -1073,7 +1073,7 @@ public class XMPPServer { ...@@ -1073,7 +1073,7 @@ public class XMPPServer {
* @return a list with all the modules registered with the server that inherit from IQHandler. * @return a list with all the modules registered with the server that inherit from IQHandler.
*/ */
public List<IQHandler> getIQHandlers() { public List<IQHandler> getIQHandlers() {
List<IQHandler> answer = new ArrayList<IQHandler>(); List<IQHandler> answer = new ArrayList<>();
for (Module module : modules.values()) { for (Module module : modules.values()) {
if (module instanceof IQHandler) { if (module instanceof IQHandler) {
answer.add((IQHandler) module); answer.add((IQHandler) module);
...@@ -1220,7 +1220,7 @@ public class XMPPServer { ...@@ -1220,7 +1220,7 @@ public class XMPPServer {
* @return a list with all the modules that provide "discoverable" features. * @return a list with all the modules that provide "discoverable" features.
*/ */
public List<ServerFeaturesProvider> getServerFeaturesProviders() { public List<ServerFeaturesProvider> getServerFeaturesProviders() {
List<ServerFeaturesProvider> answer = new ArrayList<ServerFeaturesProvider>(); List<ServerFeaturesProvider> answer = new ArrayList<>();
for (Module module : modules.values()) { for (Module module : modules.values()) {
if (module instanceof ServerFeaturesProvider) { if (module instanceof ServerFeaturesProvider) {
answer.add((ServerFeaturesProvider) module); answer.add((ServerFeaturesProvider) module);
...@@ -1235,7 +1235,7 @@ public class XMPPServer { ...@@ -1235,7 +1235,7 @@ public class XMPPServer {
* @return a list with all the modules that provide "discoverable" identities. * @return a list with all the modules that provide "discoverable" identities.
*/ */
public List<ServerIdentitiesProvider> getServerIdentitiesProviders() { public List<ServerIdentitiesProvider> getServerIdentitiesProviders() {
List<ServerIdentitiesProvider> answer = new ArrayList<ServerIdentitiesProvider>(); List<ServerIdentitiesProvider> answer = new ArrayList<>();
for (Module module : modules.values()) { for (Module module : modules.values()) {
if (module instanceof ServerIdentitiesProvider) { if (module instanceof ServerIdentitiesProvider) {
answer.add((ServerIdentitiesProvider) module); answer.add((ServerIdentitiesProvider) module);
...@@ -1252,7 +1252,7 @@ public class XMPPServer { ...@@ -1252,7 +1252,7 @@ public class XMPPServer {
* the server. * the server.
*/ */
public List<ServerItemsProvider> getServerItemsProviders() { public List<ServerItemsProvider> getServerItemsProviders() {
List<ServerItemsProvider> answer = new ArrayList<ServerItemsProvider>(); List<ServerItemsProvider> answer = new ArrayList<>();
for (Module module : modules.values()) { for (Module module : modules.values()) {
if (module instanceof ServerItemsProvider) { if (module instanceof ServerItemsProvider) {
answer.add((ServerItemsProvider) module); answer.add((ServerItemsProvider) module);
...@@ -1267,7 +1267,7 @@ public class XMPPServer { ...@@ -1267,7 +1267,7 @@ public class XMPPServer {
* @return a list with all the modules that provide "discoverable" user identities. * @return a list with all the modules that provide "discoverable" user identities.
*/ */
public List<UserIdentitiesProvider> getUserIdentitiesProviders() { public List<UserIdentitiesProvider> getUserIdentitiesProviders() {
List<UserIdentitiesProvider> answer = new ArrayList<UserIdentitiesProvider>(); List<UserIdentitiesProvider> answer = new ArrayList<>();
for (Module module : modules.values()) { for (Module module : modules.values()) {
if (module instanceof UserIdentitiesProvider) { if (module instanceof UserIdentitiesProvider) {
answer.add((UserIdentitiesProvider) module); answer.add((UserIdentitiesProvider) module);
...@@ -1284,7 +1284,7 @@ public class XMPPServer { ...@@ -1284,7 +1284,7 @@ public class XMPPServer {
* users. * users.
*/ */
public List<UserItemsProvider> getUserItemsProviders() { public List<UserItemsProvider> getUserItemsProviders() {
List<UserItemsProvider> answer = new ArrayList<UserItemsProvider>(); List<UserItemsProvider> answer = new ArrayList<>();
for (Module module : modules.values()) { for (Module module : modules.values()) {
if (module instanceof UserItemsProvider) { if (module instanceof UserItemsProvider) {
answer.add((UserItemsProvider) module); answer.add((UserItemsProvider) module);
......
...@@ -284,7 +284,7 @@ public class AdminManager { ...@@ -284,7 +284,7 @@ public class AdminManager {
public void clearAdminUsers() { public void clearAdminUsers() {
// Clear the admin list cache. // Clear the admin list cache.
if (adminList == null) { if (adminList == null) {
adminList = new ArrayList<JID>(); adminList = new ArrayList<>();
} }
else { else {
adminList.clear(); adminList.clear();
...@@ -300,12 +300,12 @@ public class AdminManager { ...@@ -300,12 +300,12 @@ public class AdminManager {
*/ */
public void setAdminUsers(List<String> usernames) { public void setAdminUsers(List<String> usernames) {
if (adminList == null) { if (adminList == null) {
adminList = new ArrayList<JID>(); adminList = new ArrayList<>();
} }
else { else {
adminList.clear(); adminList.clear();
} }
List<JID> admins = new ArrayList<JID>(); List<JID> admins = new ArrayList<>();
for (String username : usernames) { for (String username : usernames) {
admins.add(XMPPServer.getInstance().createJID(username, null)); admins.add(XMPPServer.getInstance().createJID(username, null));
} }
...@@ -320,13 +320,13 @@ public class AdminManager { ...@@ -320,13 +320,13 @@ public class AdminManager {
*/ */
public void setAdminJIDs(List<JID> jids) { public void setAdminJIDs(List<JID> jids) {
if (adminList == null) { if (adminList == null) {
adminList = new ArrayList<JID>(); adminList = new ArrayList<>();
} }
else { else {
adminList.clear(); adminList.clear();
} }
List<JID> admins = new ArrayList<JID>(); List<JID> admins = new ArrayList<>();
for (JID jid : jids) for (JID jid : jids)
{ {
if (jid != null) { if (jid != null) {
......
...@@ -92,7 +92,7 @@ public class DefaultAdminProvider implements AdminProvider { ...@@ -92,7 +92,7 @@ public class DefaultAdminProvider implements AdminProvider {
*/ */
@Override @Override
public List<JID> getAdmins() { public List<JID> getAdmins() {
List<JID> adminList = new ArrayList<JID>(); List<JID> adminList = new ArrayList<>();
// Add bare JIDs of users that are admins (may include remote users), primarily used to override/add to list of admin users // Add bare JIDs of users that are admins (may include remote users), primarily used to override/add to list of admin users
String jids = JiveGlobals.getProperty("admin.authorizedJIDs"); String jids = JiveGlobals.getProperty("admin.authorizedJIDs");
...@@ -123,7 +123,7 @@ public class DefaultAdminProvider implements AdminProvider { ...@@ -123,7 +123,7 @@ public class DefaultAdminProvider implements AdminProvider {
*/ */
@Override @Override
public void setAdmins(List<JID> admins) { public void setAdmins(List<JID> admins) {
Collection<String> adminList = new ArrayList<String>(); Collection<String> adminList = new ArrayList<>();
for (JID admin : admins) { for (JID admin : admins) {
adminList.add(admin.toBareJID()); adminList.add(admin.toBareJID());
} }
...@@ -150,7 +150,7 @@ public class DefaultAdminProvider implements AdminProvider { ...@@ -150,7 +150,7 @@ public class DefaultAdminProvider implements AdminProvider {
return; return;
} }
List<JID> adminList = new ArrayList<JID>(); List<JID> adminList = new ArrayList<>();
// Add bare JIDs of users that are admins (may include remote users), primarily used to override/add to list of admin users // Add bare JIDs of users that are admins (may include remote users), primarily used to override/add to list of admin users
String jids = JiveGlobals.getXMLProperty("admin.authorizedJIDs"); String jids = JiveGlobals.getXMLProperty("admin.authorizedJIDs");
......
...@@ -101,7 +101,7 @@ public class AuditorImpl implements Auditor { ...@@ -101,7 +101,7 @@ public class AuditorImpl implements Auditor {
/** /**
* Queue that holds the audited packets that will be later saved to an XML file. * Queue that holds the audited packets that will be later saved to an XML file.
*/ */
private BlockingQueue<AuditPacket> logQueue = new LinkedBlockingQueue<AuditPacket>(); private BlockingQueue<AuditPacket> logQueue = new LinkedBlockingQueue<>();
/** /**
* Allow only a limited number of files for each day, max. three digits (000-999) * Allow only a limited number of files for each day, max. three digits (000-999)
...@@ -240,7 +240,7 @@ public class AuditorImpl implements Auditor { ...@@ -240,7 +240,7 @@ public class AuditorImpl implements Auditor {
// Check if total size has been exceeded // Check if total size has been exceeded
if (totalLength > maxTotalSize) { if (totalLength > maxTotalSize) {
// Sort files by name (chronological order) // Sort files by name (chronological order)
List<File> sortedFiles = new ArrayList<File>(Arrays.asList(files)); List<File> sortedFiles = new ArrayList<>(Arrays.asList(files));
Collections.sort(sortedFiles, new Comparator<File>() { Collections.sort(sortedFiles, new Comparator<File>() {
@Override @Override
public int compare(File o1, File o2) { public int compare(File o1, File o2) {
...@@ -378,7 +378,7 @@ public class AuditorImpl implements Auditor { ...@@ -378,7 +378,7 @@ public class AuditorImpl implements Auditor {
} }
private void saveQueuedPackets() { private void saveQueuedPackets() {
List<AuditPacket> packets = new ArrayList<AuditPacket>(logQueue.size()); List<AuditPacket> packets = new ArrayList<>(logQueue.size());
logQueue.drainTo(packets); logQueue.drainTo(packets);
for (AuditPacket auditPacket : packets) { for (AuditPacket auditPacket : packets) {
try { try {
......
...@@ -58,8 +58,8 @@ public class AuthorizationManager { ...@@ -58,8 +58,8 @@ public class AuthorizationManager {
private static final Logger Log = LoggerFactory.getLogger(AuthorizationManager.class); private static final Logger Log = LoggerFactory.getLogger(AuthorizationManager.class);
private static ArrayList<AuthorizationPolicy> authorizationPolicies = new ArrayList<AuthorizationPolicy>(); private static ArrayList<AuthorizationPolicy> authorizationPolicies = new ArrayList<>();
private static ArrayList<AuthorizationMapping> authorizationMapping = new ArrayList<AuthorizationMapping>(); private static ArrayList<AuthorizationMapping> authorizationMapping = new ArrayList<>();
static { static {
// Convert XML based provider setup to Database based // Convert XML based provider setup to Database based
......
...@@ -42,7 +42,7 @@ public class DefaultAuthorizationMapping implements AuthorizationMapping { ...@@ -42,7 +42,7 @@ public class DefaultAuthorizationMapping implements AuthorizationMapping {
private Vector<String> approvedRealms; private Vector<String> approvedRealms;
public DefaultAuthorizationMapping() { public DefaultAuthorizationMapping() {
approvedRealms = new Vector<String>(); approvedRealms = new Vector<>();
String realmList = JiveGlobals.getProperty("sasl.approvedRealms"); String realmList = JiveGlobals.getProperty("sasl.approvedRealms");
if(realmList != null) { if(realmList != null) {
......
...@@ -66,7 +66,7 @@ public class DefaultAuthorizationPolicy implements AuthorizationPolicy { ...@@ -66,7 +66,7 @@ public class DefaultAuthorizationPolicy implements AuthorizationPolicy {
private boolean proxyAuth; private boolean proxyAuth;
public DefaultAuthorizationPolicy() { public DefaultAuthorizationPolicy() {
approvedRealms = new Vector<String>(); approvedRealms = new Vector<>();
proxyAuth = false; proxyAuth = false;
String realmList = JiveGlobals.getProperty("sasl.approvedRealms"); String realmList = JiveGlobals.getProperty("sasl.approvedRealms");
......
...@@ -83,9 +83,9 @@ public class HybridAuthProvider implements AuthProvider { ...@@ -83,9 +83,9 @@ public class HybridAuthProvider implements AuthProvider {
private AuthProvider secondaryProvider; private AuthProvider secondaryProvider;
private AuthProvider tertiaryProvider; private AuthProvider tertiaryProvider;
private Set<String> primaryOverrides = new HashSet<String>(); private Set<String> primaryOverrides = new HashSet<>();
private Set<String> secondaryOverrides = new HashSet<String>(); private Set<String> secondaryOverrides = new HashSet<>();
private Set<String> tertiaryOverrides = new HashSet<String>(); private Set<String> tertiaryOverrides = new HashSet<>();
public HybridAuthProvider() { public HybridAuthProvider() {
// Convert XML based provider setup to Database based // Convert XML based provider setup to Database based
......
...@@ -61,7 +61,7 @@ public class ClearspaceAdminProvider implements AdminProvider { ...@@ -61,7 +61,7 @@ public class ClearspaceAdminProvider implements AdminProvider {
Log.debug("ClearspaceAdminProvider: permissions query url is: "+path); Log.debug("ClearspaceAdminProvider: permissions query url is: "+path);
Element element = ClearspaceManager.getInstance().executeRequest(GET, path); Element element = ClearspaceManager.getInstance().executeRequest(GET, path);
List<JID> admins = new ArrayList<JID>(); List<JID> admins = new ArrayList<>();
for (String idStr : parseStringArray(element)) { for (String idStr : parseStringArray(element)) {
Log.debug("Admin provider got ID number "+idStr); Log.debug("Admin provider got ID number "+idStr);
Long id = Long.valueOf(idStr); Long id = Long.valueOf(idStr);
...@@ -78,7 +78,7 @@ public class ClearspaceAdminProvider implements AdminProvider { ...@@ -78,7 +78,7 @@ public class ClearspaceAdminProvider implements AdminProvider {
} }
catch (ConnectionException e) { catch (ConnectionException e) {
Log.error(e.getMessage(), e); Log.error(e.getMessage(), e);
return new ArrayList<JID>(); return new ArrayList<>();
} }
catch (Exception e) { catch (Exception e) {
// It is not supported exception, wrap it into an UnsupportedOperationException // It is not supported exception, wrap it into an UnsupportedOperationException
......
...@@ -77,7 +77,7 @@ public class ClearspaceGroupProvider extends AbstractGroupProvider { ...@@ -77,7 +77,7 @@ public class ClearspaceGroupProvider extends AbstractGroupProvider {
@Override @Override
public Collection<String> getSharedGroupNames(JID user) { public Collection<String> getSharedGroupNames(JID user) {
// TODO: is there a better way to get the shared Clearspace groups for a given user? // TODO: is there a better way to get the shared Clearspace groups for a given user?
Collection<String> result = new ArrayList<String>(); Collection<String> result = new ArrayList<>();
Iterator<Group> sharedGroups = new GroupCollection(getGroupNames()).iterator(); Iterator<Group> sharedGroups = new GroupCollection(getGroupNames()).iterator();
while (sharedGroups.hasNext()) { while (sharedGroups.hasNext()) {
Group group = sharedGroups.next(); Group group = sharedGroups.next();
...@@ -160,8 +160,8 @@ public class ClearspaceGroupProvider extends AbstractGroupProvider { ...@@ -160,8 +160,8 @@ public class ClearspaceGroupProvider extends AbstractGroupProvider {
} }
// Get the members and administrators // Get the members and administrators
Collection<JID> members = new ArrayList<JID>(); Collection<JID> members = new ArrayList<>();
Collection<JID> administrators = new ArrayList<JID>(); Collection<JID> administrators = new ArrayList<>();
try { try {
XMPPServer server = XMPPServer.getInstance(); XMPPServer server = XMPPServer.getInstance();
...@@ -187,7 +187,7 @@ public class ClearspaceGroupProvider extends AbstractGroupProvider { ...@@ -187,7 +187,7 @@ public class ClearspaceGroupProvider extends AbstractGroupProvider {
// this won't happen, the group exists. // this won't happen, the group exists.
} }
Map<String, String> properties = new HashMap<String, String>(); Map<String, String> properties = new HashMap<>();
// Type 0 is OPEN // Type 0 is OPEN
if (type == 0) { if (type == 0) {
......
...@@ -154,7 +154,7 @@ public class ClearspaceMUCEventDelegate extends MUCEventDelegate { ...@@ -154,7 +154,7 @@ public class ClearspaceMUCEventDelegate extends MUCEventDelegate {
@Override @Override
public Map<String, String> getRoomConfig(String roomName) { public Map<String, String> getRoomConfig(String roomName) {
Map<String, String> roomConfig = new HashMap<String, String>(); Map<String, String> roomConfig = new HashMap<>();
IQ iq = new IQ(IQ.Type.get); IQ iq = new IQ(IQ.Type.get);
iq.setFrom(csMucDomain); iq.setFrom(csMucDomain);
......
...@@ -115,7 +115,7 @@ public class ClearspaceMUCTranscriptManager implements MUCEventListener { ...@@ -115,7 +115,7 @@ public class ClearspaceMUCTranscriptManager implements MUCEventListener {
public ClearspaceMUCTranscriptManager(TaskEngine taskEngine) { public ClearspaceMUCTranscriptManager(TaskEngine taskEngine) {
this.taskEngine = taskEngine; this.taskEngine = taskEngine;
roomEvents = new ArrayList<ClearspaceMUCTranscriptEvent>(); roomEvents = new ArrayList<>();
String xmppDomain = XMPPServer.getInstance().getServerInfo().getXMPPDomain(); String xmppDomain = XMPPServer.getInstance().getServerInfo().getXMPPDomain();
csMucDomain = ClearspaceManager.MUC_SUBDOMAIN + "." + xmppDomain; csMucDomain = ClearspaceManager.MUC_SUBDOMAIN + "." + xmppDomain;
...@@ -135,7 +135,7 @@ public class ClearspaceMUCTranscriptManager implements MUCEventListener { ...@@ -135,7 +135,7 @@ public class ClearspaceMUCTranscriptManager implements MUCEventListener {
// Store JIDs of rooms that had presence changes, to track occupant counts // Store JIDs of rooms that had presence changes, to track occupant counts
// TODO: Refactor out into a different class // TODO: Refactor out into a different class
Set<String> presenceRoomJids = new HashSet<String>(); Set<String> presenceRoomJids = new HashSet<>();
// Create the transcript-update packet // Create the transcript-update packet
IQ packet = new IQ(); IQ packet = new IQ();
......
...@@ -164,7 +164,7 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM ...@@ -164,7 +164,7 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM
}; };
// Add a new exception map from CS to OF and it will be automatically translated. // Add a new exception map from CS to OF and it will be automatically translated.
exceptionMap = new HashMap<String, String>(); exceptionMap = new HashMap<>();
exceptionMap.put("com.jivesoftware.base.UserNotFoundException", "org.jivesoftware.openfire.user.UserNotFoundException"); exceptionMap.put("com.jivesoftware.base.UserNotFoundException", "org.jivesoftware.openfire.user.UserNotFoundException");
exceptionMap.put("com.jivesoftware.base.UserAlreadyExistsException", "org.jivesoftware.openfire.user.UserAlreadyExistsException"); exceptionMap.put("com.jivesoftware.base.UserAlreadyExistsException", "org.jivesoftware.openfire.user.UserAlreadyExistsException");
exceptionMap.put("com.jivesoftware.base.GroupNotFoundException", "org.jivesoftware.openfire.group.GroupNotFoundException"); exceptionMap.put("com.jivesoftware.base.GroupNotFoundException", "org.jivesoftware.openfire.group.GroupNotFoundException");
...@@ -195,7 +195,7 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM ...@@ -195,7 +195,7 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM
/** /**
* Keep the domains of Clearspace components * Keep the domains of Clearspace components
*/ */
private final List<String> clearspaces = new ArrayList<String>(); private final List<String> clearspaces = new ArrayList<>();
/** /**
* Provides singleton access to an instance of the ClearspaceManager class. * Provides singleton access to an instance of the ClearspaceManager class.
...@@ -351,9 +351,9 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM ...@@ -351,9 +351,9 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM
sharedSecret = properties.get("clearspace.sharedSecret"); sharedSecret = properties.get("clearspace.sharedSecret");
// Creates the cache maps // Creates the cache maps
userIDCache = new DefaultCache<String, Long>("clearspace.userid", 1000, JiveConstants.DAY); userIDCache = new DefaultCache<>("clearspace.userid", 1000, JiveConstants.DAY);
groupIDCache = new DefaultCache<String, Long>("clearspace.groupid", 1000, JiveConstants.DAY); groupIDCache = new DefaultCache<>("clearspace.groupid", 1000, JiveConstants.DAY);
usernameCache = new DefaultCache<Long, String>("clearspace.username", 1000, JiveConstants.DAY); usernameCache = new DefaultCache<>("clearspace.username", 1000, JiveConstants.DAY);
if (Log.isDebugEnabled()) { if (Log.isDebugEnabled()) {
...@@ -710,7 +710,7 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM ...@@ -710,7 +710,7 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM
private List<String> getServerInterfaces() { private List<String> getServerInterfaces() {
List<String> bindInterfaces = new ArrayList<String>(); List<String> bindInterfaces = new ArrayList<>();
String interfaceName = JiveGlobals.getXMLProperty("network.interface"); String interfaceName = JiveGlobals.getXMLProperty("network.interface");
String bindInterface = null; String bindInterface = null;
...@@ -1224,7 +1224,7 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM ...@@ -1224,7 +1224,7 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM
Collections.rotate(clearspaces, 1); Collections.rotate(clearspaces, 1);
} }
packet.setTo(component); packet.setTo(component);
final LinkedBlockingQueue<IQ> answer = new LinkedBlockingQueue<IQ>(8); final LinkedBlockingQueue<IQ> answer = new LinkedBlockingQueue<>(8);
final IQRouter router = XMPPServer.getInstance().getIQRouter(); final IQRouter router = XMPPServer.getInstance().getIQRouter();
router.addIQResultListener(packet.getID(), new IQResultListener() { router.addIQResultListener(packet.getID(), new IQResultListener() {
@Override @Override
......
...@@ -216,7 +216,7 @@ public class ClearspaceUserProvider implements UserProvider { ...@@ -216,7 +216,7 @@ public class ClearspaceUserProvider implements UserProvider {
} catch (Exception e) { } catch (Exception e) {
Log.error(e.getMessage(), e); Log.error(e.getMessage(), e);
} }
return new ArrayList<String>(); return new ArrayList<>();
} }
/** /**
...@@ -229,7 +229,7 @@ public class ClearspaceUserProvider implements UserProvider { ...@@ -229,7 +229,7 @@ public class ClearspaceUserProvider implements UserProvider {
@Override @Override
public Collection<User> getUsers(int startIndex, int numResults) { public Collection<User> getUsers(int startIndex, int numResults) {
String[] usernamesAll = getUsernames().toArray(new String[0]); String[] usernamesAll = getUsernames().toArray(new String[0]);
Collection<String> usernames = new ArrayList<String>(); Collection<String> usernames = new ArrayList<>();
// Filters the user // Filters the user
for (int i = startIndex; (i < startIndex + numResults) && (i < usernamesAll.length); i++) { for (int i = startIndex; (i < startIndex + numResults) && (i < usernamesAll.length); i++) {
...@@ -416,7 +416,7 @@ public class ClearspaceUserProvider implements UserProvider { ...@@ -416,7 +416,7 @@ public class ClearspaceUserProvider implements UserProvider {
*/ */
@Override @Override
public Set<String> getSearchFields() throws UnsupportedOperationException { public Set<String> getSearchFields() throws UnsupportedOperationException {
return new LinkedHashSet<String>(Arrays.asList("Username", "Name", "Email")); return new LinkedHashSet<>(Arrays.asList("Username", "Name", "Email"));
} }
/** /**
...@@ -442,7 +442,7 @@ public class ClearspaceUserProvider implements UserProvider { ...@@ -442,7 +442,7 @@ public class ClearspaceUserProvider implements UserProvider {
queryE.addElement("searchEmail").addText("true"); queryE.addElement("searchEmail").addText("true");
queryE.addElement("searchProfile").addText("false"); queryE.addElement("searchProfile").addText("false");
List<String> usernames = new ArrayList<String>(); List<String> usernames = new ArrayList<>();
try { try {
//TODO create a service on CS to get only the username field //TODO create a service on CS to get only the username field
...@@ -492,7 +492,7 @@ public class ClearspaceUserProvider implements UserProvider { ...@@ -492,7 +492,7 @@ public class ClearspaceUserProvider implements UserProvider {
paramsE.addElement("startIndex").addText(String.valueOf(startIndex)); paramsE.addElement("startIndex").addText(String.valueOf(startIndex));
paramsE.addElement("numResults").addText(String.valueOf(numResults)); paramsE.addElement("numResults").addText(String.valueOf(numResults));
List<String> usernames = new ArrayList<String>(); List<String> usernames = new ArrayList<>();
try { try {
//TODO create a service on CS to get only the username field //TODO create a service on CS to get only the username field
......
...@@ -55,10 +55,10 @@ class ClearspaceVCardTranslator { ...@@ -55,10 +55,10 @@ class ClearspaceVCardTranslator {
PHONE("Phone Number", true); //multiple with primary PHONE("Phone Number", true); //multiple with primary
// Used to get a field from its ID // Used to get a field from its ID
private static Map<Long, ClearspaceField> idMap = new HashMap<Long, ClearspaceField>(); private static Map<Long, ClearspaceField> idMap = new HashMap<>();
// Used to get a field from its name // Used to get a field from its name
private static Map<String, ClearspaceField> nameMap = new HashMap<String, ClearspaceField>(); private static Map<String, ClearspaceField> nameMap = new HashMap<>();
static { static {
nameMap.put(TITLE.getName(), TITLE); nameMap.put(TITLE.getName(), TITLE);
...@@ -590,7 +590,7 @@ class ClearspaceVCardTranslator { ...@@ -590,7 +590,7 @@ class ClearspaceVCardTranslator {
*/ */
private Map<VCardField, String> collectVCardValues(Element vCardElement) { private Map<VCardField, String> collectVCardValues(Element vCardElement) {
Map<VCardField, String> vCardValues = new HashMap<VCardField, String>(); Map<VCardField, String> vCardValues = new HashMap<>();
// Add the Title // Add the Title
vCardValues.put(VCardField.TITLE, vCardElement.elementText("TITLE")); vCardValues.put(VCardField.TITLE, vCardElement.elementText("TITLE"));
......
...@@ -106,7 +106,7 @@ public class WSUtils { ...@@ -106,7 +106,7 @@ public class WSUtils {
* @return An array of strings from the REST response. * @return An array of strings from the REST response.
*/ */
protected static List<String> parseStringArray(Element element) { protected static List<String> parseStringArray(Element element) {
List<String> list = new ArrayList<String>(); List<String> list = new ArrayList<>();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<Node> nodes = (List<Node>) element.selectNodes("return"); List<Node> nodes = (List<Node>) element.selectNodes("return");
for (Node node : nodes) { for (Node node : nodes) {
...@@ -131,7 +131,7 @@ public class WSUtils { ...@@ -131,7 +131,7 @@ public class WSUtils {
* @return An array of strings from the REST response. * @return An array of strings from the REST response.
*/ */
protected static List<String> parseUsernameArray(Element element) { protected static List<String> parseUsernameArray(Element element) {
List<String> list = new ArrayList<String>(); List<String> list = new ArrayList<>();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<Node> nodes = (List<Node>) element.selectNodes("return"); List<Node> nodes = (List<Node>) element.selectNodes("return");
for (Node node : nodes) { for (Node node : nodes) {
......
...@@ -47,8 +47,8 @@ public class ClusterManager { ...@@ -47,8 +47,8 @@ public class ClusterManager {
private static final Logger Log = LoggerFactory.getLogger(ClusterManager.class); private static final Logger Log = LoggerFactory.getLogger(ClusterManager.class);
public static String CLUSTER_PROPERTY_NAME = "clustering.enabled"; public static String CLUSTER_PROPERTY_NAME = "clustering.enabled";
private static Queue<ClusterEventListener> listeners = new ConcurrentLinkedQueue<ClusterEventListener>(); private static Queue<ClusterEventListener> listeners = new ConcurrentLinkedQueue<>();
private static BlockingQueue<Event> events = new LinkedBlockingQueue<Event>(10000); private static BlockingQueue<Event> events = new LinkedBlockingQueue<>(10000);
private static Thread dispatcher; private static Thread dispatcher;
static { static {
......
...@@ -55,7 +55,7 @@ public class GetBasicStatistics implements ClusterTask { ...@@ -55,7 +55,7 @@ public class GetBasicStatistics implements ClusterTask {
@Override @Override
public void run() { public void run() {
SessionManager manager = SessionManager.getInstance(); SessionManager manager = SessionManager.getInstance();
values = new HashMap<String, Object>(); values = new HashMap<>();
values.put(NODE, CacheFactory.getClusterMemberID()); values.put(NODE, CacheFactory.getClusterMemberID());
// Collect number of authenticated users // Collect number of authenticated users
values.put(CLIENT, manager.getUserSessionsCount(true)); values.put(CLIENT, manager.getUserSessionsCount(true));
......
...@@ -41,7 +41,7 @@ import java.util.List; ...@@ -41,7 +41,7 @@ import java.util.List;
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class NodeID implements Externalizable { public class NodeID implements Externalizable {
private static List<NodeID> instances = new ArrayList<NodeID>(); private static List<NodeID> instances = new ArrayList<>();
private byte[] nodeID; private byte[] nodeID;
......
...@@ -132,7 +132,7 @@ public class AdHocCommandHandler extends IQHandler ...@@ -132,7 +132,7 @@ public class AdHocCommandHandler extends IQHandler
@Override @Override
public Iterator<DiscoItem> getItems(String name, String node, JID senderJID) { public Iterator<DiscoItem> getItems(String name, String node, JID senderJID) {
List<DiscoItem> answer = new ArrayList<DiscoItem>(); List<DiscoItem> answer = new ArrayList<>();
if (!NAMESPACE.equals(node)) { if (!NAMESPACE.equals(node)) {
answer = Collections.emptyList(); answer = Collections.emptyList();
} }
......
...@@ -50,17 +50,17 @@ public class AdHocCommandManager { ...@@ -50,17 +50,17 @@ public class AdHocCommandManager {
* Map that holds the offered commands by this service. Note: Key=commandCode, Value=command. * Map that holds the offered commands by this service. Note: Key=commandCode, Value=command.
* commandCode matches the node attribute sent by command requesters. * commandCode matches the node attribute sent by command requesters.
*/ */
private Map<String, AdHocCommand> commands = new ConcurrentHashMap<String, AdHocCommand>(); private Map<String, AdHocCommand> commands = new ConcurrentHashMap<>();
/** /**
* Map that holds the number of command sessions of each requester. * Map that holds the number of command sessions of each requester.
* Note: Key=requester full's JID, Value=number of sessions * Note: Key=requester full's JID, Value=number of sessions
*/ */
private Map<String, AtomicInteger> sessionsCounter = new ConcurrentHashMap<String, AtomicInteger>(); private Map<String, AtomicInteger> sessionsCounter = new ConcurrentHashMap<>();
/** /**
* Map that holds the command sessions. Used mainly to quickly locate a SessionData. * Map that holds the command sessions. Used mainly to quickly locate a SessionData.
* Note: Key=sessionID, Value=SessionData * Note: Key=sessionID, Value=SessionData
*/ */
private Map<String, SessionData> sessions = new ConcurrentHashMap<String, SessionData>(); private Map<String, SessionData> sessions = new ConcurrentHashMap<>();
/** /**
* Adds a new command to the list of supported ad-hoc commands by this server. The new * Adds a new command to the list of supported ad-hoc commands by this server. The new
...@@ -289,7 +289,7 @@ public class AdHocCommandManager { ...@@ -289,7 +289,7 @@ public class AdHocCommandManager {
Element formElement = iqCommand.element(QName.get("x", "jabber:x:data")); Element formElement = iqCommand.element(QName.get("x", "jabber:x:data"));
if (formElement != null) { if (formElement != null) {
// Generate a Map with the variable names and variables values // Generate a Map with the variable names and variables values
Map<String, List<String>> data = new HashMap<String, List<String>>(); Map<String, List<String>> data = new HashMap<>();
DataForm dataForm = new DataForm(formElement); DataForm dataForm = new DataForm(formElement);
for (FormField field : dataForm.getFields()) { for (FormField field : dataForm.getFields()) {
data.put(field.getVariable(), field.getValues()); data.put(field.getVariable(), field.getValues());
......
...@@ -44,7 +44,7 @@ public class SessionData { ...@@ -44,7 +44,7 @@ public class SessionData {
* Map that keeps the association of variables and values obtained in each stage. * Map that keeps the association of variables and values obtained in each stage.
* Note: Key=stage number, Value=Map with key=variable name and value=variable values. * Note: Key=stage number, Value=Map with key=variable name and value=variable values.
*/ */
private Map<Integer, Map<String, List<String>>> stagesData = new HashMap<Integer, Map<String, List<String>>>(); private Map<Integer, Map<String, List<String>>> stagesData = new HashMap<>();
/** /**
* Keeps the default execution action to follow if the command requester does not include * Keeps the default execution action to follow if the command requester does not include
...@@ -52,7 +52,7 @@ public class SessionData { ...@@ -52,7 +52,7 @@ public class SessionData {
*/ */
private AdHocCommand.Action executeAction; private AdHocCommand.Action executeAction;
private List<AdHocCommand.Action> allowedActions = new ArrayList<AdHocCommand.Action>(); private List<AdHocCommand.Action> allowedActions = new ArrayList<>();
/** /**
* Indicates the current stage where the requester is located. Stages are numbered from 0. * Indicates the current stage where the requester is located. Stages are numbered from 0.
...@@ -98,7 +98,7 @@ public class SessionData { ...@@ -98,7 +98,7 @@ public class SessionData {
*/ */
protected void setAllowedActions(List<AdHocCommand.Action> allowedActions) { protected void setAllowedActions(List<AdHocCommand.Action> allowedActions) {
if (allowedActions == null) { if (allowedActions == null) {
allowedActions = new ArrayList<AdHocCommand.Action>(); allowedActions = new ArrayList<>();
} }
this.allowedActions = allowedActions; this.allowedActions = allowedActions;
} }
...@@ -129,7 +129,7 @@ public class SessionData { ...@@ -129,7 +129,7 @@ public class SessionData {
* @return a Map with all the variables and values obtained during all the command stages. * @return a Map with all the variables and values obtained during all the command stages.
*/ */
public Map<String, List<String>> getData() { public Map<String, List<String>> getData() {
Map<String, List<String>> data = new HashMap<String, List<String>>(); Map<String, List<String>> data = new HashMap<>();
for (Map<String, List<String>> stageData : stagesData.values()) { for (Map<String, List<String>> stageData : stagesData.values()) {
data.putAll(stageData); data.putAll(stageData);
} }
......
...@@ -91,7 +91,7 @@ public class GetListActiveUsers extends AdHocCommand { ...@@ -91,7 +91,7 @@ public class GetListActiveUsers extends AdHocCommand {
// Get list of users (i.e. bareJIDs) that are connected to the server // Get list of users (i.e. bareJIDs) that are connected to the server
Collection<ClientSession> sessions = SessionManager.getInstance().getSessions(); Collection<ClientSession> sessions = SessionManager.getInstance().getSessions();
Set<String> users = new HashSet<String>(sessions.size()); Set<String> users = new HashSet<>(sessions.size());
for (ClientSession session : sessions) { for (ClientSession session : sessions) {
if (session.getPresence().isAvailable()) { if (session.getPresence().isAvailable()) {
users.add(session.getAddress().toBareJID()); users.add(session.getAddress().toBareJID());
......
...@@ -59,7 +59,7 @@ public class GetNumberActiveUsers extends AdHocCommand { ...@@ -59,7 +59,7 @@ public class GetNumberActiveUsers extends AdHocCommand {
field.setVariable("activeusersnum"); field.setVariable("activeusersnum");
// Make sure that we are only counting based on bareJIDs and not fullJIDs // Make sure that we are only counting based on bareJIDs and not fullJIDs
Collection<ClientSession> sessions = SessionManager.getInstance().getSessions(); Collection<ClientSession> sessions = SessionManager.getInstance().getSessions();
Set<String> users = new HashSet<String>(sessions.size()); Set<String> users = new HashSet<>(sessions.size());
for (ClientSession session : sessions) { for (ClientSession session : sessions) {
if (session.getPresence().isAvailable()) { if (session.getPresence().isAvailable()) {
users.add(session.getAddress().toBareJID()); users.add(session.getAddress().toBareJID());
......
...@@ -60,7 +60,7 @@ public class GetNumberOnlineUsers extends AdHocCommand { ...@@ -60,7 +60,7 @@ public class GetNumberOnlineUsers extends AdHocCommand {
field.setVariable("onlineusersnum"); field.setVariable("onlineusersnum");
// Make sure that we are only counting based on bareJIDs and not fullJIDs // Make sure that we are only counting based on bareJIDs and not fullJIDs
Collection<ClientSession> sessions = SessionManager.getInstance().getSessions(); Collection<ClientSession> sessions = SessionManager.getInstance().getSessions();
Set<String> users = new HashSet<String>(sessions.size()); Set<String> users = new HashSet<>(sessions.size());
for (ClientSession session : sessions) { for (ClientSession session : sessions) {
users.add(session.getAddress().toBareJID()); users.add(session.getAddress().toBareJID());
} }
......
...@@ -109,7 +109,7 @@ public class GetServerStats extends AdHocCommand { ...@@ -109,7 +109,7 @@ public class GetServerStats extends AdHocCommand {
// Make sure that we are only counting based on bareJIDs and not fullJIDs // Make sure that we are only counting based on bareJIDs and not fullJIDs
Collection<ClientSession> sessions = SessionManager.getInstance().getSessions(); Collection<ClientSession> sessions = SessionManager.getInstance().getSessions();
Set<String> users = new HashSet<String>(sessions.size()); Set<String> users = new HashSet<>(sessions.size());
int availableSessions = 0; int availableSessions = 0;
for (ClientSession session : sessions) { for (ClientSession session : sessions) {
if (session.getPresence().isAvailable()) { if (session.getPresence().isAvailable()) {
......
...@@ -83,14 +83,14 @@ public class GetListGroupUsers extends AdHocCommand { ...@@ -83,14 +83,14 @@ public class GetListGroupUsers extends AdHocCommand {
// Add group members the result // Add group members the result
for (JID memberJID : group.getMembers()) { for (JID memberJID : group.getMembers()) {
Map<String,Object> fields = new HashMap<String,Object>(); Map<String,Object> fields = new HashMap<>();
fields.put("jid", memberJID.toString()); fields.put("jid", memberJID.toString());
fields.put("admin", false); fields.put("admin", false);
form.addItemFields(fields); form.addItemFields(fields);
} }
// Add group admins the result // Add group admins the result
for (JID memberJID : group.getAdmins()) { for (JID memberJID : group.getAdmins()) {
Map<String,Object> fields = new HashMap<String,Object>(); Map<String,Object> fields = new HashMap<>();
fields.put("jid", memberJID.toString()); fields.put("jid", memberJID.toString());
fields.put("admin", true); fields.put("admin", true);
form.addItemFields(fields); form.addItemFields(fields);
......
...@@ -122,7 +122,7 @@ public class GetListGroups extends AdHocCommand { ...@@ -122,7 +122,7 @@ public class GetListGroups extends AdHocCommand {
for (Group group : GroupManager.getInstance().getGroups(nStart, maxItems)) { for (Group group : GroupManager.getInstance().getGroups(nStart, maxItems)) {
boolean isSharedGroup = RosterManager.isSharedGroup(group); boolean isSharedGroup = RosterManager.isSharedGroup(group);
Map<String, String> properties = group.getProperties(); Map<String, String> properties = group.getProperties();
Map<String,Object> fields = new HashMap<String,Object>(); Map<String,Object> fields = new HashMap<>();
fields.put("name", group.getName()); fields.put("name", group.getName());
fields.put("desc", group.getDescription()); fields.put("desc", group.getDescription());
fields.put("count", group.getMembers().size() + group.getAdmins().size()); fields.put("count", group.getMembers().size() + group.getAdmins().size());
......
...@@ -127,7 +127,7 @@ public class UpdateGroup extends AdHocCommand { ...@@ -127,7 +127,7 @@ public class UpdateGroup extends AdHocCommand {
} }
String groupList = group.getProperties().get("sharedRoster.groupList"); String groupList = group.getProperties().get("sharedRoster.groupList");
if (groupList != null) { if (groupList != null) {
Collection<String> groups = new ArrayList<String>(); Collection<String> groups = new ArrayList<>();
StringTokenizer tokenizer = new StringTokenizer(groupList,",\t\n\r\f"); StringTokenizer tokenizer = new StringTokenizer(groupList,",\t\n\r\f");
while (tokenizer.hasMoreTokens()) { while (tokenizer.hasMoreTokens()) {
String tok = tokenizer.nextToken().trim(); String tok = tokenizer.nextToken().trim();
......
...@@ -84,7 +84,7 @@ public class GroupAdminAdded extends AdHocCommand { ...@@ -84,7 +84,7 @@ public class GroupAdminAdded extends AdHocCommand {
String admin = get(data, "admin", 0); String admin = get(data, "admin", 0);
// Adds the admin // Adds the admin
params = new HashMap<String, Object>(); params = new HashMap<>();
params.put("admin", admin); params.put("admin", admin);
} }
catch (NullPointerException npe) { catch (NullPointerException npe) {
......
...@@ -85,7 +85,7 @@ public class GroupAdminRemoved extends AdHocCommand { ...@@ -85,7 +85,7 @@ public class GroupAdminRemoved extends AdHocCommand {
String admin = get(data, "admin", 0); String admin = get(data, "admin", 0);
// Adds the admin // Adds the admin
params = new HashMap<String, Object>(); params = new HashMap<>();
params.put("admin", admin); params.put("admin", admin);
} }
catch (NullPointerException npe) { catch (NullPointerException npe) {
......
...@@ -84,7 +84,7 @@ public class GroupMemberAdded extends AdHocCommand { ...@@ -84,7 +84,7 @@ public class GroupMemberAdded extends AdHocCommand {
String member = get(data, "member", 0); String member = get(data, "member", 0);
// Adds the member // Adds the member
params = new HashMap<String, Object>(); params = new HashMap<>();
params.put("member", member); params.put("member", member);
} }
catch (NullPointerException npe) { catch (NullPointerException npe) {
......
...@@ -84,7 +84,7 @@ public class GroupMemberRemoved extends AdHocCommand { ...@@ -84,7 +84,7 @@ public class GroupMemberRemoved extends AdHocCommand {
String member = get(data, "member", 0); String member = get(data, "member", 0);
// Adds the member // Adds the member
params = new HashMap<String, Object>(); params = new HashMap<>();
params.put("member", member); params.put("member", member);
} }
catch (NullPointerException npe) { catch (NullPointerException npe) {
......
...@@ -104,7 +104,7 @@ public class GroupModified extends AdHocCommand { ...@@ -104,7 +104,7 @@ public class GroupModified extends AdHocCommand {
} }
// Creates event params. // Creates event params.
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<>();
// Gets the value of the change if it exist // Gets the value of the change if it exist
String value; String value;
......
...@@ -105,7 +105,7 @@ public class UserModified extends AdHocCommand { ...@@ -105,7 +105,7 @@ public class UserModified extends AdHocCommand {
} }
// Creates event params. // Creates event params.
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<>();
// Gets the value of the change if it exist // Gets the value of the change if it exist
String value; String value;
......
...@@ -67,7 +67,7 @@ public class ExternalComponentManager { ...@@ -67,7 +67,7 @@ public class ExternalComponentManager {
* List of listeners that will be notified when vCards are created, updated or deleted. * List of listeners that will be notified when vCards are created, updated or deleted.
*/ */
private static List<ExternalComponentManagerListener> listeners = private static List<ExternalComponentManagerListener> listeners =
new CopyOnWriteArrayList<ExternalComponentManagerListener>(); new CopyOnWriteArrayList<>();
public static void setServiceEnabled(boolean enabled) throws ModificationNotAllowedException { public static void setServiceEnabled(boolean enabled) throws ModificationNotAllowedException {
// Alert listeners about this event // Alert listeners about this event
...@@ -351,7 +351,7 @@ public class ExternalComponentManager { ...@@ -351,7 +351,7 @@ public class ExternalComponentManager {
private static Collection<ExternalComponentConfiguration> getConfigurations( private static Collection<ExternalComponentConfiguration> getConfigurations(
Permission permission) { Permission permission) {
Collection<ExternalComponentConfiguration> answer = Collection<ExternalComponentConfiguration> answer =
new ArrayList<ExternalComponentConfiguration>(); new ArrayList<>();
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
......
...@@ -68,13 +68,13 @@ public class InternalComponentManager extends BasicModule implements ComponentMa ...@@ -68,13 +68,13 @@ public class InternalComponentManager extends BasicModule implements ComponentMa
private static final Logger Log = LoggerFactory.getLogger(InternalComponentManager.class); private static final Logger Log = LoggerFactory.getLogger(InternalComponentManager.class);
final private Map<String, RoutableComponents> routables = new ConcurrentHashMap<String, RoutableComponents>(); final private Map<String, RoutableComponents> routables = new ConcurrentHashMap<>();
private Map<String, IQ> componentInfo = new ConcurrentHashMap<String, IQ>(); private Map<String, IQ> componentInfo = new ConcurrentHashMap<>();
private Map<JID, JID> presenceMap = new ConcurrentHashMap<JID, JID>(); private Map<JID, JID> presenceMap = new ConcurrentHashMap<>();
/** /**
* Holds the list of listeners that will be notified of component events. * Holds the list of listeners that will be notified of component events.
*/ */
private List<ComponentEventListener> listeners = new CopyOnWriteArrayList<ComponentEventListener>(); private List<ComponentEventListener> listeners = new CopyOnWriteArrayList<>();
private static InternalComponentManager instance; private static InternalComponentManager instance;
/** /**
...@@ -212,7 +212,7 @@ public class InternalComponentManager extends BasicModule implements ComponentMa ...@@ -212,7 +212,7 @@ public class InternalComponentManager extends BasicModule implements ComponentMa
if (routables == null || (components = routables.get(subdomain)) == null) { if (routables == null || (components = routables.get(subdomain)) == null) {
return; return;
} }
List<Component> componentsToRemove = new ArrayList<Component>(components.getComponents()); List<Component> componentsToRemove = new ArrayList<>(components.getComponents());
for (Component component : componentsToRemove) { for (Component component : componentsToRemove) {
removeComponent(subdomain, component); removeComponent(subdomain, component);
} }
...@@ -291,7 +291,7 @@ public class InternalComponentManager extends BasicModule implements ComponentMa ...@@ -291,7 +291,7 @@ public class InternalComponentManager extends BasicModule implements ComponentMa
@Override @Override
public IQ query(Component component, IQ packet, long timeout) throws ComponentException { public IQ query(Component component, IQ packet, long timeout) throws ComponentException {
final LinkedBlockingQueue<IQ> answer = new LinkedBlockingQueue<IQ>(8); final LinkedBlockingQueue<IQ> answer = new LinkedBlockingQueue<>(8);
XMPPServer.getInstance().getIQRouter().addIQResultListener(packet.getID(), new IQResultListener() { XMPPServer.getInstance().getIQRouter().addIQResultListener(packet.getID(), new IQResultListener() {
@Override @Override
public void receivedAnswer(IQ packet) { public void receivedAnswer(IQ packet) {
...@@ -549,7 +549,7 @@ public class InternalComponentManager extends BasicModule implements ComponentMa ...@@ -549,7 +549,7 @@ public class InternalComponentManager extends BasicModule implements ComponentMa
private static class RoutableComponents implements RoutableChannelHandler { private static class RoutableComponents implements RoutableChannelHandler {
private JID jid; private JID jid;
final private List<Component> components = new ArrayList<Component>(); final private List<Component> components = new ArrayList<>();
public RoutableComponents(JID jid, Component component) { public RoutableComponents(JID jid, Component component) {
this.jid = jid; this.jid = jid;
......
...@@ -99,7 +99,7 @@ public class PluginCacheConfigurator { ...@@ -99,7 +99,7 @@ public class PluginCacheConfigurator {
} }
private Map<String, String> readInitParams(Node configData) { private Map<String, String> readInitParams(Node configData) {
Map<String, String> paramMap = new HashMap<String, String>(); Map<String, String> paramMap = new HashMap<>();
List<Node> params = configData.selectNodes("init-params/init-param"); List<Node> params = configData.selectNodes("init-params/init-param");
for (Node param : params) { for (Node param : params) {
String paramName = param.selectSingleNode("param-name").getStringValue(); String paramName = param.selectSingleNode("param-name").getStringValue();
......
...@@ -40,8 +40,8 @@ public class PluginCacheRegistry { ...@@ -40,8 +40,8 @@ public class PluginCacheRegistry {
private static final PluginCacheRegistry instance = new PluginCacheRegistry(); private static final PluginCacheRegistry instance = new PluginCacheRegistry();
private Map<String, CacheInfo> extraCacheMappings = new HashMap<String, CacheInfo>(); private Map<String, CacheInfo> extraCacheMappings = new HashMap<>();
private Map<String, List<CacheInfo>> pluginCaches = new HashMap<String, List<CacheInfo>>(); private Map<String, List<CacheInfo>> pluginCaches = new HashMap<>();
public static PluginCacheRegistry getInstance() { public static PluginCacheRegistry getInstance() {
return instance; return instance;
...@@ -61,7 +61,7 @@ public class PluginCacheRegistry { ...@@ -61,7 +61,7 @@ public class PluginCacheRegistry {
List<CacheInfo> caches = pluginCaches.get(pluginName); List<CacheInfo> caches = pluginCaches.get(pluginName);
if (caches == null) { if (caches == null) {
caches = new ArrayList<CacheInfo>(); caches = new ArrayList<>();
pluginCaches.put(pluginName, caches); pluginCaches.put(pluginName, caches);
} }
......
...@@ -742,5 +742,4 @@ public class PluginClassLoader extends URLClassLoader { ...@@ -742,5 +742,4 @@ public class PluginClassLoader extends URLClassLoader {
result.addAll(Arrays.asList(super.getURLs())); result.addAll(Arrays.asList(super.getURLs()));
return result.toArray(new URL[result.size()]); return result.toArray(new URL[result.size()]);
} }
} }
...@@ -92,8 +92,8 @@ public class PluginManager { ...@@ -92,8 +92,8 @@ public class PluginManager {
private Map<Plugin, String> childPluginMap; private Map<Plugin, String> childPluginMap;
private Set<String> devPlugins; private Set<String> devPlugins;
private PluginMonitor pluginMonitor; private PluginMonitor pluginMonitor;
private Set<PluginListener> pluginListeners = new CopyOnWriteArraySet<PluginListener>(); private Set<PluginListener> pluginListeners = new CopyOnWriteArraySet<>();
private Set<PluginManagerListener> pluginManagerListeners = new CopyOnWriteArraySet<PluginManagerListener>(); private Set<PluginManagerListener> pluginManagerListeners = new CopyOnWriteArraySet<>();
/** /**
* Constructs a new plugin manager. * Constructs a new plugin manager.
...@@ -102,14 +102,14 @@ public class PluginManager { ...@@ -102,14 +102,14 @@ public class PluginManager {
*/ */
public PluginManager(File pluginDir) { public PluginManager(File pluginDir) {
this.pluginDirectory = pluginDir; this.pluginDirectory = pluginDir;
plugins = new ConcurrentHashMap<String, Plugin>(); plugins = new ConcurrentHashMap<>();
pluginDirs = new HashMap<Plugin, File>(); pluginDirs = new HashMap<>();
pluginFiles = new HashMap<String, File>(); pluginFiles = new HashMap<>();
classloaders = new HashMap<Plugin, PluginClassLoader>(); classloaders = new HashMap<>();
pluginDevelopment = new HashMap<Plugin, PluginDevEnvironment>(); pluginDevelopment = new HashMap<>();
parentPluginMap = new HashMap<Plugin, List<String>>(); parentPluginMap = new HashMap<>();
childPluginMap = new HashMap<Plugin, String>(); childPluginMap = new HashMap<>();
devPlugins = new HashSet<String>(); devPlugins = new HashSet<>();
pluginMonitor = new PluginMonitor(); pluginMonitor = new PluginMonitor();
} }
...@@ -429,7 +429,7 @@ public class PluginManager { ...@@ -429,7 +429,7 @@ public class PluginManager {
String parentPlugin = parentPluginNode.getTextTrim(); String parentPlugin = parentPluginNode.getTextTrim();
List<String> childrenPlugins = parentPluginMap.get(plugins.get(parentPlugin)); List<String> childrenPlugins = parentPluginMap.get(plugins.get(parentPlugin));
if (childrenPlugins == null) { if (childrenPlugins == null) {
childrenPlugins = new ArrayList<String>(); childrenPlugins = new ArrayList<>();
parentPluginMap.put(plugins.get(parentPlugin), childrenPlugins); parentPluginMap.put(plugins.get(parentPlugin), childrenPlugins);
} }
childrenPlugins.add(pluginName); childrenPlugins.add(pluginName);
...@@ -1040,7 +1040,7 @@ public class PluginManager { ...@@ -1040,7 +1040,7 @@ public class PluginManager {
}); });
// Turn the list of JAR/WAR files into a set so that we can do lookups. // Turn the list of JAR/WAR files into a set so that we can do lookups.
Set<String> jarSet = new HashSet<String>(); Set<String> jarSet = new HashSet<>();
for (File file : jars) { for (File file : jars) {
jarSet.add(file.getName().toLowerCase()); jarSet.add(file.getName().toLowerCase());
} }
...@@ -1049,7 +1049,7 @@ public class PluginManager { ...@@ -1049,7 +1049,7 @@ public class PluginManager {
// due to the JAR file being deleted (ignore admin plugin). // due to the JAR file being deleted (ignore admin plugin).
// Build a list of plugins to delete first so that the plugins // Build a list of plugins to delete first so that the plugins
// keyset isn't modified as we're iterating through it. // keyset isn't modified as we're iterating through it.
List<String> toDelete = new ArrayList<String>(); List<String> toDelete = new ArrayList<>();
for (File pluginDir : dirs) { for (File pluginDir : dirs) {
String pluginName = pluginDir.getName(); String pluginName = pluginDir.getName();
if (pluginName.equals("admin")) { if (pluginName.equals("admin")) {
...@@ -1150,7 +1150,7 @@ public class PluginManager { ...@@ -1150,7 +1150,7 @@ public class PluginManager {
// Always try to delete JAR files first since that's what will // Always try to delete JAR files first since that's what will
// be under contention. We do this by always sorting the lib directory // be under contention. We do this by always sorting the lib directory
// first. // first.
List<String> children = new ArrayList<String>(Arrays.asList(childDirs)); List<String> children = new ArrayList<>(Arrays.asList(childDirs));
Collections.sort(children, new Comparator<String>() { Collections.sort(children, new Comparator<String>() {
@Override @Override
public int compare(String o1, String o2) { public int compare(String o1, String o2) {
......
...@@ -79,7 +79,7 @@ public class PluginServlet extends HttpServlet { ...@@ -79,7 +79,7 @@ public class PluginServlet extends HttpServlet {
private static ServletConfig servletConfig; private static ServletConfig servletConfig;
static { static {
servlets = new ConcurrentHashMap<String, GenericServlet>(); servlets = new ConcurrentHashMap<>();
} }
public static final String PLUGINS_WEBROOT = "/plugins/"; public static final String PLUGINS_WEBROOT = "/plugins/";
...@@ -154,7 +154,7 @@ public class PluginServlet extends HttpServlet { ...@@ -154,7 +154,7 @@ public class PluginServlet extends HttpServlet {
Document doc = saxReader.read(webXML); Document doc = saxReader.read(webXML);
// Find all <servlet> entries to discover name to class mapping. // Find all <servlet> entries to discover name to class mapping.
List classes = doc.selectNodes("//servlet"); List classes = doc.selectNodes("//servlet");
Map<String, Class> classMap = new HashMap<String, Class>(); Map<String, Class> classMap = new HashMap<>();
for (int i = 0; i < classes.size(); i++) { for (int i = 0; i < classes.size(); i++) {
Element servletElement = (Element)classes.get(i); Element servletElement = (Element)classes.get(i);
String name = servletElement.element("servlet-name").getTextTrim(); String name = servletElement.element("servlet-name").getTextTrim();
......
...@@ -39,7 +39,7 @@ public class CrowdAdminProvider implements AdminProvider { ...@@ -39,7 +39,7 @@ public class CrowdAdminProvider implements AdminProvider {
@Override @Override
public List<JID> getAdmins() { public List<JID> getAdmins() {
List<JID> results = new ArrayList<JID>(); List<JID> results = new ArrayList<>();
GroupProvider provider = GroupManager.getInstance().getProvider(); GroupProvider provider = GroupManager.getInstance().getProvider();
......
...@@ -54,7 +54,7 @@ public class CrowdGroupProvider extends AbstractGroupProvider { ...@@ -54,7 +54,7 @@ public class CrowdGroupProvider extends AbstractGroupProvider {
private static final ScheduledExecutorService crowdGroupSync = Executors.newSingleThreadScheduledExecutor(); private static final ScheduledExecutorService crowdGroupSync = Executors.newSingleThreadScheduledExecutor();
private static final CrowdManager manager = CrowdManager.getInstance(); private static final CrowdManager manager = CrowdManager.getInstance();
private static List<String> groups = new ArrayList<String>(); private static List<String> groups = new ArrayList<>();
private final XMPPServer server = XMPPServer.getInstance(); private final XMPPServer server = XMPPServer.getInstance();
...@@ -114,8 +114,8 @@ public class CrowdGroupProvider extends AbstractGroupProvider { ...@@ -114,8 +114,8 @@ public class CrowdGroupProvider extends AbstractGroupProvider {
try { try {
List<String> users = manager.getGroupMembers(groupName); List<String> users = manager.getGroupMembers(groupName);
Collection<JID> results = new ArrayList<JID>(); Collection<JID> results = new ArrayList<>();
for (String username : users) { for (String username : users) {
results.add(server.createJID(username, null)); results.add(server.createJID(username, null));
} }
...@@ -175,7 +175,7 @@ public class CrowdGroupProvider extends AbstractGroupProvider { ...@@ -175,7 +175,7 @@ public class CrowdGroupProvider extends AbstractGroupProvider {
public Collection<String> getGroupNames(int startIndex, int numResults) { public Collection<String> getGroupNames(int startIndex, int numResults) {
lock.readLock().lock(); lock.readLock().lock();
try { try {
Collection<String> results = new ArrayList<String>(numResults); Collection<String> results = new ArrayList<>(numResults);
for (int i = 0, j = startIndex; i < numResults && j < groups.size(); ++i, ++j) { for (int i = 0, j = startIndex; i < numResults && j < groups.size(); ++i, ++j) {
results.add(groups.get(j)); results.add(groups.get(j));
...@@ -191,7 +191,7 @@ public class CrowdGroupProvider extends AbstractGroupProvider { ...@@ -191,7 +191,7 @@ public class CrowdGroupProvider extends AbstractGroupProvider {
public Collection<String> search(String query) { public Collection<String> search(String query) {
lock.readLock().lock(); lock.readLock().lock();
try { try {
ArrayList<String> results = new ArrayList<String>(); ArrayList<String> results = new ArrayList<>();
if (query != null && query.trim().length() > 0) { if (query != null && query.trim().length() > 0) {
...@@ -223,7 +223,7 @@ public class CrowdGroupProvider extends AbstractGroupProvider { ...@@ -223,7 +223,7 @@ public class CrowdGroupProvider extends AbstractGroupProvider {
try { try {
ArrayList<String> foundGroups = (ArrayList<String>) search(query); ArrayList<String> foundGroups = (ArrayList<String>) search(query);
Collection<String> results = new ArrayList<String>(); Collection<String> results = new ArrayList<>();
for (int i = 0, j = startIndex; i < numResults && j < foundGroups.size(); ++i, ++j) { for (int i = 0, j = startIndex; i < numResults && j < foundGroups.size(); ++i, ++j) {
results.add(foundGroups.get(j)); results.add(foundGroups.get(j));
......
...@@ -173,7 +173,7 @@ public class CrowdManager { ...@@ -173,7 +173,7 @@ public class CrowdManager {
int maxResults = 100; int maxResults = 100;
int startIndex = 0; int startIndex = 0;
List<User> results = new ArrayList<User>(); List<User> results = new ArrayList<>();
StringBuilder request = new StringBuilder("search?entity-type=user&expand=user&restriction=active%3dtrue") StringBuilder request = new StringBuilder("search?entity-type=user&expand=user&restriction=active%3dtrue")
.append("&max-results=").append(maxResults) .append("&max-results=").append(maxResults)
.append("&start-index="); .append("&start-index=");
...@@ -227,7 +227,7 @@ public class CrowdManager { ...@@ -227,7 +227,7 @@ public class CrowdManager {
int maxResults = 100; int maxResults = 100;
int startIndex = 0; int startIndex = 0;
List<String> results = new ArrayList<String>(); List<String> results = new ArrayList<>();
StringBuilder request = new StringBuilder("search?entity-type=group&restriction=active%3dtrue") StringBuilder request = new StringBuilder("search?entity-type=group&restriction=active%3dtrue")
.append("&max-results=").append(maxResults) .append("&max-results=").append(maxResults)
.append("&start-index="); .append("&start-index=");
...@@ -282,7 +282,7 @@ public class CrowdManager { ...@@ -282,7 +282,7 @@ public class CrowdManager {
int maxResults = 100; int maxResults = 100;
int startIndex = 0; int startIndex = 0;
List<String> results = new ArrayList<String>(); List<String> results = new ArrayList<>();
StringBuilder request = new StringBuilder("user/group/nested?username=").append(urlEncode(username)) StringBuilder request = new StringBuilder("user/group/nested?username=").append(urlEncode(username))
.append("&max-results=").append(maxResults) .append("&max-results=").append(maxResults)
.append("&start-index="); .append("&start-index=");
...@@ -366,7 +366,7 @@ public class CrowdManager { ...@@ -366,7 +366,7 @@ public class CrowdManager {
int maxResults = 100; int maxResults = 100;
int startIndex = 0; int startIndex = 0;
List<String> results = new ArrayList<String>(); List<String> results = new ArrayList<>();
StringBuilder request = new StringBuilder("group/user/nested?groupname=").append(urlEncode(groupName)) StringBuilder request = new StringBuilder("group/user/nested?groupname=").append(urlEncode(groupName))
.append("&max-results=").append(maxResults) .append("&max-results=").append(maxResults)
.append("&start-index="); .append("&start-index=");
......
...@@ -51,14 +51,14 @@ public class CrowdUserProvider implements UserProvider { ...@@ -51,14 +51,14 @@ public class CrowdUserProvider implements UserProvider {
private static final String SEARCH_FIELD_USERNAME = "Username"; private static final String SEARCH_FIELD_USERNAME = "Username";
private static final String SEARCH_FIELD_NAME = "Name"; private static final String SEARCH_FIELD_NAME = "Name";
private static final String SEARCH_FIELD_EMAIL = "Email"; private static final String SEARCH_FIELD_EMAIL = "Email";
private static final Set<String> SEARCH_FIELDS = new TreeSet<String>(Arrays.asList( private static final Set<String> SEARCH_FIELDS = new TreeSet<>(Arrays.asList(
new String[]{SEARCH_FIELD_USERNAME, SEARCH_FIELD_NAME, SEARCH_FIELD_EMAIL})); new String[]{SEARCH_FIELD_USERNAME, SEARCH_FIELD_NAME, SEARCH_FIELD_EMAIL}));
private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
private final ScheduledExecutorService crowdUserSync = Executors.newSingleThreadScheduledExecutor(); private final ScheduledExecutorService crowdUserSync = Executors.newSingleThreadScheduledExecutor();
private Map<String, org.jivesoftware.openfire.crowd.jaxb.User> usersCache = new TreeMap<String, org.jivesoftware.openfire.crowd.jaxb.User>(); private Map<String, org.jivesoftware.openfire.crowd.jaxb.User> usersCache = new TreeMap<>();
private List<org.jivesoftware.openfire.crowd.jaxb.User> users = new ArrayList<org.jivesoftware.openfire.crowd.jaxb.User>(); private List<org.jivesoftware.openfire.crowd.jaxb.User> users = new ArrayList<>();
public CrowdUserProvider() { public CrowdUserProvider() {
String propertyValue = JiveGlobals.getProperty(JIVE_CROWD_USERS_CACHE_TTL_SECS); String propertyValue = JiveGlobals.getProperty(JIVE_CROWD_USERS_CACHE_TTL_SECS);
...@@ -111,7 +111,7 @@ public class CrowdUserProvider implements UserProvider { ...@@ -111,7 +111,7 @@ public class CrowdUserProvider implements UserProvider {
public Collection<User> getUsers() { public Collection<User> getUsers() {
lock.readLock().lock(); lock.readLock().lock();
try { try {
Collection<User> results = new ArrayList<User>(); Collection<User> results = new ArrayList<>();
for (org.jivesoftware.openfire.crowd.jaxb.User user : usersCache.values()) { for (org.jivesoftware.openfire.crowd.jaxb.User user : usersCache.values()) {
results.add(user.getOpenfireUser()); results.add(user.getOpenfireUser());
} }
...@@ -135,7 +135,7 @@ public class CrowdUserProvider implements UserProvider { ...@@ -135,7 +135,7 @@ public class CrowdUserProvider implements UserProvider {
public Collection<User> getUsers(int startIndex, int numResults) { public Collection<User> getUsers(int startIndex, int numResults) {
lock.readLock().lock(); lock.readLock().lock();
try { try {
Collection<User> results = new ArrayList<User>(numResults); Collection<User> results = new ArrayList<>(numResults);
for (int i = 0, j = startIndex; i < numResults && j < users.size(); ++i, ++j) { for (int i = 0, j = startIndex; i < numResults && j < users.size(); ++i, ++j) {
results.add(users.get(j).getOpenfireUser()); results.add(users.get(j).getOpenfireUser());
...@@ -156,7 +156,7 @@ public class CrowdUserProvider implements UserProvider { ...@@ -156,7 +156,7 @@ public class CrowdUserProvider implements UserProvider {
public Collection<User> findUsers(Set<String> fields, String query) throws UnsupportedOperationException { public Collection<User> findUsers(Set<String> fields, String query) throws UnsupportedOperationException {
lock.readLock().lock(); lock.readLock().lock();
try { try {
ArrayList<User> results = new ArrayList<User>(); ArrayList<User> results = new ArrayList<>();
if (query != null && query.trim().length() > 0) { if (query != null && query.trim().length() > 0) {
...@@ -207,7 +207,7 @@ public class CrowdUserProvider implements UserProvider { ...@@ -207,7 +207,7 @@ public class CrowdUserProvider implements UserProvider {
try { try {
ArrayList<User> foundUsers = (ArrayList<User>) findUsers(fields, query); ArrayList<User> foundUsers = (ArrayList<User>) findUsers(fields, query);
Collection<User> results = new ArrayList<User>(foundUsers.size()); Collection<User> results = new ArrayList<>(foundUsers.size());
for (int i = 0, j = startIndex; i < numResults && j < foundUsers.size(); ++i, ++j) { for (int i = 0, j = startIndex; i < numResults && j < foundUsers.size(); ++i, ++j) {
results.add(foundUsers.get(j)); results.add(foundUsers.get(j));
...@@ -306,7 +306,7 @@ public class CrowdUserProvider implements UserProvider { ...@@ -306,7 +306,7 @@ public class CrowdUserProvider implements UserProvider {
if (allUsers != null && allUsers.size() > 0) { if (allUsers != null && allUsers.size() > 0) {
Map<String, org.jivesoftware.openfire.crowd.jaxb.User> usersMap = new TreeMap<String, org.jivesoftware.openfire.crowd.jaxb.User>(); Map<String, org.jivesoftware.openfire.crowd.jaxb.User> usersMap = new TreeMap<>();
for (org.jivesoftware.openfire.crowd.jaxb.User user : allUsers) { for (org.jivesoftware.openfire.crowd.jaxb.User user : allUsers) {
usersMap.put(user.name, user); usersMap.put(user.name, user);
} }
......
...@@ -41,7 +41,7 @@ public class CrowdVCardProvider extends DefaultVCardProvider { ...@@ -41,7 +41,7 @@ public class CrowdVCardProvider extends DefaultVCardProvider {
private static final String VCARD_TEMPLATE private static final String VCARD_TEMPLATE
= "<vCard xmlns=\"vcard-temp\"><FN>@displayname@</FN><N><FAMILY>@lastname@</FAMILY><GIVEN>@firstname@</GIVEN></N><NICKNAME>@nickname@</NICKNAME><EMAIL><USERID>@email@</USERID></EMAIL></vCard>"; = "<vCard xmlns=\"vcard-temp\"><FN>@displayname@</FN><N><FAMILY>@lastname@</FAMILY><GIVEN>@firstname@</GIVEN></N><NICKNAME>@nickname@</NICKNAME><EMAIL><USERID>@email@</USERID></EMAIL></vCard>";
private static final ConcurrentHashMap<String, Object> MUTEX = new ConcurrentHashMap<String, Object>(); private static final ConcurrentHashMap<String, Object> MUTEX = new ConcurrentHashMap<>();
/** /**
* @see org.jivesoftware.openfire.vcard.DefaultVCardProvider#loadVCard(java.lang.String) * @see org.jivesoftware.openfire.vcard.DefaultVCardProvider#loadVCard(java.lang.String)
......
...@@ -69,16 +69,16 @@ import java.util.concurrent.locks.Lock; ...@@ -69,16 +69,16 @@ import java.util.concurrent.locks.Lock;
public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListener { public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListener {
public static final String NAMESPACE_DISCO_INFO = "http://jabber.org/protocol/disco#info"; public static final String NAMESPACE_DISCO_INFO = "http://jabber.org/protocol/disco#info";
private Map<String, DiscoInfoProvider> entities = new HashMap<String, DiscoInfoProvider>(); private Map<String, DiscoInfoProvider> entities = new HashMap<>();
private Set<String> localServerFeatures = new CopyOnWriteArraySet<String>(); private Set<String> localServerFeatures = new CopyOnWriteArraySet<>();
private Cache<String, Set<NodeID>> serverFeatures; private Cache<String, Set<NodeID>> serverFeatures;
private List<Element> serverIdentities = new ArrayList<Element>(); private List<Element> serverIdentities = new ArrayList<>();
private Map<String, DiscoInfoProvider> serverNodeProviders = new ConcurrentHashMap<String, DiscoInfoProvider>(); private Map<String, DiscoInfoProvider> serverNodeProviders = new ConcurrentHashMap<>();
private IQHandlerInfo info; private IQHandlerInfo info;
private List<Element> anonymousUserIdentities = new ArrayList<Element>(); private List<Element> anonymousUserIdentities = new ArrayList<>();
private List<Element> registeredUserIdentities = new ArrayList<Element>(); private List<Element> registeredUserIdentities = new ArrayList<>();
private List<String> userFeatures = new ArrayList<String>(); private List<String> userFeatures = new ArrayList<>();
public IQDiscoInfoHandler() { public IQDiscoInfoHandler() {
super("XMPP Disco Info Handler"); super("XMPP Disco Info Handler");
...@@ -275,7 +275,7 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene ...@@ -275,7 +275,7 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene
lock.lock(); lock.lock();
Set<NodeID> nodeIDs = serverFeatures.get(namespace); Set<NodeID> nodeIDs = serverFeatures.get(namespace);
if (nodeIDs == null) { if (nodeIDs == null) {
nodeIDs = new HashSet<NodeID>(); nodeIDs = new HashSet<>();
} }
nodeIDs.add(XMPPServer.getInstance().getNodeID()); nodeIDs.add(XMPPServer.getInstance().getNodeID());
serverFeatures.put(namespace, nodeIDs); serverFeatures.put(namespace, nodeIDs);
...@@ -400,7 +400,7 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene ...@@ -400,7 +400,7 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene
lock.lock(); lock.lock();
Set<NodeID> nodeIDs = serverFeatures.get(feature); Set<NodeID> nodeIDs = serverFeatures.get(feature);
if (nodeIDs == null) { if (nodeIDs == null) {
nodeIDs = new HashSet<NodeID>(); nodeIDs = new HashSet<>();
} }
nodeIDs.add(XMPPServer.getInstance().getNodeID()); nodeIDs.add(XMPPServer.getInstance().getNodeID());
serverFeatures.put(feature, nodeIDs); serverFeatures.put(feature, nodeIDs);
...@@ -420,7 +420,7 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene ...@@ -420,7 +420,7 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene
*/ */
private DiscoInfoProvider getServerInfoProvider() { private DiscoInfoProvider getServerInfoProvider() {
return new DiscoInfoProvider() { return new DiscoInfoProvider() {
final ArrayList<Element> identities = new ArrayList<Element>(); final ArrayList<Element> identities = new ArrayList<>();
@Override @Override
public Iterator<Element> getIdentities(String name, String node, JID senderJID) { public Iterator<Element> getIdentities(String name, String node, JID senderJID) {
...@@ -469,7 +469,7 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene ...@@ -469,7 +469,7 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene
} }
if (name == null) { if (name == null) {
// Answer features of the server // Answer features of the server
return new HashSet<String>(serverFeatures.keySet()).iterator(); return new HashSet<>(serverFeatures.keySet()).iterator();
} }
else { else {
// Answer features of the user // Answer features of the user
......
...@@ -80,10 +80,10 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv ...@@ -80,10 +80,10 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
UserItemsProvider { UserItemsProvider {
public static final String NAMESPACE_DISCO_ITEMS = "http://jabber.org/protocol/disco#items"; public static final String NAMESPACE_DISCO_ITEMS = "http://jabber.org/protocol/disco#items";
private Map<String,DiscoItemsProvider> entities = new HashMap<String,DiscoItemsProvider>(); private Map<String,DiscoItemsProvider> entities = new HashMap<>();
private Map<String, Element> localServerItems = new HashMap<String, Element>(); private Map<String, Element> localServerItems = new HashMap<>();
private Cache<String, ClusteredServerItem> serverItems; private Cache<String, ClusteredServerItem> serverItems;
private Map<String, DiscoItemsProvider> serverNodeProviders = new ConcurrentHashMap<String, DiscoItemsProvider>(); private Map<String, DiscoItemsProvider> serverNodeProviders = new ConcurrentHashMap<>();
private IQHandlerInfo info; private IQHandlerInfo info;
private IQDiscoInfoHandler infoHandler; private IQDiscoInfoHandler infoHandler;
...@@ -153,11 +153,11 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv ...@@ -153,11 +153,11 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
// Calculate which results to include. // Calculate which results to include.
final List<DiscoItem> rsmResults; final List<DiscoItem> rsmResults;
final List<DiscoItem> allItems = new ArrayList<DiscoItem>(); final List<DiscoItem> allItems = new ArrayList<>();
while (itemsItr.hasNext()) { while (itemsItr.hasNext()) {
allItems.add(itemsItr.next()); allItems.add(itemsItr.next());
} }
final ResultSet<DiscoItem> rs = new ResultSetImpl<DiscoItem>( final ResultSet<DiscoItem> rs = new ResultSetImpl<>(
allItems); allItems);
try { try {
rsmResults = rs.applyRSMDirectives(rsmElement); rsmResults = rs.applyRSMDirectives(rsmElement);
...@@ -501,7 +501,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv ...@@ -501,7 +501,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
return null; return null;
} }
if (name == null) { if (name == null) {
List<DiscoItem> answer = new ArrayList<DiscoItem>(); List<DiscoItem> answer = new ArrayList<>();
for (ClusteredServerItem item : serverItems.values()) { for (ClusteredServerItem item : serverItems.values()) {
answer.add(new DiscoItem(item.element)); answer.add(new DiscoItem(item.element));
} }
...@@ -515,7 +515,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv ...@@ -515,7 +515,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
// If we didn't find any UserItemsProviders, then answer a not found error // If we didn't find any UserItemsProviders, then answer a not found error
return null; return null;
} }
List<DiscoItem> answer = new ArrayList<DiscoItem>(); List<DiscoItem> answer = new ArrayList<>();
for (UserItemsProvider itemsProvider : itemsProviders) { for (UserItemsProvider itemsProvider : itemsProviders) {
// Check if we have items associated with the requested name // Check if we have items associated with the requested name
Iterator<Element> itemsItr = itemsProvider.getUserItems(name, senderJID); Iterator<Element> itemsItr = itemsProvider.getUserItems(name, senderJID);
...@@ -540,7 +540,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv ...@@ -540,7 +540,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
private static class ClusteredServerItem implements Externalizable { private static class ClusteredServerItem implements Externalizable {
private Element element; private Element element;
private Set<NodeID> nodes = new HashSet<NodeID>(); private Set<NodeID> nodes = new HashSet<>();
public ClusteredServerItem() { public ClusteredServerItem() {
} }
...@@ -560,7 +560,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv ...@@ -560,7 +560,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
@Override @Override
public Iterator<Element> getUserItems(String name, JID senderJID) { public Iterator<Element> getUserItems(String name, JID senderJID) {
List<Element> answer = new ArrayList<Element>(); List<Element> answer = new ArrayList<>();
try { try {
User user = UserManager.getInstance().getUser(name); User user = UserManager.getInstance().getUser(name);
RosterItem item = user.getRoster().getRosterItem(senderJID); RosterItem item = user.getRoster().getRosterItem(senderJID);
......
...@@ -45,12 +45,12 @@ public class EntityCapabilities implements Cacheable, Externalizable { ...@@ -45,12 +45,12 @@ public class EntityCapabilities implements Cacheable, Externalizable {
/** /**
* Identities included in these entity capabilities. * Identities included in these entity capabilities.
*/ */
private Set<String> identities = new HashSet<String>(); private Set<String> identities = new HashSet<>();
/** /**
* Features included in these entity capabilities. * Features included in these entity capabilities.
*/ */
private Set<String> features = new HashSet<String>(); private Set<String> features = new HashSet<>();
/** /**
* Hash string that corresponds to the entity capabilities. To be * Hash string that corresponds to the entity capabilities. To be
......
...@@ -111,7 +111,7 @@ public class EntityCapabilitiesManager implements IQResultListener, UserEventLis ...@@ -111,7 +111,7 @@ public class EntityCapabilitiesManager implements IQResultListener, UserEventLis
private EntityCapabilitiesManager() { private EntityCapabilitiesManager() {
entityCapabilitiesMap = CacheFactory.createLocalCache("Entity Capabilities"); entityCapabilitiesMap = CacheFactory.createLocalCache("Entity Capabilities");
entityCapabilitiesUserMap = CacheFactory.createLocalCache("Entity Capabilities Users"); entityCapabilitiesUserMap = CacheFactory.createLocalCache("Entity Capabilities Users");
verAttributes = new HashMap<String, EntityCapabilities>(); verAttributes = new HashMap<>();
} }
/** /**
...@@ -336,7 +336,7 @@ public class EntityCapabilitiesManager implements IQResultListener, UserEventLis ...@@ -336,7 +336,7 @@ public class EntityCapabilitiesManager implements IQResultListener, UserEventLis
* @return a list of identities * @return a list of identities
*/ */
private static List<String> getIdentitiesFrom(IQ packet) { private static List<String> getIdentitiesFrom(IQ packet) {
List<String> discoIdentities = new ArrayList<String>(); List<String> discoIdentities = new ArrayList<>();
Element query = packet.getChildElement(); Element query = packet.getChildElement();
Iterator<Element> identitiesIterator = query.elementIterator("identity"); Iterator<Element> identitiesIterator = query.elementIterator("identity");
if (identitiesIterator != null) { if (identitiesIterator != null) {
...@@ -382,7 +382,7 @@ public class EntityCapabilitiesManager implements IQResultListener, UserEventLis ...@@ -382,7 +382,7 @@ public class EntityCapabilitiesManager implements IQResultListener, UserEventLis
* @return a list of features * @return a list of features
*/ */
private static List<String> getFeaturesFrom(IQ packet) { private static List<String> getFeaturesFrom(IQ packet) {
List<String> discoFeatures = new ArrayList<String>(); List<String> discoFeatures = new ArrayList<>();
Element query = packet.getChildElement(); Element query = packet.getChildElement();
Iterator<Element> featuresIterator = query.elementIterator("feature"); Iterator<Element> featuresIterator = query.elementIterator("feature");
if (featuresIterator != null) { if (featuresIterator != null) {
...@@ -405,7 +405,7 @@ public class EntityCapabilitiesManager implements IQResultListener, UserEventLis ...@@ -405,7 +405,7 @@ public class EntityCapabilitiesManager implements IQResultListener, UserEventLis
* @return a list of extended service discoverin information features. * @return a list of extended service discoverin information features.
*/ */
private static List<String> getExtendedDataForms(IQ packet) { private static List<String> getExtendedDataForms(IQ packet) {
List<String> results = new ArrayList<String>(); List<String> results = new ArrayList<>();
Element query = packet.getChildElement(); Element query = packet.getChildElement();
Iterator<Element> extensionIterator = query.elementIterator(QName.get( Iterator<Element> extensionIterator = query.elementIterator(QName.get(
"x", "jabber:x:data")); "x", "jabber:x:data"));
...@@ -416,7 +416,7 @@ public class EntityCapabilitiesManager implements IQResultListener, UserEventLis ...@@ -416,7 +416,7 @@ public class EntityCapabilitiesManager implements IQResultListener, UserEventLis
Iterator<Element> fieldIterator = extensionElement Iterator<Element> fieldIterator = extensionElement
.elementIterator("field"); .elementIterator("field");
List<String> vars = new ArrayList<String>(); List<String> vars = new ArrayList<>();
while (fieldIterator != null && fieldIterator.hasNext()) { while (fieldIterator != null && fieldIterator.hasNext()) {
final Element fieldElement = fieldIterator.next(); final Element fieldElement = fieldIterator.next();
if (fieldElement.attributeValue("var").equals("FORM_TYPE")) { if (fieldElement.attributeValue("var").equals("FORM_TYPE")) {
...@@ -429,7 +429,7 @@ public class EntityCapabilitiesManager implements IQResultListener, UserEventLis ...@@ -429,7 +429,7 @@ public class EntityCapabilitiesManager implements IQResultListener, UserEventLis
var.append('<'); var.append('<');
Iterator<Element> valIter = fieldElement Iterator<Element> valIter = fieldElement
.elementIterator("value"); .elementIterator("value");
List<String> values = new ArrayList<String>(); List<String> values = new ArrayList<>();
while (valIter != null && valIter.hasNext()) { while (valIter != null && valIter.hasNext()) {
Element value = valIter.next(); Element value = valIter.next();
values.add(value.getText()); values.add(value.getText());
......
...@@ -83,7 +83,7 @@ public class GroupEventDispatcher { ...@@ -83,7 +83,7 @@ public class GroupEventDispatcher {
private static final Logger Log = LoggerFactory.getLogger(GroupEventDispatcher.class); private static final Logger Log = LoggerFactory.getLogger(GroupEventDispatcher.class);
private static List<GroupEventListener> listeners = private static List<GroupEventListener> listeners =
new CopyOnWriteArrayList<GroupEventListener>(); new CopyOnWriteArrayList<>();
private GroupEventDispatcher() { private GroupEventDispatcher() {
// Not instantiable. // Not instantiable.
......
...@@ -33,7 +33,7 @@ public class SessionEventDispatcher { ...@@ -33,7 +33,7 @@ public class SessionEventDispatcher {
private static final Logger Log = LoggerFactory.getLogger(SessionEventDispatcher.class); private static final Logger Log = LoggerFactory.getLogger(SessionEventDispatcher.class);
private static List<SessionEventListener> listeners = private static List<SessionEventListener> listeners =
new CopyOnWriteArrayList<SessionEventListener>(); new CopyOnWriteArrayList<>();
private SessionEventDispatcher() { private SessionEventDispatcher() {
// Not instantiable. // Not instantiable.
......
...@@ -92,7 +92,7 @@ public class UserEventDispatcher { ...@@ -92,7 +92,7 @@ public class UserEventDispatcher {
private static final Logger Log = LoggerFactory.getLogger(UserEventDispatcher.class); private static final Logger Log = LoggerFactory.getLogger(UserEventDispatcher.class);
private static List<UserEventListener> listeners = private static List<UserEventListener> listeners =
new CopyOnWriteArrayList<UserEventListener>(); new CopyOnWriteArrayList<>();
private UserEventDispatcher() { private UserEventDispatcher() {
// Not instantiable. // Not instantiable.
......
...@@ -44,8 +44,8 @@ public class XFormFieldImpl implements FormField { ...@@ -44,8 +44,8 @@ public class XFormFieldImpl implements FormField {
private String label; private String label;
private String variable; private String variable;
private String type; private String type;
private List<Option> options = new ArrayList<Option>(); private List<Option> options = new ArrayList<>();
private List<String> values = new ArrayList<String>(); private List<String> values = new ArrayList<>();
public XFormFieldImpl() { public XFormFieldImpl() {
super(); super();
...@@ -175,7 +175,7 @@ public class XFormFieldImpl implements FormField { ...@@ -175,7 +175,7 @@ public class XFormFieldImpl implements FormField {
@Override @Override
public Iterator<String> getValues() { public Iterator<String> getValues() {
synchronized (values) { synchronized (values) {
return Collections.unmodifiableList(new ArrayList<String>(values)).iterator(); return Collections.unmodifiableList(new ArrayList<>(values)).iterator();
} }
} }
...@@ -192,7 +192,7 @@ public class XFormFieldImpl implements FormField { ...@@ -192,7 +192,7 @@ public class XFormFieldImpl implements FormField {
*/ */
private Iterator<Option> getOptions() { private Iterator<Option> getOptions() {
synchronized (options) { synchronized (options) {
return Collections.unmodifiableList(new ArrayList<Option>(options)).iterator(); return Collections.unmodifiableList(new ArrayList<>(options)).iterator();
} }
} }
......
...@@ -156,7 +156,7 @@ public abstract class AbstractGroupProvider implements GroupProvider { ...@@ -156,7 +156,7 @@ public abstract class AbstractGroupProvider implements GroupProvider {
*/ */
@Override @Override
public Collection<String> getSharedGroupNames() { public Collection<String> getSharedGroupNames() {
Collection<String> groupNames = new HashSet<String>(); Collection<String> groupNames = new HashSet<>();
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -179,7 +179,7 @@ public abstract class AbstractGroupProvider implements GroupProvider { ...@@ -179,7 +179,7 @@ public abstract class AbstractGroupProvider implements GroupProvider {
@Override @Override
public Collection<String> getSharedGroupNames(JID user) { public Collection<String> getSharedGroupNames(JID user) {
Set<String> answer = new HashSet<String>(); Set<String> answer = new HashSet<>();
Collection<String> userGroups = getGroupNames(user); Collection<String> userGroups = getGroupNames(user);
answer.addAll(userGroups); answer.addAll(userGroups);
for (String userGroup : userGroups) { for (String userGroup : userGroups) {
...@@ -191,7 +191,7 @@ public abstract class AbstractGroupProvider implements GroupProvider { ...@@ -191,7 +191,7 @@ public abstract class AbstractGroupProvider implements GroupProvider {
@Override @Override
public Collection<String> getVisibleGroupNames(String userGroup) { public Collection<String> getVisibleGroupNames(String userGroup) {
Set<String> groupNames = new HashSet<String>(); Set<String> groupNames = new HashSet<>();
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -215,7 +215,7 @@ public abstract class AbstractGroupProvider implements GroupProvider { ...@@ -215,7 +215,7 @@ public abstract class AbstractGroupProvider implements GroupProvider {
@Override @Override
public Collection<String> search(String key, String value) { public Collection<String> search(String key, String value) {
Set<String> groupNames = new HashSet<String>(); Set<String> groupNames = new HashSet<>();
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -240,7 +240,7 @@ public abstract class AbstractGroupProvider implements GroupProvider { ...@@ -240,7 +240,7 @@ public abstract class AbstractGroupProvider implements GroupProvider {
@Override @Override
public Collection<String> getPublicSharedGroupNames() { public Collection<String> getPublicSharedGroupNames() {
Set<String> groupNames = new HashSet<String>(); Set<String> groupNames = new HashSet<>();
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -278,7 +278,7 @@ public abstract class AbstractGroupProvider implements GroupProvider { ...@@ -278,7 +278,7 @@ public abstract class AbstractGroupProvider implements GroupProvider {
// custom map implementation persists group property changes // custom map implementation persists group property changes
// whenever one of the standard mutator methods are called // whenever one of the standard mutator methods are called
String name = group.getName(); String name = group.getName();
PersistableMap<String,String> result = new DefaultGroupPropertyMap<String,String>(group); PersistableMap<String,String> result = new DefaultGroupPropertyMap<>(group);
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
......
...@@ -63,7 +63,7 @@ public class ConcurrentGroupList<T> extends CopyOnWriteArrayList<T> implements G ...@@ -63,7 +63,7 @@ public class ConcurrentGroupList<T> extends CopyOnWriteArrayList<T> implements G
*/ */
@Override @Override
public Set<Group> getGroups() { public Set<Group> getGroups() {
Set<Group> result = new HashSet<Group>(); Set<Group> result = new HashSet<>();
for (String groupName : getKnownGroupNamesInList()) { for (String groupName : getKnownGroupNamesInList()) {
result.add(Group.resolveFrom(groupName)); result.add(Group.resolveFrom(groupName));
} }
...@@ -82,7 +82,7 @@ public class ConcurrentGroupList<T> extends CopyOnWriteArrayList<T> implements G ...@@ -82,7 +82,7 @@ public class ConcurrentGroupList<T> extends CopyOnWriteArrayList<T> implements G
synchronized(this) { synchronized(this) {
result = knownGroupNamesInList; result = knownGroupNamesInList;
if (result == null) { if (result == null) {
result = new HashSet<String>(); result = new HashSet<>();
// add all the groups into the group set // add all the groups into the group set
Iterator<T> iterator = iterator(); Iterator<T> iterator = iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
......
...@@ -83,7 +83,7 @@ public class ConcurrentGroupMap<K, V> extends ConcurrentHashMap<K, V> implement ...@@ -83,7 +83,7 @@ public class ConcurrentGroupMap<K, V> extends ConcurrentHashMap<K, V> implement
*/ */
@Override @Override
public synchronized Set<Group> getGroupsFromKeys() { public synchronized Set<Group> getGroupsFromKeys() {
Set<Group> result = new HashSet<Group>(); Set<Group> result = new HashSet<>();
for(String groupName : getKnownGroupNamesFromKeys()) { for(String groupName : getKnownGroupNamesFromKeys()) {
result.add(Group.resolveFrom(groupName)); result.add(Group.resolveFrom(groupName));
} }
...@@ -97,7 +97,7 @@ public class ConcurrentGroupMap<K, V> extends ConcurrentHashMap<K, V> implement ...@@ -97,7 +97,7 @@ public class ConcurrentGroupMap<K, V> extends ConcurrentHashMap<K, V> implement
*/ */
@Override @Override
public synchronized Set<Group> getGroupsFromValues() { public synchronized Set<Group> getGroupsFromValues() {
Set<Group> result = new HashSet<Group>(); Set<Group> result = new HashSet<>();
for(String groupName : getKnownGroupNamesFromValues()) { for(String groupName : getKnownGroupNamesFromValues()) {
result.add(Group.resolveFrom(groupName)); result.add(Group.resolveFrom(groupName));
} }
...@@ -117,7 +117,7 @@ public class ConcurrentGroupMap<K, V> extends ConcurrentHashMap<K, V> implement ...@@ -117,7 +117,7 @@ public class ConcurrentGroupMap<K, V> extends ConcurrentHashMap<K, V> implement
synchronized(this) { synchronized(this) {
result = knownGroupNamesFromKeys; result = knownGroupNamesFromKeys;
if (result == null) { if (result == null) {
result = new HashSet<String>(); result = new HashSet<>();
// add all the groups into the group set // add all the groups into the group set
Iterator<K> iterator = keySet().iterator(); Iterator<K> iterator = keySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
...@@ -147,7 +147,7 @@ public class ConcurrentGroupMap<K, V> extends ConcurrentHashMap<K, V> implement ...@@ -147,7 +147,7 @@ public class ConcurrentGroupMap<K, V> extends ConcurrentHashMap<K, V> implement
synchronized(this) { synchronized(this) {
result = knownGroupNamesFromValues; result = knownGroupNamesFromValues;
if (result == null) { if (result == null) {
result = new HashSet<String>(); result = new HashSet<>();
// add all the groups into the group set // add all the groups into the group set
Iterator<V> iterator = values().iterator(); Iterator<V> iterator = values().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
......
...@@ -377,7 +377,7 @@ public class DefaultGroupPropertyMap<K,V> extends PersistableMap<K,V> { ...@@ -377,7 +377,7 @@ public class DefaultGroupPropertyMap<K,V> extends PersistableMap<K,V> {
*/ */
@Override @Override
public Entry<K,V> next() { public Entry<K,V> next() {
current = new EntryWrapper<E>(delegate.next()); current = new EntryWrapper<>(delegate.next());
return current; return current;
} }
...@@ -477,7 +477,7 @@ public class DefaultGroupPropertyMap<K,V> extends PersistableMap<K,V> { ...@@ -477,7 +477,7 @@ public class DefaultGroupPropertyMap<K,V> extends PersistableMap<K,V> {
finally { finally {
DbConnectionManager.closeConnection(pstmt, con); DbConnectionManager.closeConnection(pstmt, con);
} }
Map<String, Object> event = new HashMap<String, Object>(); Map<String, Object> event = new HashMap<>();
event.put("propertyKey", key); event.put("propertyKey", key);
event.put("type", "propertyAdded"); event.put("type", "propertyAdded");
GroupEventDispatcher.dispatchEvent(group, GroupEventDispatcher.dispatchEvent(group,
...@@ -508,7 +508,7 @@ public class DefaultGroupPropertyMap<K,V> extends PersistableMap<K,V> { ...@@ -508,7 +508,7 @@ public class DefaultGroupPropertyMap<K,V> extends PersistableMap<K,V> {
finally { finally {
DbConnectionManager.closeConnection(pstmt, con); DbConnectionManager.closeConnection(pstmt, con);
} }
Map<String, Object> event = new HashMap<String, Object>(); Map<String, Object> event = new HashMap<>();
event.put("propertyKey", key); event.put("propertyKey", key);
event.put("type", "propertyModified"); event.put("type", "propertyModified");
event.put("originalValue", originalValue); event.put("originalValue", originalValue);
...@@ -537,7 +537,7 @@ public class DefaultGroupPropertyMap<K,V> extends PersistableMap<K,V> { ...@@ -537,7 +537,7 @@ public class DefaultGroupPropertyMap<K,V> extends PersistableMap<K,V> {
finally { finally {
DbConnectionManager.closeConnection(pstmt, con); DbConnectionManager.closeConnection(pstmt, con);
} }
Map<String, Object> event = new HashMap<String, Object>(); Map<String, Object> event = new HashMap<>();
event.put("type", "propertyDeleted"); event.put("type", "propertyDeleted");
event.put("propertyKey", key); event.put("propertyKey", key);
GroupEventDispatcher.dispatchEvent(group, GroupEventDispatcher.dispatchEvent(group,
...@@ -562,7 +562,7 @@ public class DefaultGroupPropertyMap<K,V> extends PersistableMap<K,V> { ...@@ -562,7 +562,7 @@ public class DefaultGroupPropertyMap<K,V> extends PersistableMap<K,V> {
finally { finally {
DbConnectionManager.closeConnection(pstmt, con); DbConnectionManager.closeConnection(pstmt, con);
} }
Map<String, Object> event = new HashMap<String, Object>(); Map<String, Object> event = new HashMap<>();
event.put("type", "propertyDeleted"); event.put("type", "propertyDeleted");
event.put("propertyKey", "*"); event.put("propertyKey", "*");
GroupEventDispatcher.dispatchEvent(group, GroupEventDispatcher.dispatchEvent(group,
......
...@@ -245,7 +245,7 @@ public class DefaultGroupProvider extends AbstractGroupProvider { ...@@ -245,7 +245,7 @@ public class DefaultGroupProvider extends AbstractGroupProvider {
@Override @Override
public Collection<String> getGroupNames() { public Collection<String> getGroupNames() {
List<String> groupNames = new ArrayList<String>(); List<String> groupNames = new ArrayList<>();
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -267,7 +267,7 @@ public class DefaultGroupProvider extends AbstractGroupProvider { ...@@ -267,7 +267,7 @@ public class DefaultGroupProvider extends AbstractGroupProvider {
@Override @Override
public Collection<String> getGroupNames(int startIndex, int numResults) { public Collection<String> getGroupNames(int startIndex, int numResults) {
List<String> groupNames = new ArrayList<String>(); List<String> groupNames = new ArrayList<>();
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -293,7 +293,7 @@ public class DefaultGroupProvider extends AbstractGroupProvider { ...@@ -293,7 +293,7 @@ public class DefaultGroupProvider extends AbstractGroupProvider {
@Override @Override
public Collection<String> getGroupNames(JID user) { public Collection<String> getGroupNames(JID user) {
List<String> groupNames = new ArrayList<String>(); List<String> groupNames = new ArrayList<>();
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -398,7 +398,7 @@ public class DefaultGroupProvider extends AbstractGroupProvider { ...@@ -398,7 +398,7 @@ public class DefaultGroupProvider extends AbstractGroupProvider {
query = query.substring(0, query.length()-1); query = query.substring(0, query.length()-1);
} }
List<String> groupNames = new ArrayList<String>(); List<String> groupNames = new ArrayList<>();
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -446,7 +446,7 @@ public class DefaultGroupProvider extends AbstractGroupProvider { ...@@ -446,7 +446,7 @@ public class DefaultGroupProvider extends AbstractGroupProvider {
} }
private Collection<JID> getMembers(String groupName, boolean adminsOnly) { private Collection<JID> getMembers(String groupName, boolean adminsOnly) {
List<JID> members = new ArrayList<JID>(); List<JID> members = new ArrayList<>();
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
......
...@@ -92,8 +92,8 @@ public class Group implements Cacheable, Externalizable { ...@@ -92,8 +92,8 @@ public class Group implements Cacheable, Externalizable {
this.provider = groupManager.getProvider(); this.provider = groupManager.getProvider();
this.name = name; this.name = name;
this.description = description; this.description = description;
this.members = new HashSet<JID>(members); this.members = new HashSet<>(members);
this.administrators = new HashSet<JID>(administrators); this.administrators = new HashSet<>(administrators);
} }
/** /**
...@@ -114,8 +114,8 @@ public class Group implements Cacheable, Externalizable { ...@@ -114,8 +114,8 @@ public class Group implements Cacheable, Externalizable {
this.provider = groupManager.getProvider(); this.provider = groupManager.getProvider();
this.name = name; this.name = name;
this.description = description; this.description = description;
this.members = new HashSet<JID>(members); this.members = new HashSet<>(members);
this.administrators = new HashSet<JID>(administrators); this.administrators = new HashSet<>(administrators);
this.properties = provider.loadProperties(this); this.properties = provider.loadProperties(this);
...@@ -180,7 +180,7 @@ public class Group implements Cacheable, Externalizable { ...@@ -180,7 +180,7 @@ public class Group implements Cacheable, Externalizable {
this.jid = null; // rebuilt when needed this.jid = null; // rebuilt when needed
// Fire event. // Fire event.
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<>();
params.put("type", "nameModified"); params.put("type", "nameModified");
params.put("originalValue", originalName); params.put("originalValue", originalName);
params.put("originalJID", originalJID); params.put("originalJID", originalJID);
...@@ -221,7 +221,7 @@ public class Group implements Cacheable, Externalizable { ...@@ -221,7 +221,7 @@ public class Group implements Cacheable, Externalizable {
provider.setDescription(name, description); provider.setDescription(name, description);
this.description = description; this.description = description;
// Fire event. // Fire event.
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<>();
params.put("type", "descriptionModified"); params.put("type", "descriptionModified");
params.put("originalValue", originalDescription); params.put("originalValue", originalDescription);
GroupEventDispatcher.dispatchEvent(this, GroupEventDispatcher.dispatchEvent(this,
...@@ -260,7 +260,7 @@ public class Group implements Cacheable, Externalizable { ...@@ -260,7 +260,7 @@ public class Group implements Cacheable, Externalizable {
* @return a read-only Collection of the group administrators + members. * @return a read-only Collection of the group administrators + members.
*/ */
public Collection<JID> getAll() { public Collection<JID> getAll() {
Set<JID> everybody = new HashSet<JID>(administrators); Set<JID> everybody = new HashSet<>(administrators);
everybody.addAll(members); everybody.addAll(members);
return Collections.unmodifiableSet(everybody); return Collections.unmodifiableSet(everybody);
} }
...@@ -400,13 +400,13 @@ public class Group implements Cacheable, Externalizable { ...@@ -400,13 +400,13 @@ public class Group implements Cacheable, Externalizable {
provider.deleteMember(name, user); provider.deleteMember(name, user);
// Fire event. // Fire event.
if (adminCollection) { if (adminCollection) {
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<>();
params.put("admin", user.toString()); params.put("admin", user.toString());
GroupEventDispatcher.dispatchEvent(Group.this, GroupEventDispatcher.dispatchEvent(Group.this,
GroupEventDispatcher.EventType.admin_removed, params); GroupEventDispatcher.EventType.admin_removed, params);
} }
else { else {
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<>();
params.put("member", user.toString()); params.put("member", user.toString());
GroupEventDispatcher.dispatchEvent(Group.this, GroupEventDispatcher.dispatchEvent(Group.this,
GroupEventDispatcher.EventType.member_removed, params); GroupEventDispatcher.EventType.member_removed, params);
...@@ -445,7 +445,7 @@ public class Group implements Cacheable, Externalizable { ...@@ -445,7 +445,7 @@ public class Group implements Cacheable, Externalizable {
} }
// Fire event. // Fire event.
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<>();
if (adminCollection) { if (adminCollection) {
params.put("admin", user.toString()); params.put("admin", user.toString());
if (alreadyGroupUser) { if (alreadyGroupUser) {
...@@ -506,8 +506,8 @@ public class Group implements Cacheable, Externalizable { ...@@ -506,8 +506,8 @@ public class Group implements Cacheable, Externalizable {
if (ExternalizableUtil.getInstance().readBoolean(in)) { if (ExternalizableUtil.getInstance().readBoolean(in)) {
description = ExternalizableUtil.getInstance().readSafeUTF(in); description = ExternalizableUtil.getInstance().readSafeUTF(in);
} }
members= new HashSet<JID>(); members= new HashSet<>();
administrators = new HashSet<JID>(); administrators = new HashSet<>();
ExternalizableUtil.getInstance().readSerializableCollection(in, members, getClass().getClassLoader()); ExternalizableUtil.getInstance().readSerializableCollection(in, members, getClass().getClassLoader());
ExternalizableUtil.getInstance().readSerializableCollection(in, administrators, getClass().getClassLoader()); ExternalizableUtil.getInstance().readSerializableCollection(in, administrators, getClass().getClassLoader());
} }
......
...@@ -158,7 +158,7 @@ public class JDBCGroupProvider extends AbstractGroupProvider { ...@@ -158,7 +158,7 @@ public class JDBCGroupProvider extends AbstractGroupProvider {
} }
private Collection<JID> getMembers(String groupName, boolean adminsOnly) { private Collection<JID> getMembers(String groupName, boolean adminsOnly) {
List<JID> members = new ArrayList<JID>(); List<JID> members = new ArrayList<>();
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
...@@ -225,7 +225,7 @@ public class JDBCGroupProvider extends AbstractGroupProvider { ...@@ -225,7 +225,7 @@ public class JDBCGroupProvider extends AbstractGroupProvider {
@Override @Override
public Collection<String> getGroupNames() { public Collection<String> getGroupNames() {
List<String> groupNames = new ArrayList<String>(); List<String> groupNames = new ArrayList<>();
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -248,7 +248,7 @@ public class JDBCGroupProvider extends AbstractGroupProvider { ...@@ -248,7 +248,7 @@ public class JDBCGroupProvider extends AbstractGroupProvider {
@Override @Override
public Collection<String> getGroupNames(int start, int num) { public Collection<String> getGroupNames(int start, int num) {
List<String> groupNames = new ArrayList<String>(); List<String> groupNames = new ArrayList<>();
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -274,7 +274,7 @@ public class JDBCGroupProvider extends AbstractGroupProvider { ...@@ -274,7 +274,7 @@ public class JDBCGroupProvider extends AbstractGroupProvider {
@Override @Override
public Collection<String> getGroupNames(JID user) { public Collection<String> getGroupNames(JID user) {
List<String> groupNames = new ArrayList<String>(); List<String> groupNames = new ArrayList<>();
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
......
...@@ -60,7 +60,7 @@ public class DirectedPresence implements Externalizable { ...@@ -60,7 +60,7 @@ public class DirectedPresence implements Externalizable {
* List of JIDs with the TO value of the directed presences. * List of JIDs with the TO value of the directed presences.
* E.g.: paul@js.com or room1@conference.js.com * E.g.: paul@js.com or room1@conference.js.com
*/ */
private Set<String> receivers = new HashSet<String>(); private Set<String> receivers = new HashSet<>();
public DirectedPresence() { public DirectedPresence() {
} }
......
...@@ -323,7 +323,7 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo { ...@@ -323,7 +323,7 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo {
try { try {
userManager.getUser(username).setPassword(password); userManager.getUser(username).setPassword(password);
response = IQ.createResultIQ(packet); response = IQ.createResultIQ(packet);
List<String> params = new ArrayList<String>(); List<String> params = new ArrayList<>();
params.add(username); params.add(username);
params.add(session.toString()); params.add(session.toString());
Log.info(LocaleUtils.getLocalizedString("admin.password.update", params)); Log.info(LocaleUtils.getLocalizedString("admin.password.update", params));
......
...@@ -186,7 +186,7 @@ public class IQOfflineMessagesHandler extends IQHandler implements ServerFeature ...@@ -186,7 +186,7 @@ public class IQOfflineMessagesHandler extends IQHandler implements ServerFeature
public Iterator<DiscoItem> getItems(String name, String node, JID senderJID) { public Iterator<DiscoItem> getItems(String name, String node, JID senderJID) {
// Mark that offline messages shouldn't be sent when the user becomes available // Mark that offline messages shouldn't be sent when the user becomes available
stopOfflineFlooding(senderJID); stopOfflineFlooding(senderJID);
List<DiscoItem> answer = new ArrayList<DiscoItem>(); List<DiscoItem> answer = new ArrayList<>();
for (OfflineMessage offlineMessage : messageStore.getMessages(senderJID.getNode(), false)) { for (OfflineMessage offlineMessage : messageStore.getMessages(senderJID.getNode(), false)) {
answer.add(new DiscoItem(senderJID.asBareJID(), offlineMessage.getFrom().toString(), answer.add(new DiscoItem(senderJID.asBareJID(), offlineMessage.getFrom().toString(),
XMPPDateTimeFormat.format(offlineMessage.getCreationDate()), null)); XMPPDateTimeFormat.format(offlineMessage.getCreationDate()), null));
......
...@@ -245,7 +245,7 @@ public class IQRosterHandler extends IQHandler implements ServerFeaturesProvider ...@@ -245,7 +245,7 @@ public class IQRosterHandler extends IQHandler implements ServerFeaturesProvider
* @return An error if the specification is violated or null if everything is fine. * @return An error if the specification is violated or null if everything is fine.
*/ */
private static PacketError checkGroups(Iterable<String> groups) { private static PacketError checkGroups(Iterable<String> groups) {
Set<String> set = new HashSet<String>(); Set<String> set = new HashSet<>();
for (String group : groups) { for (String group : groups) {
if (!set.add(group)) { if (!set.add(group)) {
// Duplicate group found. // Duplicate group found.
......
...@@ -328,16 +328,16 @@ public class PresenceSubscribeHandler extends BasicModule implements ChannelHand ...@@ -328,16 +328,16 @@ public class PresenceSubscribeHandler extends BasicModule implements ChannelHand
* </ul> * </ul>
*/ */
private static Hashtable<RosterItem.SubType, Map<String, Map<Presence.Type, Change>>> stateTable = private static Hashtable<RosterItem.SubType, Map<String, Map<Presence.Type, Change>>> stateTable =
new Hashtable<RosterItem.SubType, Map<String, Map<Presence.Type, Change>>>(); new Hashtable<>();
static { static {
Hashtable<Presence.Type, Change> subrTable; Hashtable<Presence.Type, Change> subrTable;
Hashtable<Presence.Type, Change> subsTable; Hashtable<Presence.Type, Change> subsTable;
Hashtable<String,Map<Presence.Type, Change>> sr; Hashtable<String,Map<Presence.Type, Change>> sr;
sr = new Hashtable<String,Map<Presence.Type, Change>>(); sr = new Hashtable<>();
subrTable = new Hashtable<Presence.Type, Change>(); subrTable = new Hashtable<>();
subsTable = new Hashtable<Presence.Type, Change>(); subsTable = new Hashtable<>();
sr.put("recv", subrTable); sr.put("recv", subrTable);
sr.put("send", subsTable); sr.put("send", subsTable);
stateTable.put(RosterItem.SUB_NONE, sr); stateTable.put(RosterItem.SUB_NONE, sr);
...@@ -366,9 +366,9 @@ public class PresenceSubscribeHandler extends BasicModule implements ChannelHand ...@@ -366,9 +366,9 @@ public class PresenceSubscribeHandler extends BasicModule implements ChannelHand
// Valid response if item requested subscription and we're denying request // Valid response if item requested subscription and we're denying request
subsTable.put(Presence.Type.unsubscribed, new Change(RosterItem.RECV_NONE, null, null)); subsTable.put(Presence.Type.unsubscribed, new Change(RosterItem.RECV_NONE, null, null));
sr = new Hashtable<String,Map<Presence.Type, Change>>(); sr = new Hashtable<>();
subrTable = new Hashtable<Presence.Type, Change>(); subrTable = new Hashtable<>();
subsTable = new Hashtable<Presence.Type, Change>(); subsTable = new Hashtable<>();
sr.put("recv", subrTable); sr.put("recv", subrTable);
sr.put("send", subsTable); sr.put("send", subsTable);
stateTable.put(RosterItem.SUB_FROM, sr); stateTable.put(RosterItem.SUB_FROM, sr);
...@@ -401,9 +401,9 @@ public class PresenceSubscribeHandler extends BasicModule implements ChannelHand ...@@ -401,9 +401,9 @@ public class PresenceSubscribeHandler extends BasicModule implements ChannelHand
// Valid response if owner requested subscription and item is denying request // Valid response if owner requested subscription and item is denying request
subrTable.put(Presence.Type.unsubscribed, new Change(null, null, RosterItem.ASK_NONE)); subrTable.put(Presence.Type.unsubscribed, new Change(null, null, RosterItem.ASK_NONE));
sr = new Hashtable<String,Map<Presence.Type, Change>>(); sr = new Hashtable<>();
subrTable = new Hashtable<Presence.Type, Change>(); subrTable = new Hashtable<>();
subsTable = new Hashtable<Presence.Type, Change>(); subsTable = new Hashtable<>();
sr.put("recv", subrTable); sr.put("recv", subrTable);
sr.put("send", subsTable); sr.put("send", subsTable);
stateTable.put(RosterItem.SUB_TO, sr); stateTable.put(RosterItem.SUB_TO, sr);
...@@ -433,9 +433,9 @@ public class PresenceSubscribeHandler extends BasicModule implements ChannelHand ...@@ -433,9 +433,9 @@ public class PresenceSubscribeHandler extends BasicModule implements ChannelHand
// Setting subscription to none // Setting subscription to none
subrTable.put(Presence.Type.unsubscribed, new Change(null, RosterItem.SUB_NONE, RosterItem.ASK_NONE)); subrTable.put(Presence.Type.unsubscribed, new Change(null, RosterItem.SUB_NONE, RosterItem.ASK_NONE));
sr = new Hashtable<String,Map<Presence.Type, Change>>(); sr = new Hashtable<>();
subrTable = new Hashtable<Presence.Type, Change>(); subrTable = new Hashtable<>();
subsTable = new Hashtable<Presence.Type, Change>(); subsTable = new Hashtable<>();
sr.put("recv", subrTable); sr.put("recv", subrTable);
sr.put("send", subsTable); sr.put("send", subsTable);
stateTable.put(RosterItem.SUB_BOTH, sr); stateTable.put(RosterItem.SUB_BOTH, sr);
......
...@@ -130,7 +130,7 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler ...@@ -130,7 +130,7 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler
public PresenceUpdateHandler() { public PresenceUpdateHandler() {
super("Presence update handler"); super("Presence update handler");
localDirectedPresences = new ConcurrentHashMap<String, Collection<DirectedPresence>>(); localDirectedPresences = new ConcurrentHashMap<>();
} }
@Override @Override
...@@ -429,7 +429,7 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler ...@@ -429,7 +429,7 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler
// sends several directed presences to the same handler. The Map also // sends several directed presences to the same handler. The Map also
// ensures that if the user sends several presences to the same handler // ensures that if the user sends several presences to the same handler
// we will have only one entry in the Map // we will have only one entry in the Map
directedPresences = new ConcurrentLinkedQueue<DirectedPresence>(); directedPresences = new ConcurrentLinkedQueue<>();
} }
// Add the handler to the list of handler that processed the directed // Add the handler to the list of handler that processed the directed
// presence sent by the user. This handler will be used to send // presence sent by the user. This handler will be used to send
...@@ -518,7 +518,7 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler ...@@ -518,7 +518,7 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler
*/ */
public void removedExpiredPresences() { public void removedExpiredPresences() {
Map<String, Collection<DirectedPresence>> copy = Map<String, Collection<DirectedPresence>> copy =
new HashMap<String, Collection<DirectedPresence>>(localDirectedPresences); new HashMap<>(localDirectedPresences);
for (Map.Entry<String, Collection<DirectedPresence>> entry : copy.entrySet()) { for (Map.Entry<String, Collection<DirectedPresence>> entry : copy.entrySet()) {
for (DirectedPresence directedPresence : entry.getValue()) { for (DirectedPresence directedPresence : entry.getValue()) {
if (!routingTable.hasClientRoute(directedPresence.getHandler()) && if (!routingTable.hasClientRoute(directedPresence.getHandler()) &&
......
...@@ -125,7 +125,7 @@ public final class HttpBindManager { ...@@ -125,7 +125,7 @@ public final class HttpBindManager {
public static final int HTTP_BIND_REQUEST_HEADER_SIZE_DEFAULT = 32768; public static final int HTTP_BIND_REQUEST_HEADER_SIZE_DEFAULT = 32768;
public static Map<String, Boolean> HTTP_BIND_ALLOWED_ORIGINS = new HashMap<String, Boolean>(); public static Map<String, Boolean> HTTP_BIND_ALLOWED_ORIGINS = new HashMap<>();
private static HttpBindManager instance = new HttpBindManager(); private static HttpBindManager instance = new HttpBindManager();
......
...@@ -70,7 +70,7 @@ public class HttpBindServlet extends HttpServlet { ...@@ -70,7 +70,7 @@ public class HttpBindServlet extends HttpServlet {
} }
} }
private ThreadLocal<XMPPPacketReader> localReader = new ThreadLocal<XMPPPacketReader>(); private ThreadLocal<XMPPPacketReader> localReader = new ThreadLocal<>();
public HttpBindServlet() { public HttpBindServlet() {
} }
......
...@@ -104,7 +104,7 @@ public class HttpSession extends LocalClientSession { ...@@ -104,7 +104,7 @@ public class HttpSession extends LocalClientSession {
private boolean isSecure; private boolean isSecure;
private int maxPollingInterval; private int maxPollingInterval;
private long lastPoll = -1; private long lastPoll = -1;
private Set<SessionListener> listeners = new CopyOnWriteArraySet<SessionListener>(); private Set<SessionListener> listeners = new CopyOnWriteArraySet<>();
private volatile boolean isClosed; private volatile boolean isClosed;
private int inactivityTimeout; private int inactivityTimeout;
private int defaultInactivityTimeout; private int defaultInactivityTimeout;
...@@ -118,7 +118,7 @@ public class HttpSession extends LocalClientSession { ...@@ -118,7 +118,7 @@ public class HttpSession extends LocalClientSession {
private int minorVersion = -1; private int minorVersion = -1;
private X509Certificate[] sslCertificates; private X509Certificate[] sslCertificates;
private final Queue<Collection<Element>> packetsToSend = new LinkedList<Collection<Element>>(); private final Queue<Collection<Element>> packetsToSend = new LinkedList<>();
// Semaphore which protects the packets to send, so, there can only be one consumer at a time. // Semaphore which protects the packets to send, so, there can only be one consumer at a time.
private SessionPacketRouter router; private SessionPacketRouter router;
...@@ -146,7 +146,7 @@ public class HttpSession extends LocalClientSession { ...@@ -146,7 +146,7 @@ public class HttpSession extends LocalClientSession {
* @return the stream features which are available for this session. * @return the stream features which are available for this session.
*/ */
public Collection<Element> getAvailableStreamFeaturesElements() { public Collection<Element> getAvailableStreamFeaturesElements() {
List<Element> elements = new ArrayList<Element>(); List<Element> elements = new ArrayList<>();
if (getAuthToken() == null) { if (getAuthToken() == null) {
Element sasl = SASLAuthentication.getSASLMechanismsElement(this); Element sasl = SASLAuthentication.getSASLMechanismsElement(this);
...@@ -1175,7 +1175,7 @@ public class HttpSession extends LocalClientSession { ...@@ -1175,7 +1175,7 @@ public class HttpSession extends LocalClientSession {
public Deliverable(Collection<Packet> elements) { public Deliverable(Collection<Packet> elements) {
this.text = null; this.text = null;
this.packets = new ArrayList<String>(); this.packets = new ArrayList<>();
for (Packet packet : elements) { for (Packet packet : elements) {
// Append packet namespace according XEP-0206 if needed // Append packet namespace according XEP-0206 if needed
if (Namespace.NO_NAMESPACE.equals(packet.getElement().getNamespace())) { if (Namespace.NO_NAMESPACE.equals(packet.getElement().getNamespace())) {
...@@ -1208,7 +1208,7 @@ public class HttpSession extends LocalClientSession { ...@@ -1208,7 +1208,7 @@ public class HttpSession extends LocalClientSession {
// No packets here (should be just raw XML like <stream> so return nothing // No packets here (should be just raw XML like <stream> so return nothing
return null; return null;
} }
List<Packet> answer = new ArrayList<Packet>(); List<Packet> answer = new ArrayList<>();
for (String packetXML : packets) { for (String packetXML : packets) {
try { try {
Packet packet = null; Packet packet = null;
...@@ -1252,7 +1252,7 @@ public class HttpSession extends LocalClientSession { ...@@ -1252,7 +1252,7 @@ public class HttpSession extends LocalClientSession {
} }
public Collection<Packet> getPackets() { public Collection<Packet> getPackets() {
List<Packet> packets = new ArrayList<Packet>(); List<Packet> packets = new ArrayList<>();
synchronized (deliverables) { synchronized (deliverables) {
for (Deliverable deliverable : deliverables) { for (Deliverable deliverable : deliverables) {
if (deliverable.packets != null) { if (deliverable.packets != null) {
......
...@@ -51,7 +51,7 @@ public class HttpSessionManager { ...@@ -51,7 +51,7 @@ public class HttpSessionManager {
private static final Logger Log = LoggerFactory.getLogger(HttpSessionManager.class); private static final Logger Log = LoggerFactory.getLogger(HttpSessionManager.class);
private SessionManager sessionManager; private SessionManager sessionManager;
private Map<String, HttpSession> sessionMap = new ConcurrentHashMap<String, HttpSession>( private Map<String, HttpSession> sessionMap = new ConcurrentHashMap<>(
JiveGlobals.getIntProperty("xmpp.httpbind.session.initial.count", 16)); JiveGlobals.getIntProperty("xmpp.httpbind.session.initial.count", 16));
private TimerTask inactivityTask; private TimerTask inactivityTask;
private ThreadPoolExecutor sendPacketPool; private ThreadPoolExecutor sendPacketPool;
......
...@@ -56,9 +56,9 @@ public class InterceptorManager { ...@@ -56,9 +56,9 @@ public class InterceptorManager {
private XMPPServer server = XMPPServer.getInstance(); private XMPPServer server = XMPPServer.getInstance();
private List<PacketInterceptor> globalInterceptors = private List<PacketInterceptor> globalInterceptors =
new CopyOnWriteArrayList<PacketInterceptor>(); new CopyOnWriteArrayList<>();
private Map<String, List<PacketInterceptor>> usersInterceptors = private Map<String, List<PacketInterceptor>> usersInterceptors =
new ConcurrentHashMap<String, List<PacketInterceptor>>(); new ConcurrentHashMap<>();
/** /**
* Returns a singleton instance of InterceptorManager. * Returns a singleton instance of InterceptorManager.
...@@ -162,7 +162,7 @@ public class InterceptorManager { ...@@ -162,7 +162,7 @@ public class InterceptorManager {
public void addUserInterceptor(String username, int index, PacketInterceptor interceptor) { public void addUserInterceptor(String username, int index, PacketInterceptor interceptor) {
List<PacketInterceptor> userInterceptors = usersInterceptors.get(username); List<PacketInterceptor> userInterceptors = usersInterceptors.get(username);
if (userInterceptors == null) { if (userInterceptors == null) {
userInterceptors = new CopyOnWriteArrayList<PacketInterceptor>(); userInterceptors = new CopyOnWriteArrayList<>();
usersInterceptors.put(username, userInterceptors); usersInterceptors.put(username, userInterceptors);
} }
else { else {
......
...@@ -62,7 +62,7 @@ public class PacketCopier implements PacketInterceptor, ComponentEventListener { ...@@ -62,7 +62,7 @@ public class PacketCopier implements PacketInterceptor, ComponentEventListener {
private final static PacketCopier instance = new PacketCopier(); private final static PacketCopier instance = new PacketCopier();
private Map<String, Subscription> subscribers = new ConcurrentHashMap<String, Subscription>(); private Map<String, Subscription> subscribers = new ConcurrentHashMap<>();
private String serverName; private String serverName;
private RoutingTable routingTable; private RoutingTable routingTable;
...@@ -74,7 +74,7 @@ public class PacketCopier implements PacketInterceptor, ComponentEventListener { ...@@ -74,7 +74,7 @@ public class PacketCopier implements PacketInterceptor, ComponentEventListener {
/** /**
* Queue that holds the audited packets that will be later saved to an XML file. * Queue that holds the audited packets that will be later saved to an XML file.
*/ */
private BlockingQueue<InterceptedPacket> packetQueue = new LinkedBlockingQueue<InterceptedPacket>(10000); private BlockingQueue<InterceptedPacket> packetQueue = new LinkedBlockingQueue<>(10000);
/** /**
* Returns unique instance of this class. * Returns unique instance of this class.
...@@ -169,7 +169,7 @@ public class PacketCopier implements PacketInterceptor, ComponentEventListener { ...@@ -169,7 +169,7 @@ public class PacketCopier implements PacketInterceptor, ComponentEventListener {
} }
private void processPackets() { private void processPackets() {
List<InterceptedPacket> packets = new ArrayList<InterceptedPacket>(packetQueue.size()); List<InterceptedPacket> packets = new ArrayList<>(packetQueue.size());
packetQueue.drainTo(packets); packetQueue.drainTo(packets);
for (InterceptedPacket interceptedPacket : packets) { for (InterceptedPacket interceptedPacket : packets) {
for (Map.Entry<String, Subscription> entry : subscribers.entrySet()) { for (Map.Entry<String, Subscription> entry : subscribers.entrySet()) {
......
...@@ -84,7 +84,7 @@ public class LdapAuthorizationPolicy implements AuthorizationPolicy { ...@@ -84,7 +84,7 @@ public class LdapAuthorizationPolicy implements AuthorizationPolicy {
// Un-escape Node // Un-escape Node
username = JID.unescapeNode(username); username = JID.unescapeNode(username);
Collection<String> authorized = new ArrayList<String>(); Collection<String> authorized = new ArrayList<>();
DirContext ctx = null; DirContext ctx = null;
try { try {
String userDN = manager.findUserDN(username); String userDN = manager.findUserDN(username);
......
...@@ -250,7 +250,7 @@ public class LdapGroupProvider extends AbstractGroupProvider { ...@@ -250,7 +250,7 @@ public class LdapGroupProvider extends AbstractGroupProvider {
catch (Exception e) { catch (Exception e) {
description = ""; description = "";
} }
Set<JID> members = new TreeSet<JID>(); Set<JID> members = new TreeSet<>();
Attribute memberField = a.get(manager.getGroupMemberField()); Attribute memberField = a.get(manager.getGroupMemberField());
if (memberField != null) { if (memberField != null) {
NamingEnumeration ne = memberField.getAll(); NamingEnumeration ne = memberField.getAll();
......
...@@ -172,7 +172,7 @@ public class LdapManager { ...@@ -172,7 +172,7 @@ public class LdapManager {
} }
private Collection<String> hosts = new ArrayList<String>(); private Collection<String> hosts = new ArrayList<>();
private int port; private int port;
private int connTimeout = -1; private int connTimeout = -1;
private int readTimeout = -1; private int readTimeout = -1;
...@@ -500,7 +500,7 @@ public class LdapManager { ...@@ -500,7 +500,7 @@ public class LdapManager {
} }
// Set up the environment for creating the initial context // Set up the environment for creating the initial context
Hashtable<String, Object> env = new Hashtable<String, Object>(); Hashtable<String, Object> env = new Hashtable<>();
env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory); env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
env.put(Context.PROVIDER_URL, getProviderURL(baseDN)); env.put(Context.PROVIDER_URL, getProviderURL(baseDN));
...@@ -636,7 +636,7 @@ public class LdapManager { ...@@ -636,7 +636,7 @@ public class LdapManager {
JiveInitialLdapContext ctx = null; JiveInitialLdapContext ctx = null;
try { try {
// See if the user authenticates. // See if the user authenticates.
Hashtable<String, Object> env = new Hashtable<String, Object>(); Hashtable<String, Object> env = new Hashtable<>();
env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory); env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
env.put(Context.PROVIDER_URL, getProviderURL(baseDN)); env.put(Context.PROVIDER_URL, getProviderURL(baseDN));
if (sslEnabled) { if (sslEnabled) {
...@@ -739,7 +739,7 @@ public class LdapManager { ...@@ -739,7 +739,7 @@ public class LdapManager {
} }
try { try {
// See if the user authenticates. // See if the user authenticates.
Hashtable<String, Object> env = new Hashtable<String, Object>(); Hashtable<String, Object> env = new Hashtable<>();
// Use a custom initial context factory if specified. Otherwise, use the default. // Use a custom initial context factory if specified. Otherwise, use the default.
env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory); env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
env.put(Context.PROVIDER_URL, getProviderURL(alternateBaseDN)); env.put(Context.PROVIDER_URL, getProviderURL(alternateBaseDN));
...@@ -1871,7 +1871,7 @@ public class LdapManager { ...@@ -1871,7 +1871,7 @@ public class LdapManager {
* @return A simple list of strings (that should be sorted) of the results. * @return A simple list of strings (that should be sorted) of the results.
*/ */
public List<String> retrieveList(String attribute, String searchFilter, int startIndex, int numResults, String suffixToTrim, boolean escapeJIDs) { public List<String> retrieveList(String attribute, String searchFilter, int startIndex, int numResults, String suffixToTrim, boolean escapeJIDs) {
List<String> results = new ArrayList<String>(); List<String> results = new ArrayList<>();
int pageSize = -1; int pageSize = -1;
String pageSizeStr = properties.get("ldap.pagedResultsSize"); String pageSizeStr = properties.get("ldap.pagedResultsSize");
if (pageSizeStr != null) if (pageSizeStr != null)
...@@ -1894,7 +1894,7 @@ public class LdapManager { ...@@ -1894,7 +1894,7 @@ public class LdapManager {
ctx = getContext(baseDN); ctx = getContext(baseDN);
// Set up request controls, if appropriate. // Set up request controls, if appropriate.
List<Control> baseTmpRequestControls = new ArrayList<Control>(); List<Control> baseTmpRequestControls = new ArrayList<>();
if (!clientSideSort) { if (!clientSideSort) {
// Server side sort on username field. // Server side sort on username field.
baseTmpRequestControls.add(new SortControl(new String[]{attribute}, Control.NONCRITICAL)); baseTmpRequestControls.add(new SortControl(new String[]{attribute}, Control.NONCRITICAL));
...@@ -1968,7 +1968,7 @@ public class LdapManager { ...@@ -1968,7 +1968,7 @@ public class LdapManager {
// Close the enumeration. // Close the enumeration.
answer.close(); answer.close();
// Re-activate paged results; affects nothing if no paging support // Re-activate paged results; affects nothing if no paging support
List<Control> tmpRequestControls = new ArrayList<Control>(); List<Control> tmpRequestControls = new ArrayList<>();
if (!clientSideSort) { if (!clientSideSort) {
// Server side sort on username field. // Server side sort on username field.
tmpRequestControls.add(new SortControl(new String[]{attribute}, Control.NONCRITICAL)); tmpRequestControls.add(new SortControl(new String[]{attribute}, Control.NONCRITICAL));
...@@ -2025,7 +2025,7 @@ public class LdapManager { ...@@ -2025,7 +2025,7 @@ public class LdapManager {
// Close the enumeration. // Close the enumeration.
answer.close(); answer.close();
// Re-activate paged results; affects nothing if no paging support // Re-activate paged results; affects nothing if no paging support
List<Control> tmpRequestControls = new ArrayList<Control>(); List<Control> tmpRequestControls = new ArrayList<>();
if (!clientSideSort) { if (!clientSideSort) {
// Server side sort on username field. // Server side sort on username field.
tmpRequestControls.add(new SortControl(new String[]{attribute}, Control.NONCRITICAL)); tmpRequestControls.add(new SortControl(new String[]{attribute}, Control.NONCRITICAL));
...@@ -2106,7 +2106,7 @@ public class LdapManager { ...@@ -2106,7 +2106,7 @@ public class LdapManager {
ctx = getContext(baseDN); ctx = getContext(baseDN);
// Set up request controls, if appropriate. // Set up request controls, if appropriate.
List<Control> baseTmpRequestControls = new ArrayList<Control>(); List<Control> baseTmpRequestControls = new ArrayList<>();
if (pageSize > 0) { if (pageSize > 0) {
// Server side paging. // Server side paging.
baseTmpRequestControls.add(new PagedResultsControl(pageSize, Control.NONCRITICAL)); baseTmpRequestControls.add(new PagedResultsControl(pageSize, Control.NONCRITICAL));
...@@ -2147,7 +2147,7 @@ public class LdapManager { ...@@ -2147,7 +2147,7 @@ public class LdapManager {
// Close the enumeration. // Close the enumeration.
answer.close(); answer.close();
// Re-activate paged results; affects nothing if no paging support // Re-activate paged results; affects nothing if no paging support
List<Control> tmpRequestControls = new ArrayList<Control>(); List<Control> tmpRequestControls = new ArrayList<>();
if (pageSize > 0) { if (pageSize > 0) {
// Server side paging. // Server side paging.
tmpRequestControls.add(new PagedResultsControl(pageSize, cookie, Control.CRITICAL)); tmpRequestControls.add(new PagedResultsControl(pageSize, cookie, Control.CRITICAL));
...@@ -2184,7 +2184,7 @@ public class LdapManager { ...@@ -2184,7 +2184,7 @@ public class LdapManager {
// Close the enumeration. // Close the enumeration.
answer.close(); answer.close();
// Re-activate paged results; affects nothing if no paging support // Re-activate paged results; affects nothing if no paging support
List<Control> tmpRequestControls = new ArrayList<Control>(); List<Control> tmpRequestControls = new ArrayList<>();
if (pageSize > 0) { if (pageSize > 0) {
// Server side paging. // Server side paging.
tmpRequestControls.add(new PagedResultsControl(pageSize, cookie, Control.CRITICAL)); tmpRequestControls.add(new PagedResultsControl(pageSize, cookie, Control.CRITICAL));
......
...@@ -72,7 +72,7 @@ public class LdapUserProvider implements UserProvider { ...@@ -72,7 +72,7 @@ public class LdapUserProvider implements UserProvider {
JiveGlobals.migrateProperty("ldap.searchFields"); JiveGlobals.migrateProperty("ldap.searchFields");
manager = LdapManager.getInstance(); manager = LdapManager.getInstance();
searchFields = new LinkedHashMap<String,String>(); searchFields = new LinkedHashMap<>();
String fieldList = JiveGlobals.getProperty("ldap.searchFields"); String fieldList = JiveGlobals.getProperty("ldap.searchFields");
// If the value isn't present, default to to username, name, and email. // If the value isn't present, default to to username, name, and email.
if (fieldList == null) { if (fieldList == null) {
...@@ -266,7 +266,7 @@ public class LdapUserProvider implements UserProvider { ...@@ -266,7 +266,7 @@ public class LdapUserProvider implements UserProvider {
} }
public void setSearchFields(String fieldList) { public void setSearchFields(String fieldList) {
this.searchFields = new LinkedHashMap<String,String>(); this.searchFields = new LinkedHashMap<>();
// If the value isn't present, default to to username, name, and email. // If the value isn't present, default to to username, name, and email.
if (fieldList == null) { if (fieldList == null) {
searchFields.put("Username", manager.getUsernameField()); searchFields.put("Username", manager.getUsernameField());
......
...@@ -172,7 +172,7 @@ public class LdapVCardProvider implements VCardProvider, PropertyEventListener { ...@@ -172,7 +172,7 @@ public class LdapVCardProvider implements VCardProvider, PropertyEventListener {
private Map<String, String> getLdapAttributes(String username) { private Map<String, String> getLdapAttributes(String username) {
// Un-escape username // Un-escape username
username = JID.unescapeNode(username); username = JID.unescapeNode(username);
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<>();
DirContext ctx = null; DirContext ctx = null;
try { try {
...@@ -483,7 +483,7 @@ public class LdapVCardProvider implements VCardProvider, PropertyEventListener { ...@@ -483,7 +483,7 @@ public class LdapVCardProvider implements VCardProvider, PropertyEventListener {
private String[] attributes; private String[] attributes;
public VCardTemplate(Document document) { public VCardTemplate(Document document) {
Set<String> set = new HashSet<String>(); Set<String> set = new HashSet<>();
this.document = document; this.document = document;
treeWalk(this.document.getRootElement(), set); treeWalk(this.document.getRootElement(), set);
attributes = set.toArray(new String[set.size()]); attributes = set.toArray(new String[set.size()]);
......
...@@ -38,7 +38,7 @@ import java.util.concurrent.CopyOnWriteArrayList; ...@@ -38,7 +38,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
public class LockOutEventDispatcher { public class LockOutEventDispatcher {
private static List<LockOutEventListener> listeners = private static List<LockOutEventListener> listeners =
new CopyOnWriteArrayList<LockOutEventListener>(); new CopyOnWriteArrayList<>();
/** /**
* Registers a listener to receive events. * Registers a listener to receive events.
......
...@@ -45,7 +45,7 @@ abstract class Channel implements Runnable { ...@@ -45,7 +45,7 @@ abstract class Channel implements Runnable {
protected DatagramPacket packet; protected DatagramPacket packet;
protected boolean enabled = true; protected boolean enabled = true;
List<DatagramListener> listeners = new ArrayList<DatagramListener>(); List<DatagramListener> listeners = new ArrayList<>();
protected InetAddress host; protected InetAddress host;
protected int port; protected int port;
......
...@@ -28,7 +28,7 @@ public class Echo implements Runnable { ...@@ -28,7 +28,7 @@ public class Echo implements Runnable {
DatagramSocket socket = null; DatagramSocket socket = null;
byte password[] = null; byte password[] = null;
List<DatagramListener> listeners = new ArrayList<DatagramListener>(); List<DatagramListener> listeners = new ArrayList<>();
boolean enabled = true; boolean enabled = true;
public Echo(int port) throws UnknownHostException, SocketException { public Echo(int port) throws UnknownHostException, SocketException {
......
...@@ -43,7 +43,7 @@ public class MediaProxy implements SessionListener { ...@@ -43,7 +43,7 @@ public class MediaProxy implements SessionListener {
private static final Logger Log = LoggerFactory.getLogger(MediaProxy.class); private static final Logger Log = LoggerFactory.getLogger(MediaProxy.class);
final private Map<String, MediaProxySession> sessions = new ConcurrentHashMap<String, MediaProxySession>(); final private Map<String, MediaProxySession> sessions = new ConcurrentHashMap<>();
private String ipAddress; private String ipAddress;
......
This diff is collapsed.
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