mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-12 04:23:13 +00:00
Fix various problems with resources potentially not being freed, and other minor fixes suggested by FindBugs
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@3036 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -581,27 +581,32 @@ public class Bitstream extends DSpaceObject
|
||||
|
||||
// Build a list of Bundle objects
|
||||
List<Bundle> bundles = new ArrayList<Bundle>();
|
||||
|
||||
while (tri.hasNext())
|
||||
try
|
||||
{
|
||||
TableRow r = tri.next();
|
||||
|
||||
// First check the cache
|
||||
Bundle fromCache = (Bundle) bContext.fromCache(Bundle.class, r
|
||||
.getIntColumn("bundle_id"));
|
||||
|
||||
if (fromCache != null)
|
||||
while (tri.hasNext())
|
||||
{
|
||||
bundles.add(fromCache);
|
||||
}
|
||||
else
|
||||
{
|
||||
bundles.add(new Bundle(bContext, r));
|
||||
TableRow r = tri.next();
|
||||
|
||||
// First check the cache
|
||||
Bundle fromCache = (Bundle) bContext.fromCache(Bundle.class, r
|
||||
.getIntColumn("bundle_id"));
|
||||
|
||||
if (fromCache != null)
|
||||
{
|
||||
bundles.add(fromCache);
|
||||
}
|
||||
else
|
||||
{
|
||||
bundles.add(new Bundle(bContext, r));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// close the TableRowIterator to free up resources
|
||||
tri.close();
|
||||
finally
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
tri.close();
|
||||
}
|
||||
|
||||
Bundle[] bundleArray = new Bundle[bundles.size()];
|
||||
bundleArray = (Bundle[]) bundles.toArray(bundleArray);
|
||||
|
Reference in New Issue
Block a user