Clean code.

This commit is contained in:
chteufleur 2018-10-06 09:48:44 +02:00
parent 27f506c253
commit 371f5aa1cb
1 changed files with 6 additions and 6 deletions

View File

@ -67,7 +67,6 @@ public class ServiceXmpp extends Observable implements PresenceEventListener {
private AbstractXMPPConnection connection; private AbstractXMPPConnection connection;
private String jid; private String jid;
private String otherJid; private String otherJid;
private Roster roster;
private final ServiceXmpp thsi; private final ServiceXmpp thsi;
private boolean isEnable = false; private boolean isEnable = false;
@ -100,7 +99,7 @@ public class ServiceXmpp extends Observable implements PresenceEventListener {
connection.login(); connection.login();
registerCommands(); registerCommands();
roster = Roster.getInstanceFor(connection); Roster roster = Roster.getInstanceFor(connection);
roster.addPresenceEventListener(this); roster.addPresenceEventListener(this);
isConnected = connection.isConnected(); isConnected = connection.isConnected();
@ -127,6 +126,7 @@ public class ServiceXmpp extends Observable implements PresenceEventListener {
try { try {
sendPresenceUnavailable(otherJid); sendPresenceUnavailable(otherJid);
} catch (SmackException.NotConnectedException | InterruptedException | XmppStringprepException ex) { } catch (SmackException.NotConnectedException | InterruptedException | XmppStringprepException ex) {
ex.printStackTrace();
} }
} }
if (connection != null) { if (connection != null) {
@ -218,25 +218,25 @@ public class ServiceXmpp extends Observable implements PresenceEventListener {
private void registerCommands() { private void registerCommands() {
commandManager.registerCommand(XMPP_NODE_TRAIL_GEOLOC, XMPP_NODE_TRAIL_GEOLOC, new LocalCommandFactory() { commandManager.registerCommand(XMPP_NODE_TRAIL_GEOLOC, XMPP_NODE_TRAIL_GEOLOC, new LocalCommandFactory() {
@Override @Override
public LocalCommand getInstance() throws InstantiationException, IllegalAccessException { public LocalCommand getInstance() {
return new TrailGeolocCommand(thsi); return new TrailGeolocCommand(thsi);
} }
}); });
commandManager.registerCommand(XMPP_NODE_OBJECT_GEOLOC, XMPP_NODE_OBJECT_GEOLOC, new LocalCommandFactory() { commandManager.registerCommand(XMPP_NODE_OBJECT_GEOLOC, XMPP_NODE_OBJECT_GEOLOC, new LocalCommandFactory() {
@Override @Override
public LocalCommand getInstance() throws InstantiationException, IllegalAccessException { public LocalCommand getInstance() {
return new ObjectGeolocCommand(thsi); return new ObjectGeolocCommand(thsi);
} }
}); });
commandManager.registerCommand(XMPP_NODE_START_TRAIL_GEOLOC, XMPP_NODE_START_TRAIL_GEOLOC, new LocalCommandFactory() { commandManager.registerCommand(XMPP_NODE_START_TRAIL_GEOLOC, XMPP_NODE_START_TRAIL_GEOLOC, new LocalCommandFactory() {
@Override @Override
public LocalCommand getInstance() throws InstantiationException, IllegalAccessException { public LocalCommand getInstance() {
return new StartTrailGeolocCommand(thsi); return new StartTrailGeolocCommand(thsi);
} }
}); });
commandManager.registerCommand(XMPP_NODE_STOP_TRAIL_GEOLOC, XMPP_NODE_STOP_TRAIL_GEOLOC, new LocalCommandFactory() { commandManager.registerCommand(XMPP_NODE_STOP_TRAIL_GEOLOC, XMPP_NODE_STOP_TRAIL_GEOLOC, new LocalCommandFactory() {
@Override @Override
public LocalCommand getInstance() throws InstantiationException, IllegalAccessException { public LocalCommand getInstance() {
return new StopTrailGeolocCommand(thsi); return new StopTrailGeolocCommand(thsi);
} }
}); });