浏览代码

Fix spotbugs with Alper

Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
Jonas Mayer 1 年之前
父节点
当前提交
1794015c1d

+ 1 - 2
app/src/main/java/com/nextcloud/client/jobs/upload/FileUploadWorker.kt

@@ -34,7 +34,6 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult
 import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode
 import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode
 import com.owncloud.android.lib.common.utils.Log_OC
 import com.owncloud.android.lib.common.utils.Log_OC
 import com.owncloud.android.operations.UploadFileOperation
 import com.owncloud.android.operations.UploadFileOperation
-import com.owncloud.android.operations.UploadFileOperation.uploadedSourcePath
 import com.owncloud.android.utils.ErrorMessageAdapter
 import com.owncloud.android.utils.ErrorMessageAdapter
 import com.owncloud.android.utils.theme.ViewThemeUtils
 import com.owncloud.android.utils.theme.ViewThemeUtils
 import java.io.File
 import java.io.File
@@ -238,7 +237,7 @@ class FileUploadWorker(
     }
     }
 
 
     private fun cleanupUploadProcess(result: RemoteOperationResult<Any?>, operation: UploadFileOperation) {
     private fun cleanupUploadProcess(result: RemoteOperationResult<Any?>, operation: UploadFileOperation) {
-        if (operation.originalStoragePath == uploadedSourcePath) {
+        if (operation.originalStoragePath == operation.uploadedSourcePath) {
             // TODO
             // TODO
             // This is not ideal fix. When uploading file to the encrypted folder server returns 404 FILE_NOT_FOUND
             // This is not ideal fix. When uploading file to the encrypted folder server returns 404 FILE_NOT_FOUND
             // However file upload successfully completed. This fix mimic success, if upload successfully completed with
             // However file upload successfully completed. This fix mimic success, if upload successfully completed with

+ 10 - 2
app/src/main/java/com/owncloud/android/operations/UploadFileOperation.java

@@ -998,11 +998,19 @@ public class UploadFileOperation extends SyncOperation {
         }
         }
     }
     }
 
 
-    public static String uploadedSourcePath;
+    private String uploadedSourcePath;
+
+    public String getUploadedSourcePath(){
+        return uploadedSourcePath;
+    }
+
+    public void setUploadedSourcePath(String uploadedSourcePath){
+        this.uploadedSourcePath = uploadedSourcePath;
+    }
 
 
     private void logResult(RemoteOperationResult result, String sourcePath, String targetPath) {
     private void logResult(RemoteOperationResult result, String sourcePath, String targetPath) {
         if (result.isSuccess()) {
         if (result.isSuccess()) {
-            uploadedSourcePath = sourcePath;
+            setUploadedSourcePath(sourcePath);
             Log_OC.i(TAG, "Upload of " + sourcePath + " to " + targetPath + ": " + result.getLogMessage());
             Log_OC.i(TAG, "Upload of " + sourcePath + " to " + targetPath + ": " + result.getLogMessage());
         } else {
         } else {
             if (result.getException() != null) {
             if (result.getException() != null) {