Use entries.containsKey in Roster

This commit is contained in:
Florian Schmaus 2014-12-29 18:20:11 +01:00
parent 5d5e3c05c5
commit c8631cf45c
1 changed files with 3 additions and 7 deletions

View File

@ -850,7 +850,6 @@ public class Roster {
String from = presence.getFrom(); String from = presence.getFrom();
String key = getPresenceMapKey(from); String key = getPresenceMapKey(from);
Map<String, Presence> userPresences; Map<String, Presence> userPresences;
RosterEntry entry;
Presence response = null; Presence response = null;
// If an "available" presence, add it to the presence map. Each presence // If an "available" presence, add it to the presence map. Each presence
@ -872,8 +871,7 @@ public class Roster {
// Add the new presence, using the resources as a key. // Add the new presence, using the resources as a key.
userPresences.put(XmppStringUtils.parseResource(from), presence); userPresences.put(XmppStringUtils.parseResource(from), presence);
// If the user is in the roster, fire an event. // If the user is in the roster, fire an event.
entry = entries.get(key); if (entries.containsKey(key)) {
if (entry != null) {
fireRosterPresenceEvent(presence); fireRosterPresenceEvent(presence);
} }
break; break;
@ -900,8 +898,7 @@ public class Roster {
userPresences.put(XmppStringUtils.parseResource(from), presence); userPresences.put(XmppStringUtils.parseResource(from), presence);
} }
// If the user is in the roster, fire an event. // If the user is in the roster, fire an event.
entry = entries.get(key); if (entries.containsKey(key)) {
if (entry != null) {
fireRosterPresenceEvent(presence); fireRosterPresenceEvent(presence);
} }
break; break;
@ -954,8 +951,7 @@ public class Roster {
// Set the new presence using the empty resource as a key. // Set the new presence using the empty resource as a key.
userPresences.put("", presence); userPresences.put("", presence);
// If the user is in the roster, fire an event. // If the user is in the roster, fire an event.
entry = entries.get(key); if (entries.containsKey(key)) {
if (entry != null) {
fireRosterPresenceEvent(presence); fireRosterPresenceEvent(presence);
} }
break; break;