Commit 1de45b87 authored by Günther Niess's avatar Günther Niess Committed by niess

OF-41: Fix StringIndexOutOfBoundsException for room affiliations page

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@11191 b35dd754-fafc-0310-a699-88a17e54d16e
parent ef23bf44
...@@ -231,9 +231,15 @@ ...@@ -231,9 +231,15 @@
ArrayList<String> owners = new ArrayList<String>(room.getOwners()); ArrayList<String> owners = new ArrayList<String>(room.getOwners());
Collections.sort(owners); Collections.sort(owners);
for (String user : owners) { for (String user : owners) {
String userDisplay;
if (user.indexOf('@') > 0) {
String username = JID.unescapeNode(user.substring(0, user.indexOf('@'))); String username = JID.unescapeNode(user.substring(0, user.indexOf('@')));
String rest = user.substring(user.indexOf('@'), user.length()); String rest = user.substring(user.indexOf('@'), user.length());
String userDisplay = username + rest; userDisplay = username + rest;
}
else {
userDisplay = user;
}
%> %>
<tr> <tr>
...@@ -265,9 +271,15 @@ ...@@ -265,9 +271,15 @@
ArrayList<String> admins = new ArrayList<String>(room.getAdmins()); ArrayList<String> admins = new ArrayList<String>(room.getAdmins());
Collections.sort(admins); Collections.sort(admins);
for (String user : admins) { for (String user : admins) {
String userDisplay;
if (user.indexOf('@') > 0) {
String username = JID.unescapeNode(user.substring(0, user.indexOf('@'))); String username = JID.unescapeNode(user.substring(0, user.indexOf('@')));
String rest = user.substring(user.indexOf('@'), user.length()); String rest = user.substring(user.indexOf('@'), user.length());
String userDisplay = username + rest; userDisplay = username + rest;
}
else {
userDisplay = user;
}
%> %>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
...@@ -298,9 +310,15 @@ ...@@ -298,9 +310,15 @@
ArrayList<String> members = new ArrayList<String>(room.getMembers()); ArrayList<String> members = new ArrayList<String>(room.getMembers());
Collections.sort(members); Collections.sort(members);
for (String user : members) { for (String user : members) {
String userDisplay;
if (user.indexOf('@') > 0) {
String username = JID.unescapeNode(user.substring(0, user.indexOf('@'))); String username = JID.unescapeNode(user.substring(0, user.indexOf('@')));
String rest = user.substring(user.indexOf('@'), user.length()); String rest = user.substring(user.indexOf('@'), user.length());
String userDisplay = username + rest; userDisplay = username + rest;
}
else {
userDisplay = user;
}
String nickname = room.getReservedNickname(user); String nickname = room.getReservedNickname(user);
nickname = (nickname == null ? "" : " (" + nickname + ")"); nickname = (nickname == null ? "" : " (" + nickname + ")");
...@@ -334,9 +352,15 @@ ...@@ -334,9 +352,15 @@
ArrayList<String> outcasts = new ArrayList<String>(room.getOutcasts()); ArrayList<String> outcasts = new ArrayList<String>(room.getOutcasts());
Collections.sort(outcasts); Collections.sort(outcasts);
for (String user : outcasts) { for (String user : outcasts) {
String userDisplay;
if (user.indexOf('@') > 0) {
String username = JID.unescapeNode(user.substring(0, user.indexOf('@'))); String username = JID.unescapeNode(user.substring(0, user.indexOf('@')));
String rest = user.substring(user.indexOf('@'), user.length()); String rest = user.substring(user.indexOf('@'), user.length());
String userDisplay = username + rest; userDisplay = username + rest;
}
else {
userDisplay = user;
}
%> %>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
......
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