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:
@@ -278,13 +278,19 @@ public class MetadataValue
|
||||
valueId);
|
||||
|
||||
TableRow row = null;
|
||||
if (tri.hasNext())
|
||||
try
|
||||
{
|
||||
row = tri.next();
|
||||
if (tri.hasNext())
|
||||
{
|
||||
row = tri.next();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
tri.close();
|
||||
}
|
||||
|
||||
// close the TableRowIterator to free up resources
|
||||
tri.close();
|
||||
|
||||
if (row == null)
|
||||
{
|
||||
@@ -316,14 +322,20 @@ public class MetadataValue
|
||||
|
||||
TableRow row = null;
|
||||
java.util.Collection ret = new ArrayList();
|
||||
while (tri.hasNext())
|
||||
try
|
||||
{
|
||||
row = tri.next();
|
||||
ret.add(new MetadataValue(row));
|
||||
while (tri.hasNext())
|
||||
{
|
||||
row = tri.next();
|
||||
ret.add(new MetadataValue(row));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
tri.close();
|
||||
}
|
||||
|
||||
// close the TableRowIterator to free up resources
|
||||
tri.close();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user