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:
Raluca Munteanu
2016-04-26 14:21:57 +00:00
parent f66e5bcb4f
commit 5ad2a0e334
2 changed files with 2 additions and 32 deletions

View File

@@ -210,7 +210,6 @@ 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
@@ -222,7 +221,7 @@ public class FileContentReader extends AbstractContentReader
ReadableByteChannel channel = null; ReadableByteChannel channel = null;
if (allowRandomAccess) if (allowRandomAccess)
{ {
randomAccessFile = new RandomAccessFile(file, "r"); // won't create it RandomAccessFile randomAccessFile = new RandomAccessFile(file, "r"); // won't create it
channel = randomAccessFile.getChannel(); channel = randomAccessFile.getChannel();
} }
else else
@@ -243,20 +242,6 @@ 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);
}
}
}
} }
/** /**

View File

@@ -139,7 +139,6 @@ public class FileContentWriter extends AbstractContentWriter
@Override @Override
protected WritableByteChannel getDirectWritableChannel() throws ContentIOException protected WritableByteChannel getDirectWritableChannel() throws ContentIOException
{ {
RandomAccessFile randomAccessFile = null;
try try
{ {
// we may not write to an existing file - EVER!! // we may not write to an existing file - EVER!!
@@ -151,7 +150,7 @@ public class FileContentWriter extends AbstractContentWriter
WritableByteChannel channel = null; WritableByteChannel channel = null;
if (allowRandomAccess) if (allowRandomAccess)
{ {
randomAccessFile = new RandomAccessFile(file, "rw"); // will create it RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw"); // will create it
channel = randomAccessFile.getChannel(); channel = randomAccessFile.getChannel();
} }
else else
@@ -172,20 +171,6 @@ public class FileContentWriter extends AbstractContentWriter
{ {
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);
}
}
}
} }
/** /**