diff --git a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java index 4b8cba52f..c3f4f54fe 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java @@ -341,7 +341,7 @@ public abstract class ConnectionConfiguration { * An enumeration for TLS security modes that are available when making a connection * to the XMPP server. */ - public static enum SecurityMode { + public enum SecurityMode { /** * Security via TLS encryption is required in order to connect. If the server @@ -492,7 +492,7 @@ public abstract class ConnectionConfiguration { *

* This is an abstract class that uses the builder design pattern and the "getThis() trick" to recover the type of * the builder in a class hierarchies with a self-referential generic supertype. Otherwise chaining of build - * instructions from the superclasses followed by build instructions of a sublcass would not be possible, because + * instructions from the superclasses followed by build instructions of a subclass would not be possible, because * the superclass build instructions would return the builder of the superclass and not the one of the subclass. You * can read more about it a Angelika Langer's Generics FAQ, especially the entry What is the @@ -646,7 +646,7 @@ public abstract class ConnectionConfiguration { public B setPort(int port) { if (port < 0 || port > 65535) { throw new IllegalArgumentException( - "Port must be a 16-bit unsiged integer (i.e. between 0-65535. Port was: " + port); + "Port must be a 16-bit unsigned integer (i.e. between 0-65535. Port was: " + port); } this.port = port; return getThis(); @@ -930,7 +930,7 @@ public abstract class ConnectionConfiguration { Set blacklistedMechanisms = SASLAuthentication.getBlacklistedSASLMechanisms(); for (String mechanism : saslMechanisms) { if (!SASLAuthentication.isSaslMechanismRegistered(mechanism)) { - throw new IllegalArgumentException("SASL " + mechanism + " is not avaiable. Consider registering it with Smack"); + throw new IllegalArgumentException("SASL " + mechanism + " is not available. Consider registering it with Smack"); } if (blacklistedMechanisms.contains(mechanism)) { throw new IllegalArgumentException("SALS " + mechanism + " is blacklisted."); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionCreationListener.java b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionCreationListener.java index 5b724078f..f798b803a 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionCreationListener.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionCreationListener.java @@ -33,6 +33,6 @@ public interface ConnectionCreationListener { * * @param connection the newly created connection. */ - public void connectionCreated(XMPPConnection connection); + void connectionCreated(XMPPConnection connection); } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionListener.java b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionListener.java index 5a677df31..c096e48b2 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionListener.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionListener.java @@ -37,7 +37,7 @@ public interface ConnectionListener { * * @param connection the XMPPConnection which successfully connected to its endpoint. */ - public void connected(XMPPConnection connection); + void connected(XMPPConnection connection); /** * Notification that the connection has been authenticated. @@ -45,12 +45,12 @@ public interface ConnectionListener { * @param connection the XMPPConnection which successfully authenticated. * @param resumed true if a previous XMPP session's stream was resumed. */ - public void authenticated(XMPPConnection connection, boolean resumed); + void authenticated(XMPPConnection connection, boolean resumed); /** * Notification that the connection was closed normally. */ - public void connectionClosed(); + void connectionClosed(); /** * Notification that the connection was closed due to an exception. When @@ -59,7 +59,7 @@ public interface ConnectionListener { * * @param e the exception. */ - public void connectionClosedOnError(Exception e); + void connectionClosedOnError(Exception e); /** * The connection has reconnected successfully to the server. Connections will @@ -68,7 +68,7 @@ public interface ConnectionListener { */ // TODO: Remove in Smack 4.3 @Deprecated - public void reconnectionSuccessful(); + void reconnectionSuccessful(); // The next two methods *must* only be invoked by ReconnectionManager @@ -83,7 +83,7 @@ public interface ConnectionListener { */ // TODO: Remove in Smack 4.3 @Deprecated - public void reconnectingIn(int seconds); + void reconnectingIn(int seconds); /** * An attempt to connect to the server has failed. The connection will keep trying reconnecting to the server in a @@ -97,5 +97,5 @@ public interface ConnectionListener { */ // TODO: Remove in Smack 4.3 @Deprecated - public void reconnectionFailed(Exception e); + void reconnectionFailed(Exception e); } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/ExceptionCallback.java b/smack-core/src/main/java/org/jivesoftware/smack/ExceptionCallback.java index cc1b98bdb..0a700e30e 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/ExceptionCallback.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/ExceptionCallback.java @@ -18,6 +18,6 @@ package org.jivesoftware.smack; public interface ExceptionCallback { - public void processException(Exception exception); + void processException(Exception exception); } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/Manager.java b/smack-core/src/main/java/org/jivesoftware/smack/Manager.java index 47f5e0ade..0b7924eb3 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/Manager.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/Manager.java @@ -28,7 +28,7 @@ public abstract class Manager { public Manager(XMPPConnection connection) { Objects.requireNonNull(connection, "XMPPConnection must not be null"); - weakConnection = new WeakReference(connection); + weakConnection = new WeakReference<>(connection); } protected final XMPPConnection connection() { diff --git a/smack-core/src/main/java/org/jivesoftware/smack/ReconnectionListener.java b/smack-core/src/main/java/org/jivesoftware/smack/ReconnectionListener.java index c404008ca..87eee0435 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/ReconnectionListener.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/ReconnectionListener.java @@ -34,7 +34,7 @@ public interface ReconnectionListener { * * @param seconds remaining seconds before attempting a reconnection. */ - public void reconnectingIn(int seconds); + void reconnectingIn(int seconds); /** * An attempt to connect to the server has failed. The connection will keep trying reconnecting to the server in a @@ -46,5 +46,5 @@ public interface ReconnectionListener { * * @param e the exception that caused the reconnection to fail. */ - public void reconnectionFailed(Exception e); + void reconnectionFailed(Exception e); } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java b/smack-core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java index 18cbcc1dc..0f7d65dec 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java @@ -189,7 +189,7 @@ public final class ReconnectionManager { private Thread reconnectionThread; private ReconnectionManager(AbstractXMPPConnection connection) { - weakRefConnection = new WeakReference(connection); + weakRefConnection = new WeakReference<>(connection); reconnectionRunnable = new Runnable() { diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java b/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java index 8c4cfe88f..8e8418b23 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java @@ -64,9 +64,9 @@ public final class SASLAuthentication { private static final Logger LOGGER = Logger.getLogger(SASLAuthentication.class.getName()); - private static final List REGISTERED_MECHANISMS = new ArrayList(); + private static final List REGISTERED_MECHANISMS = new ArrayList<>(); - private static final Set BLACKLISTED_MECHANISMS = new HashSet(); + private static final Set BLACKLISTED_MECHANISMS = new HashSet<>(); static { // Blacklist SCRAM-SHA-1-PLUS for now. @@ -91,7 +91,7 @@ public final class SASLAuthentication { * @return the registered SASLMechanism sorted by the level of preference. */ public static Map getRegisterdSASLMechanisms() { - Map answer = new LinkedHashMap(); + Map answer = new LinkedHashMap<>(); synchronized (REGISTERED_MECHANISMS) { for (SASLMechanism mechanism : REGISTERED_MECHANISMS) { answer.put(mechanism.getClass().getName(), mechanism.toString()); @@ -132,9 +132,9 @@ public final class SASLAuthentication { return false; } - public static boolean blacklistSASLMechanism(String mechansim) { + public static boolean blacklistSASLMechanism(String mechanism) { synchronized (BLACKLISTED_MECHANISMS) { - return BLACKLISTED_MECHANISMS.add(mechansim); + return BLACKLISTED_MECHANISMS.add(mechanism); } } @@ -356,8 +356,8 @@ public final class SASLAuthentication { throw new SmackException( "No supported and enabled SASL Mechanism provided by server. " + "Server announced mechanisms: " + serverMechanisms + ". " + - "Registerd SASL mechanisms with Smack: " + REGISTERED_MECHANISMS + ". " + - "Enabled SASL mechansisms for this connection: " + configuration.getEnabledSaslMechanisms() + ". " + + "Registered SASL mechanisms with Smack: " + REGISTERED_MECHANISMS + ". " + + "Enabled SASL mechanisms for this connection: " + configuration.getEnabledSaslMechanisms() + ". " + "Blacklisted SASL mechanisms: " + BLACKLISTED_MECHANISMS + '.' ); // @formatter;on diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java b/smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java index 71ec63ec5..7c4f8fd5f 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java @@ -55,11 +55,11 @@ public final class SmackConfiguration { private static int defaultPacketReplyTimeout = 5000; private static int packetCollectorSize = 5000; - private static List defaultMechs = new ArrayList(); + private static List defaultMechs = new ArrayList<>(); - static Set disabledSmackClasses = new HashSet(); + static Set disabledSmackClasses = new HashSet<>(); - final static List compressionHandlers = new ArrayList(2); + final static List compressionHandlers = new ArrayList<>(2); static boolean smackInitialized = false; @@ -67,7 +67,7 @@ public final class SmackConfiguration { /** * Value that indicates whether debugging is enabled. When enabled, a debug - * window will apear for each new connection that will contain the following + * window will appear for each new connection that will contain the following * information: