1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-12-16 18:11:08 +01:00

Bump "Error Prone" to 2.0.15

and fix a few things :)
This commit is contained in:
Florian Schmaus 2017-02-11 16:16:41 +01:00
parent ef0af66b21
commit 4c646436a5
246 changed files with 1122 additions and 124 deletions

View file

@ -457,12 +457,13 @@ public abstract class AdHocCommand {
*/
sessionExpired("session-expired");
private String value;
private final String value;
SpecificErrorCondition(String value) {
this.value = value;
}
@Override
public String toString() {
return value;
}

View file

@ -17,6 +17,7 @@
package org.jivesoftware.smackx.commands;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -83,6 +84,7 @@ public final class AdHocCommandManager extends Manager {
*/
static {
XMPPConnectionRegistry.addConnectionCreationListener(new ConnectionCreationListener() {
@Override
public void connectionCreated(XMPPConnection connection) {
getAddHocCommandsManager(connection);
}
@ -200,8 +202,16 @@ public final class AdHocCommandManager extends Manager {
*/
public void registerCommand(String node, String name, final Class<? extends LocalCommand> clazz) {
registerCommand(node, name, new LocalCommandFactory() {
@Override
public LocalCommand getInstance() throws InstantiationException, IllegalAccessException {
return clazz.newInstance();
try {
return clazz.getConstructor().newInstance();
}
catch (IllegalArgumentException | InvocationTargetException | NoSuchMethodException
| SecurityException e) {
// TODO: Throw those method in Smack 4.3.
throw new IllegalStateException(e);
}
}
});
}
@ -393,6 +403,7 @@ public final class AdHocCommandManager extends Manager {
// See if the session reaping thread is started. If not, start it.
if (sessionsSweeper == null) {
sessionsSweeper = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
for (String sessionId : executingCommands.keySet()) {

View file

@ -248,9 +248,11 @@ public class AdHocCommandData extends IQ {
this.condition = condition;
}
@Override
public String getElementName() {
return condition.toString();
}
@Override
public String getNamespace() {
return namespace;
}
@ -259,6 +261,7 @@ public class AdHocCommandData extends IQ {
return condition;
}
@Override
public String toXML() {
StringBuilder buf = new StringBuilder();
buf.append('<').append(getElementName());