X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/7c0accf714ec85a08c70747cf8d84dbada817a67..cea1a76f48ceb400136e64b4fb921a3f92aee6e4:/src/com/owncloud/android/datamodel/FileDataStorageManager.java diff --git a/src/com/owncloud/android/datamodel/FileDataStorageManager.java b/src/com/owncloud/android/datamodel/FileDataStorageManager.java index 0b35beaa..76e3e5c8 100644 --- a/src/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/src/com/owncloud/android/datamodel/FileDataStorageManager.java @@ -972,9 +972,8 @@ public class FileDataStorageManager { } public void saveShares(Collection shares) { + cleanShares(); if (shares != null) { - cleanShares(); - ArrayList operations = new ArrayList(shares.size()); // prepare operations to insert or update files to save in the given folder @@ -1011,32 +1010,33 @@ public class FileDataStorageManager { } // apply operations in batch - @SuppressWarnings("unused") - ContentProviderResult[] results = null; - Log_OC.d(TAG, "Sending " + operations.size() + " operations to FileContentProvider"); - try { - if (getContentResolver() != null) { - results = getContentResolver().applyBatch(MainApp.getAuthority(), operations); - - } else { - results = getContentProviderClient().applyBatch(operations); + if (operations.size() > 0) { + @SuppressWarnings("unused") + ContentProviderResult[] results = null; + Log_OC.d(TAG, "Sending " + operations.size() + " operations to FileContentProvider"); + try { + if (getContentResolver() != null) { + results = getContentResolver().applyBatch(MainApp.getAuthority(), operations); + + } else { + results = getContentProviderClient().applyBatch(operations); + } + + } catch (OperationApplicationException e) { + Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage()); + + } catch (RemoteException e) { + Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage()); } - - } catch (OperationApplicationException e) { - Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage()); - - } catch (RemoteException e) { - Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage()); } - } } public void updateSharedFiles(Collection sharedFiles) { + cleanSharedFiles(); + if (sharedFiles != null) { - cleanSharedFiles(); - ArrayList operations = new ArrayList(sharedFiles.size()); // prepare operations to insert or update files to save in the given folder @@ -1077,24 +1077,25 @@ public class FileDataStorageManager { } // apply operations in batch - @SuppressWarnings("unused") - ContentProviderResult[] results = null; - Log_OC.d(TAG, "Sending " + operations.size() + " operations to FileContentProvider"); - try { - if (getContentResolver() != null) { - results = getContentResolver().applyBatch(MainApp.getAuthority(), operations); - - } else { - results = getContentProviderClient().applyBatch(operations); + if (operations.size() > 0) { + @SuppressWarnings("unused") + ContentProviderResult[] results = null; + Log_OC.d(TAG, "Sending " + operations.size() + " operations to FileContentProvider"); + try { + if (getContentResolver() != null) { + results = getContentResolver().applyBatch(MainApp.getAuthority(), operations); + + } else { + results = getContentProviderClient().applyBatch(operations); + } + + } catch (OperationApplicationException e) { + Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage()); + + } catch (RemoteException e) { + Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage()); } - - } catch (OperationApplicationException e) { - Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage()); - - } catch (RemoteException e) { - Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage()); } - } }