Fixed bug: renaming a folder could miss-update the storage path of children not-down...
authorDavid A. Velasco <dvelasco@solidgear.es>
Wed, 21 Nov 2012 15:28:20 +0000 (16:28 +0100)
committerDavid A. Velasco <dvelasco@solidgear.es>
Wed, 21 Nov 2012 15:28:20 +0000 (16:28 +0100)
src/com/owncloud/android/datamodel/FileDataStorageManager.java

index be01655..4ed425e 100644 (file)
@@ -533,12 +533,12 @@ public class FileDataStorageManager implements DataStorageManager {
 
             /// 2. prepare a batch of update operations to change all the descendants
             ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>(c.getCount());
-            ContentValues cv = new ContentValues();
             int lengthOfOldPath = dir.getRemotePath().length();
             String defaultSavePath = FileDownloader.getSavePath(mAccount.name);
             int lengthOfOldStoragePath = defaultSavePath.length() + lengthOfOldPath;
             if (c.moveToFirst()) {
                 do {
+                    ContentValues cv = new ContentValues(); // don't take the constructor out of the loop and clear the object
                     OCFile child = createFileInstance(c);
                     cv.put(ProviderTableMeta.FILE_PATH, newPath + child.getRemotePath().substring(lengthOfOldPath));
                     if (child.getStoragePath() != null && child.getStoragePath().startsWith(defaultSavePath)) {