Skip to content

Commit e94ad28

Browse files
committed
fix try with resources statements
Signed-off-by: Alex Knop <[email protected]>
1 parent 0af8dc7 commit e94ad28

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/src/main/java/com/owncloud/android/operations/UploadFileOperation.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,8 @@ private RemoteOperationResult normalUpload(OwnCloudClient client) {
982982
final Long creationTimestamp = FileUtil.getCreationTimestamp(originalFile);
983983

984984
// Initialize channel and fileLock in try-with-resources
985-
try (RandomAccessFile randomAccessFile = new RandomAccessFile(mFile.getStoragePath(), "rw");
985+
try (
986+
RandomAccessFile randomAccessFile = new RandomAccessFile(mFile.getStoragePath(), "rw");
986987
FileChannel channel = randomAccessFile.getChannel();
987988
FileLock fileLock = channel.tryLock()
988989
) {
@@ -998,9 +999,10 @@ private RemoteOperationResult normalUpload(OwnCloudClient client) {
998999
if (result.isSuccess()) {
9991000
if (temporalFile.length() == originalFile.length()) {
10001001
// Acquire lock on temporary file
1001-
try (RandomAccessFile randomAccessTemporalFile = new RandomAccessFile(temporalFile.getAbsolutePath(), "rw");
1002+
try (
1003+
RandomAccessFile randomAccessTemporalFile = new RandomAccessFile(temporalFile.getAbsolutePath(), "rw");
10021004
FileChannel tempChannel = randomAccessTemporalFile.getChannel();
1003-
FileLock tempFileLock = tempChannel.tryLock()) {
1005+
FileLock tempFileLock = tempChannel.tryLock()) {
10041006
if (tempFileLock != null) {
10051007
// Use the temporary channel for the upload
10061008
size = tempChannel.size();

0 commit comments

Comments
 (0)