mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
ACE-5052: close file
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@125594 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -203,6 +203,7 @@ public class FileContentReader extends AbstractContentReader
|
|||||||
@Override
|
@Override
|
||||||
protected ReadableByteChannel getDirectReadableChannel() throws ContentIOException
|
protected ReadableByteChannel getDirectReadableChannel() throws ContentIOException
|
||||||
{
|
{
|
||||||
|
RandomAccessFile randomAccessFile = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// the file must exist
|
// the file must exist
|
||||||
@@ -214,7 +215,7 @@ public class FileContentReader extends AbstractContentReader
|
|||||||
ReadableByteChannel channel = null;
|
ReadableByteChannel channel = null;
|
||||||
if (allowRandomAccess)
|
if (allowRandomAccess)
|
||||||
{
|
{
|
||||||
RandomAccessFile randomAccessFile = new RandomAccessFile(file, "r"); // won't create it
|
randomAccessFile = new RandomAccessFile(file, "r"); // won't create it
|
||||||
channel = randomAccessFile.getChannel();
|
channel = randomAccessFile.getChannel();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -235,6 +236,20 @@ public class FileContentReader extends AbstractContentReader
|
|||||||
{
|
{
|
||||||
throw new ContentIOException("Failed to open file channel: " + this, e);
|
throw new ContentIOException("Failed to open file channel: " + this, e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (randomAccessFile != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
randomAccessFile.close();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
logger.error("Problem while closing file.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user