- /// perform the download
- downloadResult = mCurrentDownload.execute(mDownloadClient);
- if (downloadResult.isSuccess()) {
- saveDownloadedFile();
- }
-
- } catch (AccountsException e) {
- Log_OC.e(TAG, "Error while trying to get autorization for " + mLastAccount.name, e);
- downloadResult = new RemoteOperationResult(e);
- } catch (IOException e) {
- Log_OC.e(TAG, "Error while trying to get autorization for " + mLastAccount.name, e);
- downloadResult = new RemoteOperationResult(e);
-
- } finally {
- synchronized(mPendingDownloads) {
- mPendingDownloads.remove(downloadKey);
+
+ /// perform the download
+ /*Log_OC.v( "NOW " + TAG + ", thread " + Thread.currentThread().getName(),
+ "Executing download of " + mCurrentDownload.getRemotePath());*/
+ downloadResult = mCurrentDownload.execute(mDownloadClient);
+ if (downloadResult.isSuccess()) {
+ saveDownloadedFile();
+ }
+
+ } catch (AccountsException e) {
+ Log_OC.e(TAG, "Error while trying to get authorization for "
+ + mCurrentAccount.name, e);
+ downloadResult = new RemoteOperationResult(e);
+ } catch (IOException e) {
+ Log_OC.e(TAG, "Error while trying to get authorization for "
+ + mCurrentAccount.name, e);
+ downloadResult = new RemoteOperationResult(e);
+
+ } finally {
+ /*Log_OC.v( "NOW " + TAG + ", thread " + Thread.currentThread().getName(),
+ "Removing payload " + mCurrentDownload.getRemotePath());*/
+
+ Pair<DownloadFileOperation, String> removeResult =
+ mPendingDownloads.removePayload(mCurrentAccount,
+ mCurrentDownload.getRemotePath());
+
+ /// notify result
+ notifyDownloadResult(mCurrentDownload, downloadResult);
+
+ sendBroadcastDownloadFinished(mCurrentDownload, downloadResult,
+ removeResult.second);