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); - } - } - } } /**