fix UsersGroups.getGroupsFromDB() to always commit.
@@ -259,6 +259,7 @@ public static String getGroup(final int groupId) throws IOException {
(UsersOperationsType.GET_USER_GROUPS) {
@Override
public Object performTask() throws StorageException, IOException {
+ Pair<User, List<Group>> result = null;
boolean transactionActive = connector.isTransactionActive();
if (!transactionActive) {
@@ -269,17 +270,15 @@ public Object performTask() throws StorageException, IOException {
User user = userId == null ? userDataAccess.getUser(userName) :
userDataAccess.getUser(userId);
- if (user == null) {
- return null;
- }
-
+ if (user != null) {
List<Group> groups = userGroupDataAccess.getGroupsForUser(user.getId());
-
+ result = new Pair<User, List<Group>>(user, groups);
+ }
if (!transactionActive) {
connector.commit();
}
- return new Pair<User, List<Group>>(user, groups);
+ return result;
}
};
