Browse Source

codacy: Assigning an Object to null is a code smell.

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 4 years ago
parent
commit
553699a095

+ 5 - 6
src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java

@@ -1782,14 +1782,13 @@ public class FileDataStorageManager {
     }
 
     public void saveConflict(OCFile ocFile, String etagInConflict) {
-        String etag;
+        ContentValues cv = new ContentValues();
         if (!ocFile.isDown()) {
-            etag = null;
+            cv.put(ProviderTableMeta.FILE_ETAG_IN_CONFLICT, (String) null);
         } else {
-            etag = etagInConflict;
+            cv.put(ProviderTableMeta.FILE_ETAG_IN_CONFLICT, etagInConflict);
         }
-        ContentValues cv = new ContentValues();
-        cv.put(ProviderTableMeta.FILE_ETAG_IN_CONFLICT, etag);
+
         int updated = 0;
         if (getContentResolver() != null) {
             updated = getContentResolver().update(
@@ -1814,7 +1813,7 @@ public class FileDataStorageManager {
         Log_OC.d(TAG, "Number of files updated with CONFLICT: " + updated);
 
         if (updated > 0) {
-            if (etag != null) {
+            if (etagInConflict != null && ocFile.isDown()) {
                 /// set conflict in all ancestor folders
 
                 long parentId = ocFile.getParentId();