mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
125702 mward: ACE-5052: backed out r125594:125595 Closing the file results in the channel being closed, so we can't do that. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125797 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -210,7 +210,6 @@ public class FileContentReader extends AbstractContentReader
|
||||
@Override
|
||||
protected ReadableByteChannel getDirectReadableChannel() throws ContentIOException
|
||||
{
|
||||
RandomAccessFile randomAccessFile = null;
|
||||
try
|
||||
{
|
||||
// the file must exist
|
||||
@@ -222,7 +221,7 @@ public class FileContentReader extends AbstractContentReader
|
||||
ReadableByteChannel channel = null;
|
||||
if (allowRandomAccess)
|
||||
{
|
||||
randomAccessFile = new RandomAccessFile(file, "r"); // won't create it
|
||||
RandomAccessFile randomAccessFile = new RandomAccessFile(file, "r"); // won't create it
|
||||
channel = randomAccessFile.getChannel();
|
||||
}
|
||||
else
|
||||
@@ -243,20 +242,6 @@ public class FileContentReader extends AbstractContentReader
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -139,7 +139,6 @@ public class FileContentWriter extends AbstractContentWriter
|
||||
@Override
|
||||
protected WritableByteChannel getDirectWritableChannel() throws ContentIOException
|
||||
{
|
||||
RandomAccessFile randomAccessFile = null;
|
||||
try
|
||||
{
|
||||
// we may not write to an existing file - EVER!!
|
||||
@@ -151,7 +150,7 @@ public class FileContentWriter extends AbstractContentWriter
|
||||
WritableByteChannel channel = null;
|
||||
if (allowRandomAccess)
|
||||
{
|
||||
randomAccessFile = new RandomAccessFile(file, "rw"); // will create it
|
||||
RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw"); // will create it
|
||||
channel = randomAccessFile.getChannel();
|
||||
}
|
||||
else
|
||||
@@ -172,20 +171,6 @@ public class FileContentWriter extends AbstractContentWriter
|
||||
{
|
||||
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