From 5ad2a0e3345fb2a09e11cb855f9a812091838a89 Mon Sep 17 00:00:00 2001 From: Raluca Munteanu Date: Tue, 26 Apr 2016 14:21:57 +0000 Subject: [PATCH] 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 --- .../content/filestore/FileContentReader.java | 17 +---------------- .../content/filestore/FileContentWriter.java | 17 +---------------- 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/source/java/org/alfresco/repo/content/filestore/FileContentReader.java b/source/java/org/alfresco/repo/content/filestore/FileContentReader.java index 2ae51af1df..74c15ffdf6 100644 --- a/source/java/org/alfresco/repo/content/filestore/FileContentReader.java +++ b/source/java/org/alfresco/repo/content/filestore/FileContentReader.java @@ -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); - } - } - } } /** diff --git a/source/java/org/alfresco/repo/content/filestore/FileContentWriter.java b/source/java/org/alfresco/repo/content/filestore/FileContentWriter.java index e015e400c7..6ff2a59f22 100644 --- a/source/java/org/alfresco/repo/content/filestore/FileContentWriter.java +++ b/source/java/org/alfresco/repo/content/filestore/FileContentWriter.java @@ -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); - } - } - } } /**