Handling xmpp recipients with invalid JIDs

Shabirmean 9 years ago
parent 25f14be3fb
commit ece41c90c5

@ -70,6 +70,7 @@ public class VirtualFireAlarmXMPPConnector extends XmppConnector {
int indexOfAt = from.indexOf("@"); int indexOfAt = from.indexOf("@");
int indexOfSlash = from.indexOf("/"); int indexOfSlash = from.indexOf("/");
if (indexOfAt != -1 && indexOfSlash != -1) {
String deviceId = from.substring(0, indexOfAt); String deviceId = from.substring(0, indexOfAt);
String owner = from.substring(indexOfSlash + 1, from.length()); String owner = from.substring(indexOfSlash + 1, from.length());
@ -97,7 +98,8 @@ public class VirtualFireAlarmXMPPConnector extends XmppConnector {
String tempVal = message.split(":")[1]; String tempVal = message.split(":")[1];
SensorDataManager.getInstance().setSensorRecord(deviceId, SensorDataManager.getInstance().setSensorRecord(deviceId,
VirtualFireAlarmConstants.SENSOR_TEMPERATURE, VirtualFireAlarmConstants.SENSOR_TEMPERATURE,
tempVal, Calendar.getInstance().getTimeInMillis()); tempVal,
Calendar.getInstance().getTimeInMillis());
break; break;
default: default:
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
@ -106,6 +108,9 @@ public class VirtualFireAlarmXMPPConnector extends XmppConnector {
break; break;
} }
} }
} else {
log.warn("Received XMPP message from client with unexpected JID [" + from + "].");
}
} }
private void retryXMPPConnection() { private void retryXMPPConnection() {

Loading…
Cancel
Save