mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 23:13:10 +00:00
Add missing close() calls to use of TableRowIterator, also add close() to ItemIterator (to close underlying TableRowIterator)
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@3038 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -776,29 +776,37 @@ public class Group extends DSpaceObject
|
||||
context, "epersongroup",
|
||||
"SELECT * FROM epersongroup ORDER BY "+s);
|
||||
|
||||
List gRows = rows.toList();
|
||||
|
||||
Group[] groups = new Group[gRows.size()];
|
||||
|
||||
for (int i = 0; i < gRows.size(); i++)
|
||||
try
|
||||
{
|
||||
TableRow row = (TableRow) gRows.get(i);
|
||||
List gRows = rows.toList();
|
||||
|
||||
// First check the cache
|
||||
Group fromCache = (Group) context.fromCache(Group.class, row
|
||||
.getIntColumn("eperson_group_id"));
|
||||
Group[] groups = new Group[gRows.size()];
|
||||
|
||||
if (fromCache != null)
|
||||
for (int i = 0; i < gRows.size(); i++)
|
||||
{
|
||||
groups[i] = fromCache;
|
||||
}
|
||||
else
|
||||
{
|
||||
groups[i] = new Group(context, row);
|
||||
TableRow row = (TableRow) gRows.get(i);
|
||||
|
||||
// First check the cache
|
||||
Group fromCache = (Group) context.fromCache(Group.class, row
|
||||
.getIntColumn("eperson_group_id"));
|
||||
|
||||
if (fromCache != null)
|
||||
{
|
||||
groups[i] = fromCache;
|
||||
}
|
||||
else
|
||||
{
|
||||
groups[i] = new Group(context, row);
|
||||
}
|
||||
}
|
||||
|
||||
return groups;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (rows != null)
|
||||
rows.close();
|
||||
}
|
||||
|
||||
return groups;
|
||||
}
|
||||
|
||||
|
||||
@@ -896,28 +904,36 @@ public class Group extends DSpaceObject
|
||||
|
||||
TableRowIterator rows =
|
||||
DatabaseManager.query(context, dbquery, paramArr);
|
||||
|
||||
List groupRows = rows.toList();
|
||||
Group[] groups = new Group[groupRows.size()];
|
||||
|
||||
for (int i = 0; i < groupRows.size(); i++)
|
||||
{
|
||||
TableRow row = (TableRow) groupRows.get(i);
|
||||
|
||||
// First check the cache
|
||||
Group fromCache = (Group) context.fromCache(Group.class, row
|
||||
.getIntColumn("eperson_group_id"));
|
||||
|
||||
if (fromCache != null)
|
||||
{
|
||||
groups[i] = fromCache;
|
||||
}
|
||||
else
|
||||
{
|
||||
groups[i] = new Group(context, row);
|
||||
}
|
||||
}
|
||||
return groups;
|
||||
|
||||
try
|
||||
{
|
||||
List groupRows = rows.toList();
|
||||
Group[] groups = new Group[groupRows.size()];
|
||||
|
||||
for (int i = 0; i < groupRows.size(); i++)
|
||||
{
|
||||
TableRow row = (TableRow) groupRows.get(i);
|
||||
|
||||
// First check the cache
|
||||
Group fromCache = (Group) context.fromCache(Group.class, row
|
||||
.getIntColumn("eperson_group_id"));
|
||||
|
||||
if (fromCache != null)
|
||||
{
|
||||
groups[i] = fromCache;
|
||||
}
|
||||
else
|
||||
{
|
||||
groups[i] = new Group(context, row);
|
||||
}
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (rows != null)
|
||||
rows.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user