Commit c532f7d7 authored by guus's avatar guus

OF-376: Illegal persisted data should not cause startup failure.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@11766 b35dd754-fafc-0310-a699-88a17e54d16e
parent 8065d2ea
...@@ -542,13 +542,33 @@ public class MUCPersistenceManager { ...@@ -542,13 +542,33 @@ public class MUCPersistenceManager {
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) { while (rs.next()) {
long roomID = rs.getLong(1); long roomID = rs.getLong(1);
JID jid = new JID(rs.getString(2));
MUCRole.Affiliation affiliation = MUCRole.Affiliation.valueOf(rs.getInt(3));
LocalMUCRoom room = rooms.get(roomID); LocalMUCRoom room = rooms.get(roomID);
// Skip to the next position if the room does not exist // Skip to the next position if the room does not exist
if (room == null) { if (room == null) {
continue; continue;
} }
final MUCRole.Affiliation affiliation = MUCRole.Affiliation.valueOf(rs.getInt(3));
final String jidValue = rs.getString(2);
final JID jid;
try {
jid = new JID(jidValue);
} catch (IllegalArgumentException ex) {
Log.warn("An illegal JID ({}) was found in the database, "
+ "while trying to load all affiliations for room "
+ "{} on the MUC service {}. An attempt is made to"
+ " delete the associated affiliation. The JID is"
+ " otherwise ignored.", new Object[] { jidValue,
roomID, chatserver.getName() });
try {
removeAffiliationFromDB(room, jidValue, affiliation);
Log.warn("Affiliation removed.");
} catch (RuntimeException e) {
Log.warn("Unable to remove affiliation.", e);
}
continue;
}
try { try {
switch (affiliation) { switch (affiliation) {
case owner: case owner:
......
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