Fix minor codestyle issues

This commit is contained in:
Paul Schaub 2017-12-13 23:10:11 +01:00 committed by Florian Schmaus
parent 431e5b3c67
commit 2f2c2f8663
16 changed files with 92 additions and 99 deletions

View File

@ -113,7 +113,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
* and reconnection events.
*/
protected final Set<ConnectionListener> connectionListeners =
new CopyOnWriteArraySet<ConnectionListener>();
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<StanzaListener, ListenerWrapper> sendListeners =
new HashMap<StanzaListener, ListenerWrapper>();
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<StanzaListener, InterceptorWrapper> interceptors =
new HashMap<StanzaListener, InterceptorWrapper>();
new HashMap<>();
protected final Lock connectionLock = new ReentrantLock();
protected final Map<String, ExtensionElement> streamFeatures = new HashMap<String, ExtensionElement>();
protected final Map<String, ExtensionElement> 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 <code>null</code> if
* mechanism which was used the last time this connection was authenticated, and will return <code>null</code> 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<HostAddress>(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<StanzaListener> listenersToNotify = new LinkedList<StanzaListener>();
final List<StanzaListener> 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<StanzaListener> interceptorsToInvoke = new LinkedList<StanzaListener>();
List<StanzaListener> 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<StanzaListener> listenersToNotify = new LinkedList<StanzaListener>();
final Collection<StanzaListener> 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();

View File

@ -84,7 +84,7 @@ public abstract class SmackFuture<V, E extends Exception> implements Future<V>,
return this;
}
private final V getOrThrowExecutionException() throws ExecutionException {
private V getOrThrowExecutionException() throws ExecutionException {
assert (result != null || exception != null || cancelled);
if (result != null) {
return result;

View File

@ -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 <a href="http://xmpp.org/rfcs/rfc6120.html#streams-attr-id">RFC 6120 § 4.7.3. id</a>
*/
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 <code>packet</code>.
@ -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 <b>synchronous</b> 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 <b>asynchronous</b> 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 <b>asynchronous</b> 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 <code>null</code>
*/
public <F extends ExtensionElement> F getFeature(String element, String namespace);
<F extends ExtensionElement> 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<IQ, Exception> sendIqRequestAsync(IQ request);
SmackFuture<IQ, Exception> 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<IQ, Exception> sendIqRequestAsync(IQ request, long timeout);
SmackFuture<IQ, Exception> 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 <S extends Stanza> SmackFuture<S, Exception> sendAsync(S stanza, StanzaFilter replyFilter);
<S extends Stanza> SmackFuture<S, Exception> 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 <S extends Stanza> SmackFuture<S, Exception> sendAsync(S stanza, StanzaFilter replyFilter, long timeout);
<S extends Stanza> SmackFuture<S, Exception> sendAsync(S stanza, StanzaFilter replyFilter, long timeout);
/**
* Send a stanza and wait asynchronously for a response by using <code>replyFilter</code>.
@ -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 <code>callback</code> 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();
}

View File

@ -18,6 +18,6 @@ package org.jivesoftware.smack.util;
public interface ExceptionCallback<E> {
public void processException(E exception);
void processException(E exception);
}

View File

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

View File

@ -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;
}

View File

@ -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<XMPPConnection, AdHocCommandManager> instances = new WeakHashMap<>();
private static final Map<XMPPConnection, AdHocCommandManager> 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<String, AdHocCommandInfo> commands = new ConcurrentHashMap<String, AdHocCommandInfo>();
private final Map<String, AdHocCommandInfo> 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<String, LocalCommand> executingCommands = new ConcurrentHashMap<String, LocalCommand>();
private final Map<String, LocalCommand> executingCommands = new ConcurrentHashMap<>();
private final ServiceDiscoveryManager serviceDiscoveryManager;
@ -155,7 +155,7 @@ public final class AdHocCommandManager extends Manager {
@Override
public List<DiscoverItems.Item> getNodeItems() {
List<DiscoverItems.Item> answer = new ArrayList<DiscoverItems.Item>();
List<DiscoverItems.Item> answer = new ArrayList<>();
Collection<AdHocCommandInfo> 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 <tt>node</tt> is an unique identifier of that
* command for the connection related to this command manager. The <tt>name</tt>
* is the human readeale name of the command. The <tt>factory</tt> generates
* is the human readable name of the command. The <tt>factory</tt> 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<String> getNodeFeatures() {
List<String> answer = new ArrayList<String>();
List<String> 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<DiscoverInfo.Identity> getNodeIdentities() {
List<DiscoverInfo.Identity> answer = new ArrayList<DiscoverInfo.Identity>();
List<DiscoverInfo.Identity> 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

View File

@ -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;
}

View File

@ -182,7 +182,7 @@ public class IncomingFileTransfer extends FileTransfer {
final StreamNegotiator streamNegotiator = negotiator
.selectStreamNegotiator(receiveRequest);
setStatus(Status.negotiating_stream);
FutureTask<InputStream> streamNegotiatorTask = new FutureTask<InputStream>(
FutureTask<InputStream> streamNegotiatorTask = new FutureTask<>(
new Callable<InputStream>() {
@Override

View File

@ -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
*/

View File

@ -44,7 +44,7 @@ public enum JingleAction {
transport_replace,
;
private static final Map<String, JingleAction> map = new HashMap<String, JingleAction>(
private static final Map<String, JingleAction> 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('_', '-');
}

View File

@ -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;

View File

@ -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<T extends JingleContentTransport> {
protected final JingleSession jingleSession;
protected T ourProposal, theirProposal;

View File

@ -98,5 +98,6 @@ public class JingleUtilTest extends SmackTestSuite {
"</content>" +
"</jingle>" +
"</iq>";
// TODO: Finish test
}
}

View File

@ -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

View File

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