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:
Graham Triggs
2008-08-07 09:21:47 +00:00
parent 6e611d8750
commit 3f3d806ad5
21 changed files with 737 additions and 508 deletions

View File

@@ -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();
}
}
/**