Commit 0c02018c authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Fixed error loading room history using MS-SQL. JM-299


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/branches/jive_messenger_2_1_branch@1472 b35dd754-fafc-0310-a699-88a17e54d16e
parent 54e95f9f
...@@ -199,12 +199,16 @@ public class MUCPersistenceManager { ...@@ -199,12 +199,16 @@ public class MUCPersistenceManager {
pstmt.setLong(2, room.getID()); pstmt.setLong(2, room.getID());
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) { while (rs.next()) {
String senderJID = rs.getString(1);
String nickname = rs.getString(2);
Date sentDate = new Date(Long.parseLong(rs.getString(3).trim())); Date sentDate = new Date(Long.parseLong(rs.getString(3).trim()));
String subject = rs.getString(4);
String body = rs.getString(5);
// Recreate the history only for the rooms that have the conversation logging // Recreate the history only for the rooms that have the conversation logging
// enabled // enabled
if (room.isLogEnabled()) { if (room.isLogEnabled()) {
room.getRoomHistory().addOldMessage(rs.getString(1), rs.getString(2), sentDate, room.getRoomHistory().addOldMessage(senderJID, nickname, sentDate, subject,
rs.getString(4), rs.getString(5)); body);
} }
} }
rs.close(); rs.close();
...@@ -466,13 +470,17 @@ public class MUCPersistenceManager { ...@@ -466,13 +470,17 @@ public class MUCPersistenceManager {
if (room == null) { if (room == null) {
continue; continue;
} }
String senderJID = rs.getString(2);
String nickname = rs.getString(3);
Date sentDate = new Date(Long.parseLong(rs.getString(4).trim())); Date sentDate = new Date(Long.parseLong(rs.getString(4).trim()));
String subject = rs.getString(5);
String body = rs.getString(6);
try { try {
// Recreate the history only for the rooms that have the conversation logging // Recreate the history only for the rooms that have the conversation logging
// enabled // enabled
if (room.isLogEnabled()) { if (room.isLogEnabled()) {
room.getRoomHistory().addOldMessage(rs.getString(2), rs.getString(3), room.getRoomHistory().addOldMessage(senderJID, nickname, sentDate, subject,
sentDate, rs.getString(5), rs.getString(6)); body);
} }
} }
catch (Exception e) { catch (Exception e) {
......
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