Commit 952f0fa9 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Fixed loading group description (JM-111).


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@826 b35dd754-fafc-0310-a699-88a17e54d16e
parent ead024c0
...@@ -26,7 +26,7 @@ import java.util.Collection; ...@@ -26,7 +26,7 @@ import java.util.Collection;
/** /**
* Database implementation of the GroupManager interface. * Database implementation of the GroupManager interface.
* *
* @author Iain Shigeoka * @author Matt Tucker
*/ */
public class DefaultGroupProvider implements GroupProvider { public class DefaultGroupProvider implements GroupProvider {
...@@ -49,7 +49,7 @@ public class DefaultGroupProvider implements GroupProvider { ...@@ -49,7 +49,7 @@ public class DefaultGroupProvider implements GroupProvider {
"SELECT username FROM jiveGroupUser WHERE administrator=1 AND groupName=?"; "SELECT username FROM jiveGroupUser WHERE administrator=1 AND groupName=?";
private static final String LOAD_MEMBERS = private static final String LOAD_MEMBERS =
"SELECT username FROM jiveGroupUser WHERE administrator=0 AND groupName=?"; "SELECT username FROM jiveGroupUser WHERE administrator=0 AND groupName=?";
private static final String SELECT_GROUP_BY_NAME = private static final String LOAD_GROUP =
"SELECT description FROM jiveGroup WHERE groupName=?"; "SELECT description FROM jiveGroup WHERE groupName=?";
private static final String REMOVE_USER = private static final String REMOVE_USER =
"DELETE FROM jiveGroupUser WHERE groupName=? AND username=?"; "DELETE FROM jiveGroupUser WHERE groupName=? AND username=?";
...@@ -90,17 +90,15 @@ public class DefaultGroupProvider implements GroupProvider { ...@@ -90,17 +90,15 @@ public class DefaultGroupProvider implements GroupProvider {
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try { try {
con = DbConnectionManager.getConnection(); con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(SELECT_GROUP_BY_NAME); pstmt = con.prepareStatement(LOAD_GROUP);
pstmt.setString(1, name); pstmt.setString(1, name);
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
if (!rs.next()) { if (!rs.next()) {
throw new GroupNotFoundException("Group with name " throw new GroupNotFoundException("Group with name "
+ name + " not found."); + name + " not found.");
} }
if (rs.next()) {
description = rs.getString(1); description = rs.getString(1);
} }
}
catch (SQLException e) { catch (SQLException e) {
Log.error(e); Log.error(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