mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 21:43:11 +00:00
(Scott Phillips) Fixed a bug where each time a collection export was generated a database connection would be leaked.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@3483 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -48,6 +48,7 @@ import java.io.FileWriter;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.sql.SQLException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@@ -830,7 +831,7 @@ public class ItemExport
|
|||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
Context context;
|
Context context = null;
|
||||||
ItemIterator iitems = null;
|
ItemIterator iitems = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -888,6 +889,13 @@ public class ItemExport
|
|||||||
{
|
{
|
||||||
if (iitems != null)
|
if (iitems != null)
|
||||||
iitems.close();
|
iitems.close();
|
||||||
|
|
||||||
|
// Make sure the database connection gets closed in all conditions.
|
||||||
|
try {
|
||||||
|
context.complete();
|
||||||
|
} catch (SQLException sqle) {
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user