From 7d73d45556370b7e3e0483a835d04007f8d6cba7 Mon Sep 17 00:00:00 2001 From: Jonas Mayer Date: Fri, 26 Jan 2024 18:55:41 +0100 Subject: [PATCH] Fix spotbugs Signed-off-by: Jonas Mayer --- .../owncloud/android/datamodel/UploadsStorageManager.java | 4 ++-- .../owncloud/android/operations/UploadFileOperation.java | 7 +++---- .../com/owncloud/android/ui/adapter/UploadListAdapter.java | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java b/app/src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java index f6fe722d5dc4..3a7e577b192c 100644 --- a/app/src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java +++ b/app/src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java @@ -739,7 +739,7 @@ public void updateDatabaseUploadResult(RemoteOperationResult uploadResult, Uploa upload.getRemotePath(), localPath ); - } else if (uploadResult.getCode().equals(RemoteOperationResult.ResultCode.SYNC_CONFLICT) && + } else if (uploadResult.getCode() == RemoteOperationResult.ResultCode.SYNC_CONFLICT && new FilesUploadHelper().isSameFileOnRemote( upload.getUser(), new File(upload.getStoragePath()), upload.getRemotePath(), upload.getContext())) { @@ -750,7 +750,7 @@ public void updateDatabaseUploadResult(RemoteOperationResult uploadResult, Uploa upload.getRemotePath(), localPath ); - } else if (uploadResult.getCode().equals(RemoteOperationResult.ResultCode.LOCAL_FILE_NOT_FOUND)) { + } else if (uploadResult.getCode() == RemoteOperationResult.ResultCode.LOCAL_FILE_NOT_FOUND) { updateUploadStatus( upload.getOCUploadId(), UploadStatus.UPLOAD_SUCCEEDED, diff --git a/app/src/main/java/com/owncloud/android/operations/UploadFileOperation.java b/app/src/main/java/com/owncloud/android/operations/UploadFileOperation.java index 42650e2a026e..69eb593631eb 100644 --- a/app/src/main/java/com/owncloud/android/operations/UploadFileOperation.java +++ b/app/src/main/java/com/owncloud/android/operations/UploadFileOperation.java @@ -532,7 +532,7 @@ private RemoteOperationResult encryptedUpload(OwnCloudClient client, OCFile pare } } - RemoteOperationResult collisionResult = checkNameCollision(client, fileNames, parentFile.isEncrypted(),originalFile); + RemoteOperationResult collisionResult = checkNameCollision(client, fileNames, parentFile.isEncrypted()); if (collisionResult != null) { result = collisionResult; return collisionResult; @@ -849,7 +849,7 @@ private RemoteOperationResult normalUpload(OwnCloudClient client) { } // check name collision - RemoteOperationResult collisionResult = checkNameCollision(client, null, false, originalFile); + RemoteOperationResult collisionResult = checkNameCollision(client, null, false); if (collisionResult != null) { result = collisionResult; return collisionResult; @@ -1038,8 +1038,7 @@ private RemoteOperationResult copyFile(File originalFile, String expectedPath) t @CheckResult private RemoteOperationResult checkNameCollision(OwnCloudClient client, List fileNames, - boolean encrypted, - File originalFile) + boolean encrypted) throws OperationCancelledException { Log_OC.d(TAG, "Checking name collision in server"); diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java b/app/src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java index 75aa1f63b543..1c67e1153b75 100755 --- a/app/src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java +++ b/app/src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java @@ -308,7 +308,7 @@ public void onBindViewHolder(SectionedViewHolder holder, int section, int relati } // show status if same file conflict or local file deleted - if (item.getUploadStatus().equals(UploadStatus.UPLOAD_SUCCEEDED) && + if (item.getUploadStatus() == UploadStatus.UPLOAD_SUCCEEDED && item.getLastResult() != UploadResult.UPLOADED){ itemViewHolder.binding.uploadStatus.setVisibility(View.VISIBLE); itemViewHolder.binding.uploadStatus.setTypeface(null, Typeface.BOLD);