Commit d071514b authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Fixed NPE when a client used uppercase letters in the username. JM-124


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@908 b35dd754-fafc-0310-a699-88a17e54d16e
parent 27b95f81
...@@ -353,7 +353,8 @@ public class SessionManager extends BasicModule implements ConnectionCloseListen ...@@ -353,7 +353,8 @@ public class SessionManager extends BasicModule implements ConnectionCloseListen
// A non-anonymous session is now available // A non-anonymous session is now available
Session defaultSession = null; Session defaultSession = null;
try { try {
defaultSession = sessions.get(session.getUsername()).getDefaultSession(true); String username = session.getUsername().toLowerCase();
defaultSession = sessions.get(username).getDefaultSession(true);
JID node = new JID(defaultSession.getAddress().getNode(), JID node = new JID(defaultSession.getAddress().getNode(),
defaultSession.getAddress().getDomain(), null); defaultSession.getAddress().getDomain(), null);
// Add route to default session (used when no resource is specified) // Add route to default session (used when no resource is specified)
...@@ -383,7 +384,8 @@ public class SessionManager extends BasicModule implements ConnectionCloseListen ...@@ -383,7 +384,8 @@ public class SessionManager extends BasicModule implements ConnectionCloseListen
// Remove route to the removed session (anonymous or not) // Remove route to the removed session (anonymous or not)
routingTable.removeRoute(session.getAddress()); routingTable.removeRoute(session.getAddress());
try { try {
SessionMap sessionMap = sessions.get(session.getUsername()); String username = session.getUsername().toLowerCase();
SessionMap sessionMap = sessions.get(username);
// If sessionMap is null, which is an irregular case, try to clean up the routes to // If sessionMap is null, which is an irregular case, try to clean up the routes to
// the user from the routing table // the user from the routing table
if (sessionMap == null) { if (sessionMap == null) {
......
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