mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 13:32:07 +01:00
Improve logging of IoTProvisioningManager
This commit is contained in:
parent
48a46e43ab
commit
44d6a9d7c1
1 changed files with 17 additions and 8 deletions
|
@ -122,7 +122,7 @@ public final class IoTProvisioningManager extends Manager {
|
|||
connection.addAsyncStanzaListener(new StanzaListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza stanza) throws NotConnectedException, InterruptedException {
|
||||
if (!isFromProvisioningService(stanza)) {
|
||||
if (!isFromProvisioningService(stanza, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ public final class IoTProvisioningManager extends Manager {
|
|||
final Friend friend = Friend.from(friendMessage);
|
||||
final BareJid friendJid = friend.getFriend();
|
||||
|
||||
if (isFromProvisioningService(friendMessage)) {
|
||||
if (isFromProvisioningService(friendMessage, false)) {
|
||||
// We received a recommendation from a provisioning server.
|
||||
// Notify the recommended friend that we will now accept his
|
||||
// friendship requests.
|
||||
|
@ -178,6 +178,10 @@ public final class IoTProvisioningManager extends Manager {
|
|||
// the bare 'from' JID should be equals to the JID of the
|
||||
// recommended friend.
|
||||
if (!bareFrom.equals(friendJid)) {
|
||||
LOGGER.log(Level.WARNING,
|
||||
"Ignoring friendship recommendation " + friendMessage
|
||||
+ " because it does not recommend itself, but "
|
||||
+ friendJid + '.');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -191,7 +195,7 @@ public final class IoTProvisioningManager extends Manager {
|
|||
new AbstractIqRequestHandler(ClearCache.ELEMENT, ClearCache.NAMESPACE, Type.set, Mode.async) {
|
||||
@Override
|
||||
public IQ handleIQRequest(IQ iqRequest) {
|
||||
if (!isFromProvisioningService(iqRequest)) {
|
||||
if (!isFromProvisioningService(iqRequest, true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -391,7 +395,7 @@ public final class IoTProvisioningManager extends Manager {
|
|||
return wasUnfriendedListeners.remove(wasUnfriendedListener);
|
||||
}
|
||||
|
||||
private boolean isFromProvisioningService(Stanza stanza) {
|
||||
private boolean isFromProvisioningService(Stanza stanza, boolean log) {
|
||||
Jid provisioningServer;
|
||||
try {
|
||||
provisioningServer = getConfiguredProvisioningServer();
|
||||
|
@ -401,13 +405,18 @@ public final class IoTProvisioningManager extends Manager {
|
|||
return false;
|
||||
}
|
||||
if (provisioningServer == null) {
|
||||
LOGGER.warning("Ignoring request '" + stanza
|
||||
+ "' because no provisioning server configured.");
|
||||
if (log) {
|
||||
LOGGER.warning("Ignoring request '" + stanza
|
||||
+ "' because no provisioning server configured.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (!provisioningServer.equals(stanza.getFrom())) {
|
||||
LOGGER.warning("Ignoring request '" + stanza + "' because not from provising server '"
|
||||
+ provisioningServer + "'.");
|
||||
if (log) {
|
||||
LOGGER.warning("Ignoring request '" + stanza
|
||||
+ "' because not from provising server '" + provisioningServer
|
||||
+ "'.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue