Commit a25c2e0b authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Removed superfluos #toLowercase. JM-539

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3352 b35dd754-fafc-0310-a699-88a17e54d16e
parent c535348c
...@@ -523,7 +523,7 @@ public class SessionManager extends BasicModule { ...@@ -523,7 +523,7 @@ public class SessionManager extends BasicModule {
*/ */
public boolean addSession(ClientSession session) { public boolean addSession(ClientSession session) {
boolean success = false; boolean success = false;
String username = session.getAddress().getNode().toLowerCase(); String username = session.getAddress().getNode();
SessionMap resources = null; SessionMap resources = null;
synchronized(username.intern()) { synchronized(username.intern()) {
...@@ -684,7 +684,7 @@ public class SessionManager extends BasicModule { ...@@ -684,7 +684,7 @@ public class SessionManager extends BasicModule {
// Do nothing if the session belongs to an anonymous user // Do nothing if the session belongs to an anonymous user
return; return;
} }
String username = sender.getNode().toLowerCase(); String username = sender.getNode();
synchronized (username.intern()) { synchronized (username.intern()) {
SessionMap resources = sessions.get(username); SessionMap resources = sessions.get(username);
if (resources == null) { if (resources == null) {
...@@ -728,7 +728,6 @@ public class SessionManager extends BasicModule { ...@@ -728,7 +728,6 @@ public class SessionManager extends BasicModule {
} }
} }
else { else {
username = username.toLowerCase();
synchronized (username.intern()) { synchronized (username.intern()) {
SessionMap sessionMap = sessions.get(username); SessionMap sessionMap = sessions.get(username);
if (sessionMap != null) { if (sessionMap != null) {
...@@ -818,10 +817,10 @@ public class SessionManager extends BasicModule { ...@@ -818,10 +817,10 @@ public class SessionManager extends BasicModule {
if (serverName == null || !serverName.equals(domain)) { if (serverName == null || !serverName.equals(domain)) {
return null; return null;
} }
// Build a JID represention based on the given JID data // Build a JID represention based on the given JID data
StringBuilder buf = new StringBuilder(40); StringBuilder buf = new StringBuilder(40);
if (username != null) { if (username != null) {
username = username.toLowerCase();
buf.append(username).append("@"); buf.append(username).append("@");
} }
buf.append(domain); buf.append(domain);
...@@ -863,7 +862,6 @@ public class SessionManager extends BasicModule { ...@@ -863,7 +862,6 @@ public class SessionManager extends BasicModule {
session = anonymousSessions.get(resource); session = anonymousSessions.get(resource);
} }
else { else {
username = username.toLowerCase();
synchronized (username.intern()) { synchronized (username.intern()) {
SessionMap sessionMap = sessions.get(username); SessionMap sessionMap = sessions.get(username);
if (sessionMap != null) { if (sessionMap != null) {
...@@ -1218,7 +1216,7 @@ public class SessionManager extends BasicModule { ...@@ -1218,7 +1216,7 @@ public class SessionManager extends BasicModule {
else { else {
// If this is a non-anonymous session then remove the session from the SessionMap // If this is a non-anonymous session then remove the session from the SessionMap
if (session.getAddress() != null && session.getAddress().getNode() != null) { if (session.getAddress() != null && session.getAddress().getNode() != null) {
String username = session.getAddress().getNode().toLowerCase(); String username = session.getAddress().getNode();
synchronized (username.intern()) { synchronized (username.intern()) {
sessionMap = sessions.get(username); sessionMap = sessions.get(username);
if (sessionMap != null) { if (sessionMap != null) {
......
...@@ -238,7 +238,6 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler ...@@ -238,7 +238,6 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler
String name = update.getFrom().getNode(); String name = update.getFrom().getNode();
try { try {
if (name != null && !"".equals(name)) { if (name != null && !"".equals(name)) {
name = name.toLowerCase();
Roster roster = rosterManager.getRoster(name); Roster roster = rosterManager.getRoster(name);
roster.broadcastPresence(update); roster.broadcastPresence(update);
} }
...@@ -305,7 +304,6 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler ...@@ -305,7 +304,6 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler
WeakHashMap<ChannelHandler, Set<String>> map; WeakHashMap<ChannelHandler, Set<String>> map;
String name = update.getFrom().getNode(); String name = update.getFrom().getNode();
if (name != null && !"".equals(name)) { if (name != null && !"".equals(name)) {
name = name.toLowerCase();
try { try {
Roster roster = rosterManager.getRoster(name); Roster roster = rosterManager.getRoster(name);
// If the directed presence was sent to an entity that is not in the user's // If the directed presence was sent to an entity that is not in the user's
......
...@@ -67,7 +67,7 @@ public class MUCUserImpl implements MUCUser { ...@@ -67,7 +67,7 @@ public class MUCUserImpl implements MUCUser {
} }
public MUCRole getRole(String roomName) throws NotFoundException { public MUCRole getRole(String roomName) throws NotFoundException {
MUCRole role = roles.get(roomName.toLowerCase()); MUCRole role = roles.get(roomName);
if (role == null) { if (role == null) {
throw new NotFoundException(roomName); throw new NotFoundException(roomName);
} }
...@@ -79,11 +79,11 @@ public class MUCUserImpl implements MUCUser { ...@@ -79,11 +79,11 @@ public class MUCUserImpl implements MUCUser {
} }
public void addRole(String roomName, MUCRole role) { public void addRole(String roomName, MUCRole role) {
roles.put(roomName.toLowerCase(), role); roles.put(roomName, role);
} }
public void removeRole(String roomName) { public void removeRole(String roomName) {
roles.remove(roomName.toLowerCase()); roles.remove(roomName);
} }
public long getLastPacketTime() { public long getLastPacketTime() {
...@@ -157,7 +157,7 @@ public class MUCUserImpl implements MUCUser { ...@@ -157,7 +157,7 @@ public class MUCUserImpl implements MUCUser {
+ packet.toString()); + packet.toString());
} }
else { else {
MUCRole role = roles.get(group.toLowerCase()); MUCRole role = roles.get(group);
if (role == null) { if (role == null) {
if (server.hasChatRoom(group)) { if (server.hasChatRoom(group)) {
boolean declinedInvitation = false; boolean declinedInvitation = false;
...@@ -306,7 +306,7 @@ public class MUCUserImpl implements MUCUser { ...@@ -306,7 +306,7 @@ public class MUCUserImpl implements MUCUser {
+ packet.toString()); + packet.toString());
} }
else { else {
MUCRole role = roles.get(group.toLowerCase()); MUCRole role = roles.get(group);
if (role == null) { if (role == null) {
// TODO: send error message to user (can't send packets to group you haven't // TODO: send error message to user (can't send packets to group you haven't
// joined) // joined)
...@@ -382,7 +382,7 @@ public class MUCUserImpl implements MUCUser { ...@@ -382,7 +382,7 @@ public class MUCUserImpl implements MUCUser {
} }
} }
else { else {
MUCRole role = roles.get(group.toLowerCase()); MUCRole role = roles.get(group);
if (role == null) { if (role == null) {
// If we're not already in a room, we either are joining it or it's not // If we're not already in a room, we either are joining it or it's not
// properly addressed and we drop it silently // properly addressed and we drop it silently
......
...@@ -394,7 +394,7 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha ...@@ -394,7 +394,7 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha
public MUCRoom getChatRoom(String roomName, JID userjid) throws NotAllowedException { public MUCRoom getChatRoom(String roomName, JID userjid) throws NotAllowedException {
MUCRoom room = null; MUCRoom room = null;
synchronized (roomName.intern()) { synchronized (roomName.intern()) {
room = rooms.get(roomName.toLowerCase()); room = rooms.get(roomName);
if (room == null) { if (room == null) {
room = new MUCRoomImpl(this, roomName, router); room = new MUCRoomImpl(this, roomName, router);
// If the room is persistent load the configuration values from the DB // If the room is persistent load the configuration values from the DB
...@@ -418,18 +418,18 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha ...@@ -418,18 +418,18 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha
} }
room.addFirstOwner(userjid.toBareJID()); room.addFirstOwner(userjid.toBareJID());
} }
rooms.put(roomName.toLowerCase(), room); rooms.put(roomName, room);
} }
} }
return room; return room;
} }
public MUCRoom getChatRoom(String roomName) { public MUCRoom getChatRoom(String roomName) {
MUCRoom room = rooms.get(roomName.toLowerCase()); MUCRoom room = rooms.get(roomName);
if (room == null) { if (room == null) {
// Check if the room exists in the database and was not present in memory // Check if the room exists in the database and was not present in memory
synchronized (roomName.intern()) { synchronized (roomName.intern()) {
room = rooms.get(roomName.toLowerCase()); room = rooms.get(roomName);
if (room == null) { if (room == null) {
room = new MUCRoomImpl(this, roomName, router); room = new MUCRoomImpl(this, roomName, router);
// If the room is persistent load the configuration values from the DB // If the room is persistent load the configuration values from the DB
...@@ -438,7 +438,7 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha ...@@ -438,7 +438,7 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha
// persistent but was added to the DB after the server was started up or the // persistent but was added to the DB after the server was started up or the
// room may be an old room that was not present in memory) // room may be an old room that was not present in memory)
MUCPersistenceManager.loadFromDB((MUCRoomImpl) room); MUCPersistenceManager.loadFromDB((MUCRoomImpl) room);
rooms.put(roomName.toLowerCase(), room); rooms.put(roomName, room);
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
// The room does not exist so do nothing // The room does not exist so do nothing
...@@ -459,7 +459,7 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha ...@@ -459,7 +459,7 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha
} }
public void removeChatRoom(String roomName) { public void removeChatRoom(String roomName) {
final MUCRoom room = rooms.remove(roomName.toLowerCase()); final MUCRoom room = rooms.remove(roomName);
if (room != null) { if (room != null) {
totalChatTime += room.getChatLength(); totalChatTime += room.getChatLength();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment