1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 01:29:38 +02:00

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

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