mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
Merged 5.2.N (5.2.1) to HEAD (5.2)
125775 rmunteanu: Merged 5.1.N (5.1.2) to 5.2.N (5.2.1) 125593 mward: ACE-5052: close stream git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@127802 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -123,9 +123,12 @@ public class FileWipingContentCleanerListener implements ContentStoreCleanerList
|
||||
throw new ContentIOException("Unable to write to file: " + file);
|
||||
}
|
||||
long bytes = file.length();
|
||||
OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
|
||||
OutputStream fos = null;
|
||||
OutputStream bos = null;
|
||||
try
|
||||
{
|
||||
fos = new FileOutputStream(file);
|
||||
bos = new BufferedOutputStream(fos);
|
||||
/*
|
||||
* There are many more efficient ways of writing bytes into the file.
|
||||
* However, it is likely that implementations will do a lot more than
|
||||
@@ -133,12 +136,19 @@ public class FileWipingContentCleanerListener implements ContentStoreCleanerList
|
||||
*/
|
||||
for (int i = 0; i < bytes; i++)
|
||||
{
|
||||
os.write(0);
|
||||
bos.write(0);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
try {os.close(); } catch (Throwable e) {}
|
||||
if (bos != null)
|
||||
{
|
||||
try {bos.close(); } catch (Throwable e) {}
|
||||
}
|
||||
if (fos != null)
|
||||
{
|
||||
fos.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user