mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-5347: Resources should be closed
This commit is contained in:
@@ -774,11 +774,13 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
|
|||||||
ParameterCheck.mandatory("params", params);
|
ParameterCheck.mandatory("params", params);
|
||||||
|
|
||||||
Writer fileWriter = null;
|
Writer fileWriter = null;
|
||||||
|
FileOutputStream fileOutputStream = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File auditTrailFile = TempFileProvider.createTempFile(AUDIT_TRAIL_FILE_PREFIX,
|
File auditTrailFile = TempFileProvider.createTempFile(AUDIT_TRAIL_FILE_PREFIX,
|
||||||
format == ReportFormat.HTML ? AUDIT_TRAIL_HTML_FILE_SUFFIX : AUDIT_TRAIL_JSON_FILE_SUFFIX);
|
format == ReportFormat.HTML ? AUDIT_TRAIL_HTML_FILE_SUFFIX : AUDIT_TRAIL_JSON_FILE_SUFFIX);
|
||||||
fileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(auditTrailFile),"UTF8"));
|
fileOutputStream = new FileOutputStream(auditTrailFile);
|
||||||
|
fileWriter = new BufferedWriter(new OutputStreamWriter(fileOutputStream,"UTF8"));
|
||||||
// Get the results, dumping to file
|
// Get the results, dumping to file
|
||||||
getAuditTrailImpl(params, null, fileWriter, format);
|
getAuditTrailImpl(params, null, fileWriter, format);
|
||||||
// Done
|
// Done
|
||||||
@@ -790,6 +792,11 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
// close the file output stream
|
||||||
|
if (fileOutputStream != null)
|
||||||
|
{
|
||||||
|
try { fileOutputStream.close(); } catch (IOException closeEx) {}
|
||||||
|
}
|
||||||
// close the writer
|
// close the writer
|
||||||
if (fileWriter != null)
|
if (fileWriter != null)
|
||||||
{
|
{
|
||||||
|
@@ -127,6 +127,7 @@ public class TransferReportGet extends BaseTransferWebScript
|
|||||||
{
|
{
|
||||||
File report = TempFileProvider.createTempFile(REPORT_FILE_PREFIX, REPORT_FILE_SUFFIX);
|
File report = TempFileProvider.createTempFile(REPORT_FILE_PREFIX, REPORT_FILE_SUFFIX);
|
||||||
Writer writer = null;
|
Writer writer = null;
|
||||||
|
FileOutputStream fileOutputStream = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// get all 'transferred' nodes
|
// get all 'transferred' nodes
|
||||||
@@ -139,7 +140,8 @@ public class TransferReportGet extends BaseTransferWebScript
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create the writer
|
// create the writer
|
||||||
writer = new OutputStreamWriter(new FileOutputStream(report), Charset.forName("UTF-8"));
|
fileOutputStream = new FileOutputStream(report);
|
||||||
|
writer = new OutputStreamWriter(fileOutputStream, Charset.forName("UTF-8"));
|
||||||
|
|
||||||
// use RMService to get disposition authority
|
// use RMService to get disposition authority
|
||||||
String dispositionAuthority = null;
|
String dispositionAuthority = null;
|
||||||
@@ -172,6 +174,10 @@ public class TransferReportGet extends BaseTransferWebScript
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
if (fileOutputStream != null)
|
||||||
|
{
|
||||||
|
try { fileOutputStream.close(); } catch (IOException ioe) {}
|
||||||
|
}
|
||||||
if (writer != null)
|
if (writer != null)
|
||||||
{
|
{
|
||||||
try { writer.close(); } catch (IOException ioe) {}
|
try { writer.close(); } catch (IOException ioe) {}
|
||||||
|
@@ -235,6 +235,7 @@ public class TransferReportPost extends BaseTransferWebScript
|
|||||||
{
|
{
|
||||||
File report = TempFileProvider.createTempFile(REPORT_FILE_PREFIX, REPORT_FILE_SUFFIX);
|
File report = TempFileProvider.createTempFile(REPORT_FILE_PREFIX, REPORT_FILE_SUFFIX);
|
||||||
Writer writer = null;
|
Writer writer = null;
|
||||||
|
FileOutputStream fileOutputStream = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// get all 'transferred' nodes
|
// get all 'transferred' nodes
|
||||||
@@ -247,7 +248,8 @@ public class TransferReportPost extends BaseTransferWebScript
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create the writer
|
// create the writer
|
||||||
writer = new OutputStreamWriter(new FileOutputStream(report), Charset.forName("UTF-8"));
|
fileOutputStream = new FileOutputStream(report);
|
||||||
|
writer = new OutputStreamWriter(fileOutputStream, Charset.forName("UTF-8"));
|
||||||
|
|
||||||
// use RMService to get disposition authority
|
// use RMService to get disposition authority
|
||||||
String dispositionAuthority = null;
|
String dispositionAuthority = null;
|
||||||
@@ -324,6 +326,10 @@ public class TransferReportPost extends BaseTransferWebScript
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
if (fileOutputStream != null)
|
||||||
|
{
|
||||||
|
try { fileOutputStream.close(); } catch (IOException ioe) {}
|
||||||
|
}
|
||||||
if (writer != null)
|
if (writer != null)
|
||||||
{
|
{
|
||||||
try { writer.close(); } catch (IOException ioe) {}
|
try { writer.close(); } catch (IOException ioe) {}
|
||||||
|
Reference in New Issue
Block a user