diff --git a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java index ac9bcc19d..8b6428de3 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java @@ -113,7 +113,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { * and reconnection events. */ protected final Set connectionListeners = - new CopyOnWriteArraySet(); + new CopyOnWriteArraySet<>(); /** * A collection of StanzaCollectors which collects packets for a specified filter @@ -142,7 +142,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { * List of PacketListeners that will be notified when a new stanza(/packet) was sent. */ private final Map sendListeners = - new HashMap(); + new HashMap<>(); /** * List of PacketListeners that will be notified when a new stanza(/packet) is about to be @@ -150,11 +150,11 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { * actually sent to the server. */ private final Map interceptors = - new HashMap(); + new HashMap<>(); protected final Lock connectionLock = new ReentrantLock(); - protected final Map streamFeatures = new HashMap(); + protected final Map streamFeatures = new HashMap<>(); /** * The full JID of the authenticated user, as returned by the resource binding response of the server. @@ -533,7 +533,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { if (!hasFeature(Bind.ELEMENT, Bind.NAMESPACE)) { - // Server never offered resource binding, which is REQURIED in XMPP client and + // Server never offered resource binding, which is REQUIRED in XMPP client and // server implementations as per RFC6120 7.2 throw new ResourceBindingNotOfferedException(); } @@ -592,7 +592,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { /** * Get the name of the SASL mechanism that was used to authenticate this connection. This returns the name of - * mechanism which was used the last time this conneciton was authenticated, and will return null if + * mechanism which was used the last time this connection was authenticated, and will return null if * this connection was not authenticated before. * * @return the name of the used SASL mechanism. @@ -621,7 +621,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { hostAddresses.add(hostAddress); } else if (config.host != null) { - hostAddresses = new ArrayList(1); + hostAddresses = new ArrayList<>(1); HostAddress hostAddress = DNSUtil.getDNSResolver().lookupHostAddress(config.host, config.port, failedAddresses, config.getDnssecMode()); if (hostAddress != null) { hostAddresses.add(hostAddress); @@ -862,7 +862,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { debugger.onOutgoingStreamElement(packet); } - final List listenersToNotify = new LinkedList(); + final List listenersToNotify = new LinkedList<>(); synchronized (sendListeners) { for (ListenerWrapper listenerWrapper : sendListeners.values()) { if (listenerWrapper.filterMatches(packet)) { @@ -918,7 +918,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { * @param packet the stanza(/packet) that is going to be sent to the server */ private void firePacketInterceptors(Stanza packet) { - List interceptorsToInvoke = new LinkedList(); + List interceptorsToInvoke = new LinkedList<>(); synchronized (interceptors) { for (InterceptorWrapper interceptorWrapper : interceptors.values()) { if (interceptorWrapper.filterMatches(packet)) { @@ -1029,7 +1029,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { final IQ iq = (IQ) packet; if (iq.isRequestIQ()) { final String key = XmppStringUtils.generateKey(iq.getChildElementName(), iq.getChildElementNamespace()); - IQRequestHandler iqRequestHandler = null; + IQRequestHandler iqRequestHandler; final IQ.Type type = iq.getType(); switch (type) { case set: @@ -1112,7 +1112,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { // First handle the async recv listeners. Note that this code is very similar to what follows a few lines below, // the only difference is that asyncRecvListeners is used here and that the packet listeners are started in // their own thread. - final Collection listenersToNotify = new LinkedList(); + final Collection listenersToNotify = new LinkedList<>(); synchronized (asyncRecvListeners) { for (ListenerWrapper listenerWrapper : asyncRecvListeners.values()) { if (listenerWrapper.filterMatches(packet)) { @@ -1342,7 +1342,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { removeCallbacksService.shutdownNow(); singleThreadedExecutorService.shutdownNow(); } catch (Throwable t) { - LOGGER.log(Level.WARNING, "finalize() threw trhowable", t); + LOGGER.log(Level.WARNING, "finalize() threw throwable", t); } finally { super.finalize(); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SmackFuture.java b/smack-core/src/main/java/org/jivesoftware/smack/SmackFuture.java index 62b90f23f..7d7034d67 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/SmackFuture.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/SmackFuture.java @@ -84,7 +84,7 @@ public abstract class SmackFuture implements Future, return this; } - private final V getOrThrowExecutionException() throws ExecutionException { + private V getOrThrowExecutionException() throws ExecutionException { assert (result != null || exception != null || cancelled); if (result != null) { return result; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java index 393d9fdae..e90b6b8dc 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java @@ -78,7 +78,7 @@ public interface XMPPConnection { * * @return the XMPP domain of this XMPP session. */ - public DomainBareJid getXMPPServiceDomain(); + DomainBareJid getXMPPServiceDomain(); /** * Returns the host name of the server where the XMPP server is running. This would be the @@ -86,7 +86,7 @@ public interface XMPPConnection { * * @return the host name of the server where the XMPP server is running or null if not yet connected. */ - public String getHost(); + String getHost(); /** * Returns the port number of the XMPP server for this connection. The default port @@ -94,7 +94,7 @@ public interface XMPPConnection { * * @return the port number of the XMPP server or 0 if not yet connected. */ - public int getPort(); + int getPort(); /** * Returns the full XMPP address of the user that is logged in to the connection or @@ -103,7 +103,7 @@ public interface XMPPConnection { * * @return the full XMPP address of the user logged in. */ - public EntityFullJid getUser(); + EntityFullJid getUser(); /** * Returns the stream ID for this connection, which is the value set by the server @@ -113,35 +113,35 @@ public interface XMPPConnection { * not connected to the server. * @see RFC 6120 ยง 4.7.3. id */ - public String getStreamId(); + String getStreamId(); /** * Returns true if currently connected to the XMPP server. * * @return true if connected. */ - public boolean isConnected(); + boolean isConnected(); /** * Returns true if currently authenticated by successfully calling the login method. * * @return true if authenticated. */ - public boolean isAuthenticated(); + boolean isAuthenticated(); /** * Returns true if currently authenticated anonymously. * * @return true if authenticated anonymously. */ - public boolean isAnonymous(); + boolean isAnonymous(); /** * Returns true if the connection to the server has successfully negotiated encryption. * * @return true if a secure connection to the server. */ - public boolean isSecureConnection(); + boolean isSecureConnection(); /** * Returns true if network traffic is being compressed. When using stream compression network @@ -151,7 +151,7 @@ public interface XMPPConnection { * * @return true if network traffic is being compressed. */ - public boolean isUsingCompression(); + boolean isUsingCompression(); /** * Sends the specified stanza to the server. @@ -160,7 +160,7 @@ public interface XMPPConnection { * @throws NotConnectedException if the connection is not connected. * @throws InterruptedException * */ - public void sendStanza(Stanza stanza) throws NotConnectedException, InterruptedException; + void sendStanza(Stanza stanza) throws NotConnectedException, InterruptedException; /** * Send a Nonza. @@ -174,7 +174,7 @@ public interface XMPPConnection { * @throws NotConnectedException * @throws InterruptedException */ - public void sendNonza(Nonza nonza) throws NotConnectedException, InterruptedException; + void sendNonza(Nonza nonza) throws NotConnectedException, InterruptedException; /** * Adds a connection listener to this connection that will be notified when @@ -182,14 +182,14 @@ public interface XMPPConnection { * * @param connectionListener a connection listener. */ - public void addConnectionListener(ConnectionListener connectionListener); + void addConnectionListener(ConnectionListener connectionListener); /** * Removes a connection listener from this connection. * * @param connectionListener a connection listener. */ - public void removeConnectionListener(ConnectionListener connectionListener); + void removeConnectionListener(ConnectionListener connectionListener); /** * Creates a new stanza(/packet) collector collecting packets that are replies to packet. @@ -202,7 +202,7 @@ public interface XMPPConnection { * @throws NotConnectedException * @throws InterruptedException */ - public StanzaCollector createStanzaCollectorAndSend(IQ packet) throws NotConnectedException, InterruptedException; + StanzaCollector createStanzaCollectorAndSend(IQ packet) throws NotConnectedException, InterruptedException; /** * Creates a new stanza(/packet) collector for this connection. A stanza(/packet) filter determines @@ -216,7 +216,7 @@ public interface XMPPConnection { * @throws InterruptedException * @throws NotConnectedException */ - public StanzaCollector createStanzaCollectorAndSend(StanzaFilter packetFilter, Stanza packet) + StanzaCollector createStanzaCollectorAndSend(StanzaFilter packetFilter, Stanza packet) throws NotConnectedException, InterruptedException; /** @@ -235,7 +235,7 @@ public interface XMPPConnection { * @param packetFilter the stanza(/packet) filter to use. * @return a new stanza(/packet) collector. */ - public StanzaCollector createStanzaCollector(StanzaFilter packetFilter); + StanzaCollector createStanzaCollector(StanzaFilter packetFilter); /** * Create a new stanza(/packet) collector with the given stanza(/packet) collector configuration. @@ -248,14 +248,14 @@ public interface XMPPConnection { * @return a new stanza(/packet) collector. * @since 4.1 */ - public StanzaCollector createStanzaCollector(StanzaCollector.Configuration configuration); + StanzaCollector createStanzaCollector(StanzaCollector.Configuration configuration); /** * Remove a stanza(/packet) collector of this connection. * * @param collector a stanza(/packet) collectors which was created for this connection. */ - public void removeStanzaCollector(StanzaCollector collector); + void removeStanzaCollector(StanzaCollector collector); /** * Registers a synchronous stanza(/packet) listener with this connection. A stanza(/packet) listener will be invoked only when @@ -274,7 +274,7 @@ public interface XMPPConnection { * @see #addPacketInterceptor(StanzaListener, StanzaFilter) * @since 4.1 */ - public void addSyncStanzaListener(StanzaListener packetListener, StanzaFilter packetFilter); + void addSyncStanzaListener(StanzaListener packetListener, StanzaFilter packetFilter); /** * Removes a stanza(/packet) listener for received packets from this connection. @@ -283,7 +283,7 @@ public interface XMPPConnection { * @return true if the stanza(/packet) listener was removed * @since 4.1 */ - public boolean removeSyncStanzaListener(StanzaListener packetListener); + boolean removeSyncStanzaListener(StanzaListener packetListener); /** * Registers an asynchronous stanza(/packet) listener with this connection. A stanza(/packet) listener will be invoked only @@ -300,7 +300,7 @@ public interface XMPPConnection { * @see #addPacketInterceptor(StanzaListener, StanzaFilter) * @since 4.1 */ - public void addAsyncStanzaListener(StanzaListener packetListener, StanzaFilter packetFilter); + void addAsyncStanzaListener(StanzaListener packetListener, StanzaFilter packetFilter); /** * Removes an asynchronous stanza(/packet) listener for received packets from this connection. @@ -309,7 +309,7 @@ public interface XMPPConnection { * @return true if the stanza(/packet) listener was removed * @since 4.1 */ - public boolean removeAsyncStanzaListener(StanzaListener packetListener); + boolean removeAsyncStanzaListener(StanzaListener packetListener); /** * Registers a stanza(/packet) listener with this connection. The listener will be @@ -322,14 +322,14 @@ public interface XMPPConnection { * @param packetListener the stanza(/packet) listener to notify of sent packets. * @param packetFilter the stanza(/packet) filter to use. */ - public void addPacketSendingListener(StanzaListener packetListener, StanzaFilter packetFilter); + void addPacketSendingListener(StanzaListener packetListener, StanzaFilter packetFilter); /** * Removes a stanza(/packet) listener for sending packets from this connection. * * @param packetListener the stanza(/packet) listener to remove. */ - public void removePacketSendingListener(StanzaListener packetListener); + void removePacketSendingListener(StanzaListener packetListener); /** * Registers a stanza(/packet) interceptor with this connection. The interceptor will be @@ -343,14 +343,14 @@ public interface XMPPConnection { * @param packetInterceptor the stanza(/packet) interceptor to notify of packets about to be sent. * @param packetFilter the stanza(/packet) filter to use. */ - public void addPacketInterceptor(StanzaListener packetInterceptor, StanzaFilter packetFilter); + void addPacketInterceptor(StanzaListener packetInterceptor, StanzaFilter packetFilter); /** * Removes a stanza(/packet) interceptor. * * @param packetInterceptor the stanza(/packet) interceptor to remove. */ - public void removePacketInterceptor(StanzaListener packetInterceptor); + void removePacketInterceptor(StanzaListener packetInterceptor); /** * Returns the current value of the reply timeout in milliseconds for request for this @@ -358,7 +358,7 @@ public interface XMPPConnection { * * @return the reply timeout in milliseconds */ - public long getReplyTimeout(); + long getReplyTimeout(); /** * Set the stanza(/packet) reply timeout in milliseconds. In most cases, Smack will throw a @@ -366,7 +366,7 @@ public interface XMPPConnection { * * @param timeout for a reply in milliseconds */ - public void setReplyTimeout(long timeout); + void setReplyTimeout(long timeout); /** * Get the connection counter of this XMPPConnection instance. Those can be used as ID to @@ -375,9 +375,9 @@ public interface XMPPConnection { * * @return the connection counter of this XMPPConnection */ - public int getConnectionCounter(); + int getConnectionCounter(); - public static enum FromMode { + enum FromMode { /** * Leave the 'from' attribute unchanged. This is the behavior of Smack < 4.0 */ @@ -400,14 +400,14 @@ public interface XMPPConnection { * * @param fromMode */ - public void setFromMode(FromMode fromMode); + void setFromMode(FromMode fromMode); /** * Get the currently active FromMode. * * @return the currently active {@link FromMode} */ - public FromMode getFromMode(); + FromMode getFromMode(); /** * Get the feature stanza(/packet) extensions for a given stream feature of the @@ -417,7 +417,7 @@ public interface XMPPConnection { * @param namespace * @return a stanza(/packet) extensions of the feature or null */ - public F getFeature(String element, String namespace); + F getFeature(String element, String namespace); /** * Return true if the server supports the given stream feature. @@ -426,7 +426,7 @@ public interface XMPPConnection { * @param namespace * @return true if the server supports the stream feature. */ - public boolean hasFeature(String element, String namespace); + boolean hasFeature(String element, String namespace); /** * Send an IQ request asynchronously. The connection's default reply timeout will be used. @@ -434,7 +434,7 @@ public interface XMPPConnection { * @param request the IQ request to send. * @return a SmackFuture for the response. */ - public SmackFuture sendIqRequestAsync(IQ request); + SmackFuture sendIqRequestAsync(IQ request); /** * Send an IQ request asynchronously. @@ -443,7 +443,7 @@ public interface XMPPConnection { * @param timeout the reply timeout in milliseconds. * @return a SmackFuture for the response. */ - public SmackFuture sendIqRequestAsync(IQ request, long timeout); + SmackFuture sendIqRequestAsync(IQ request, long timeout); /** * Send a stanza asynchronously, waiting for exactly one response stanza using the given reply filter. The @@ -453,7 +453,7 @@ public interface XMPPConnection { * @param replyFilter the filter used for the response stanza. * @return a SmackFuture for the response. */ - public SmackFuture sendAsync(S stanza, StanzaFilter replyFilter); + SmackFuture sendAsync(S stanza, StanzaFilter replyFilter); /** * Send a stanza asynchronously, waiting for exactly one response stanza using the given reply filter. @@ -463,7 +463,7 @@ public interface XMPPConnection { * @param timeout the reply timeout in milliseconds. * @return a SmackFuture for the response. */ - public SmackFuture sendAsync(S stanza, StanzaFilter replyFilter, long timeout); + SmackFuture sendAsync(S stanza, StanzaFilter replyFilter, long timeout); /** * Send a stanza and wait asynchronously for a response by using replyFilter. @@ -482,7 +482,7 @@ public interface XMPPConnection { */ @Deprecated // TODO: Remove in Smack 4.4. - public void sendStanzaWithResponseCallback(Stanza stanza, StanzaFilter replyFilter, + void sendStanzaWithResponseCallback(Stanza stanza, StanzaFilter replyFilter, StanzaListener callback) throws NotConnectedException, InterruptedException; /** @@ -503,7 +503,7 @@ public interface XMPPConnection { */ @Deprecated // TODO: Remove in Smack 4.4. - public void sendStanzaWithResponseCallback(Stanza stanza, StanzaFilter replyFilter, StanzaListener callback, + void sendStanzaWithResponseCallback(Stanza stanza, StanzaFilter replyFilter, StanzaListener callback, @SuppressWarnings("deprecation") ExceptionCallback exceptionCallback) throws NotConnectedException, InterruptedException; /** @@ -525,7 +525,7 @@ public interface XMPPConnection { */ @Deprecated // TODO: Remove in Smack 4.4. - public void sendStanzaWithResponseCallback(Stanza stanza, StanzaFilter replyFilter, + void sendStanzaWithResponseCallback(Stanza stanza, StanzaFilter replyFilter, final StanzaListener callback, @SuppressWarnings("deprecation") final ExceptionCallback exceptionCallback, long timeout) throws NotConnectedException, InterruptedException; @@ -542,7 +542,7 @@ public interface XMPPConnection { */ @Deprecated // TODO: Remove in Smack 4.4. - public void sendIqWithResponseCallback(IQ iqRequest, StanzaListener callback) throws NotConnectedException, InterruptedException; + void sendIqWithResponseCallback(IQ iqRequest, StanzaListener callback) throws NotConnectedException, InterruptedException; /** * Send a IQ stanza and invoke callback if there is a result of @@ -561,7 +561,7 @@ public interface XMPPConnection { */ @Deprecated // TODO: Remove in Smack 4.4. - public void sendIqWithResponseCallback(IQ iqRequest, StanzaListener callback, + void sendIqWithResponseCallback(IQ iqRequest, StanzaListener callback, @SuppressWarnings("deprecation") ExceptionCallback exceptionCallback) throws NotConnectedException, InterruptedException; /** @@ -582,7 +582,7 @@ public interface XMPPConnection { */ @Deprecated // TODO: Remove in Smack 4.4. - public void sendIqWithResponseCallback(IQ iqRequest, final StanzaListener callback, + void sendIqWithResponseCallback(IQ iqRequest, final StanzaListener callback, @SuppressWarnings("deprecation") final ExceptionCallback exceptionCallback, long timeout) throws NotConnectedException, InterruptedException; @@ -593,7 +593,7 @@ public interface XMPPConnection { * @param callback the callback invoked once the stanza(/packet) filter matches a stanza. * @param packetFilter the filter to match stanzas or null to match all. */ - public void addOneTimeSyncCallback(StanzaListener callback, StanzaFilter packetFilter); + void addOneTimeSyncCallback(StanzaListener callback, StanzaFilter packetFilter); /** * Register an IQ request handler with this connection. @@ -603,7 +603,7 @@ public interface XMPPConnection { * @param iqRequestHandler the IQ request handler to register. * @return the previously registered IQ request handler or null. */ - public IQRequestHandler registerIQRequestHandler(IQRequestHandler iqRequestHandler); + IQRequestHandler registerIQRequestHandler(IQRequestHandler iqRequestHandler); /** * Convenience method for {@link #unregisterIQRequestHandler(String, String, org.jivesoftware.smack.packet.IQ.Type)}. @@ -611,7 +611,7 @@ public interface XMPPConnection { * @param iqRequestHandler * @return the previously registered IQ request handler or null. */ - public IQRequestHandler unregisterIQRequestHandler(IQRequestHandler iqRequestHandler); + IQRequestHandler unregisterIQRequestHandler(IQRequestHandler iqRequestHandler); /** * Unregister an IQ request handler with this connection. @@ -621,13 +621,13 @@ public interface XMPPConnection { * @param type the IQ type the IQ request handler is responsible for. * @return the previously registered IQ request handler or null. */ - public IQRequestHandler unregisterIQRequestHandler(String element, String namespace, IQ.Type type); + IQRequestHandler unregisterIQRequestHandler(String element, String namespace, IQ.Type type); /** * Returns the timestamp in milliseconds when the last stanza was received. * * @return the timestamp in milliseconds */ - public long getLastStanzaReceived(); + long getLastStanzaReceived(); } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/ExceptionCallback.java b/smack-core/src/main/java/org/jivesoftware/smack/util/ExceptionCallback.java index 52ffb4454..890b41d1d 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/ExceptionCallback.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/ExceptionCallback.java @@ -18,6 +18,6 @@ package org.jivesoftware.smack.util; public interface ExceptionCallback { - public void processException(E exception); + void processException(E exception); } diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/hashes/HashElementTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/hashes/HashElementTest.java index 26de91839..e67342a9e 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/hashes/HashElementTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/hashes/HashElementTest.java @@ -49,8 +49,6 @@ public class HashElementTest extends SmackTestSuite { assertEquals("f4OxZX/x/FO5LcGBSKHWXfwtSx+j1ncoSt3SABJtkGk=", parsed.getHashB64()); assertArrayEquals(HashManager.sha_256(message), parsed.getHash()); - assertFalse(parsed.equals(expected)); - assertFalse(parsed.equals(null)); assertEquals(element, parsed); assertTrue(element.equals(parsed)); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/BytestreamManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/BytestreamManager.java index 302cef86e..16e02249e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/BytestreamManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/BytestreamManager.java @@ -46,14 +46,14 @@ public interface BytestreamManager { * * @param listener the listener to register */ - public void addIncomingBytestreamListener(BytestreamListener listener); + void addIncomingBytestreamListener(BytestreamListener listener); /** * Removes the given listener from the list of listeners for all incoming bytestream requests. * * @param listener the listener to remove */ - public void removeIncomingBytestreamListener(BytestreamListener listener); + void removeIncomingBytestreamListener(BytestreamListener listener); /** * Adds {@link BytestreamListener} that is called for every incoming bytestream request unless @@ -68,14 +68,14 @@ public interface BytestreamManager { * @param listener the listener to register * @param initiatorJID the JID of the user that wants to establish a bytestream */ - public void addIncomingBytestreamListener(BytestreamListener listener, Jid initiatorJID); + void addIncomingBytestreamListener(BytestreamListener listener, Jid initiatorJID); /** * Removes the listener for the given user. * * @param initiatorJID the JID of the user the listener should be removed */ - public void removeIncomingBytestreamListener(Jid initiatorJID); + void removeIncomingBytestreamListener(Jid initiatorJID); /** * Establishes a bytestream with the given user and returns the session to send/receive data @@ -97,7 +97,7 @@ public interface BytestreamManager { * @throws InterruptedException if the thread was interrupted while waiting in a blocking * operation */ - public BytestreamSession establishSession(Jid targetJID) throws XMPPException, IOException, + BytestreamSession establishSession(Jid targetJID) throws XMPPException, IOException, InterruptedException, SmackException; /** @@ -115,7 +115,7 @@ public interface BytestreamManager { * @throws InterruptedException if the thread was interrupted while waiting in a blocking * operation */ - public BytestreamSession establishSession(Jid targetJID, String sessionID) + BytestreamSession establishSession(Jid targetJID, String sessionID) throws XMPPException, IOException, InterruptedException, SmackException; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java index a63a17bcf..4ab77757c 100755 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java @@ -77,7 +77,7 @@ public final class AdHocCommandManager extends Manager { * Map an XMPPConnection with it AdHocCommandManager. This map have a key-value * pair for every active connection. */ - private static Map instances = new WeakHashMap<>(); + private static final Map instances = new WeakHashMap<>(); /** * Register the listener for all the connection creations. When a new @@ -114,7 +114,7 @@ public final class AdHocCommandManager extends Manager { * Value=command. Command node matches the node attribute sent by command * requesters. */ - private final Map commands = new ConcurrentHashMap(); + private final Map commands = new ConcurrentHashMap<>(); /** * Map a command session ID with the instance LocalCommand. The LocalCommand @@ -122,7 +122,7 @@ public final class AdHocCommandManager extends Manager { * the command execution. Note: Key=session ID, Value=LocalCommand. Session * ID matches the sessionid attribute sent by command responders. */ - private final Map executingCommands = new ConcurrentHashMap(); + private final Map executingCommands = new ConcurrentHashMap<>(); private final ServiceDiscoveryManager serviceDiscoveryManager; @@ -155,7 +155,7 @@ public final class AdHocCommandManager extends Manager { @Override public List getNodeItems() { - List answer = new ArrayList(); + List answer = new ArrayList<>(); Collection commandsList = getRegisteredCommands(); for (AdHocCommandInfo info : commandsList) { @@ -181,7 +181,7 @@ public final class AdHocCommandManager extends Manager { return processAdHocCommand(requestData); } catch (InterruptedException | NoResponseException | NotConnectedException e) { - LOGGER.log(Level.INFO, "processAdHocCommand threw exceptino", e); + LOGGER.log(Level.INFO, "processAdHocCommand threw exception", e); return null; } } @@ -215,7 +215,7 @@ public final class AdHocCommandManager extends Manager { * Registers a new command with this command manager, which is related to a * connection. The node is an unique identifier of that * command for the connection related to this command manager. The name - * is the human readeale name of the command. The factory generates + * is the human readable name of the command. The factory generates * new instances of the command. * * @param node the unique identifier of the command. @@ -232,7 +232,7 @@ public final class AdHocCommandManager extends Manager { new AbstractNodeInformationProvider() { @Override public List getNodeFeatures() { - List answer = new ArrayList(); + List answer = new ArrayList<>(); answer.add(NAMESPACE); // TODO: check if this service is provided by the // TODO: current connection. @@ -241,7 +241,7 @@ public final class AdHocCommandManager extends Manager { } @Override public List getNodeIdentities() { - List answer = new ArrayList(); + List answer = new ArrayList<>(); DiscoverInfo.Identity identity = new DiscoverInfo.Identity( "automation", name, "command-node"); answer.add(identity); @@ -353,7 +353,7 @@ public final class AdHocCommandManager extends Manager { try { // Create a new instance of the command with the - // corresponding sessioid + // corresponding sessionid LocalCommand command; try { command = newInstanceOfCmd(commandNode, sessionId); @@ -425,7 +425,7 @@ public final class AdHocCommandManager extends Manager { // the requester know why his execution request is // not accepted. If the session is removed just // after the time out, then whe the user request to - // continue the execution he will recieved an + // continue the execution he will received an // invalid session error and not a time out error. if (System.currentTimeMillis() - creationStamp > SESSION_TIMEOUT * 1000 * 2) { // Remove the expired session diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/LocalCommandFactory.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/LocalCommandFactory.java index d8248e0ef..84fd2b876 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/LocalCommandFactory.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/LocalCommandFactory.java @@ -41,6 +41,6 @@ public interface LocalCommandFactory { * @throws InvocationTargetException * @throws IllegalArgumentException */ - public LocalCommand getInstance() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException; + LocalCommand getInstance() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IncomingFileTransfer.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IncomingFileTransfer.java index ff73258b7..c29d16c99 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IncomingFileTransfer.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IncomingFileTransfer.java @@ -182,7 +182,7 @@ public class IncomingFileTransfer extends FileTransfer { final StreamNegotiator streamNegotiator = negotiator .selectStreamNegotiator(receiveRequest); setStatus(Status.negotiating_stream); - FutureTask streamNegotiatorTask = new FutureTask( + FutureTask streamNegotiatorTask = new FutureTask<>( new Callable() { @Override diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/Jingle.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/Jingle.java index 12c2e4d5e..cddda3984 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/Jingle.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/Jingle.java @@ -94,7 +94,7 @@ public final class Jingle extends IQ { /** * Get the responder. The responder is the full JID of the entity that has replied to the initiation (which may be - * different to the "to" addresss in the IQ). + * different to the "to" address in the IQ). * * @return the responder */ diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleAction.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleAction.java index edd2e8033..7b1beb719 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleAction.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleAction.java @@ -44,7 +44,7 @@ public enum JingleAction { transport_replace, ; - private static final Map map = new HashMap( + private static final Map map = new HashMap<>( JingleAction.values().length); static { for (JingleAction jingleAction : JingleAction.values()) { @@ -54,7 +54,7 @@ public enum JingleAction { private final String asString; - private JingleAction() { + JingleAction() { asString = this.name().replace('_', '-'); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/JingleTransportInitiationException.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/JingleTransportInitiationException.java index 8971d2821..a9cfee017 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/JingleTransportInitiationException.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/JingleTransportInitiationException.java @@ -16,9 +16,6 @@ */ package org.jivesoftware.smackx.jingle.transports; -/** - * Created by vanitas on 25.06.17. - */ public abstract class JingleTransportInitiationException extends Exception { private static final long serialVersionUID = 1L; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/JingleTransportSession.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/JingleTransportSession.java index 0776bc6b2..004379f8e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/JingleTransportSession.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/JingleTransportSession.java @@ -22,9 +22,6 @@ import org.jivesoftware.smackx.jingle.element.Jingle; import org.jivesoftware.smackx.jingle.element.JingleContent; import org.jivesoftware.smackx.jingle.element.JingleContentTransport; -/** - * Created by vanitas on 20.06.17. - */ public abstract class JingleTransportSession { protected final JingleSession jingleSession; protected T ourProposal, theirProposal; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleUtilTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleUtilTest.java index 500ee2279..e10a879f2 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleUtilTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleUtilTest.java @@ -98,5 +98,6 @@ public class JingleUtilTest extends SmackTestSuite { "" + "" + ""; + // TODO: Finish test } } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/provider/JingleProviderTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/provider/JingleProviderTest.java index c3483623e..68eb4ab57 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/provider/JingleProviderTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/provider/JingleProviderTest.java @@ -55,8 +55,8 @@ public class JingleProviderTest { JingleContentDescription jingleContentDescription = jingle.getSoleContentOrThrow().getDescription(); - String parsedUnknownJingleContentDescrptionNamespace = jingleContentDescription.getNamespace(); - assertEquals(unknownJingleContentDescriptionNamespace, parsedUnknownJingleContentDescrptionNamespace); + String parsedUnknownJingleContentDescriptionNamespace = jingleContentDescription.getNamespace(); + assertEquals(unknownJingleContentDescriptionNamespace, parsedUnknownJingleContentDescriptionNamespace); } @Test diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/xdata/FormTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/xdata/FormTest.java index 706b44318..fd8097f87 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/xdata/FormTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/xdata/FormTest.java @@ -104,8 +104,8 @@ public class FormTest extends AbstractSmackIntegrationTest { chat.sendMessage(msg); // Get the message with the form to fill out - Message msg2 = (Message) collector2.nextResult(); - assertNotNull("Messge not found", msg2); + Message msg2 = collector2.nextResult(); + assertNotNull("Message not found", msg2); // Retrieve the form to fill out Form formToRespond = Form.getFormFrom(msg2); assertNotNull(formToRespond); @@ -140,8 +140,8 @@ public class FormTest extends AbstractSmackIntegrationTest { conTwo.sendStanza(msg2); // Get the message with the completed form - Message msg3 = (Message) collector.nextResult(); - assertNotNull("Messge not found", msg3); + Message msg3 = collector.nextResult(); + assertNotNull("Message not found", msg3); // Retrieve the completed form completedForm = Form.getFormFrom(msg3); assertNotNull(completedForm);