diff --git a/app/src/main/java/foundation/e/drive/services/SynchronizationService.java b/app/src/main/java/foundation/e/drive/services/SynchronizationService.java index afc77d70aec182aa708f95a36d7d8770011295c2..8583768af6b227ffab733dea4651f6bf1fc3f121 100644 --- a/app/src/main/java/foundation/e/drive/services/SynchronizationService.java +++ b/app/src/main/java/foundation/e/drive/services/SynchronizationService.java @@ -32,6 +32,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import java.lang.ref.WeakReference; +import java.util.ArrayList; import java.util.Collection; import java.util.Hashtable; import java.util.concurrent.ConcurrentLinkedDeque; @@ -152,7 +153,9 @@ public class SynchronizationService extends Service implements OnRemoteOperation } } else { String operationClassName = callerOperation.getClass().getSimpleName(); - if (callerOperation instanceof UploadFileOperation) { + final ArrayList callerOperationResultData = result.getData(); + if (callerOperation instanceof UploadFileOperation && callerOperationResultData != null + && callerOperationResultData.size() > 1) { final Float relativeQuota = (Float) result.getData().get(1); if (relativeQuota >= 99.0) { addNotification(getString(R.string.notif_quota_nearlyReached_title), getString(R.string.notif_quota_99Plus_text)); @@ -175,8 +178,8 @@ public class SynchronizationService extends Service implements OnRemoteOperation break; case UNKNOWN_ERROR: if (callerOperation instanceof UploadFileOperation) { - if(result.getData() != null) { - int rowAffected = DbHelper.forceFoldertoBeRescan(((Long) result.getData().get(0)).intValue(), getApplicationContext()); + if (callerOperationResultData != null && callerOperationResultData.size() > 0) { + int rowAffected = DbHelper.forceFoldertoBeRescan(((Long) callerOperationResultData.get(0)).intValue(), getApplicationContext()); Log.e(TAG, " Upload failed for unknown reason.\n Force folder to be rescan next time (row affected) :" + rowAffected); } else { Log.w(TAG, "result.getData() for UploadFileOperation returned null"); @@ -187,8 +190,8 @@ public class SynchronizationService extends Service implements OnRemoteOperation break; case FORBIDDEN: if (callerOperation instanceof UploadFileOperation) { - if (result.getData() != null) { - int rowAffected = DbHelper.forceFoldertoBeRescan(((Long) result.getData().get(0)).intValue(), getApplicationContext()); + if (callerOperationResultData != null && callerOperationResultData.size() > 0) { + int rowAffected = DbHelper.forceFoldertoBeRescan(((Long) callerOperationResultData.get(0)).intValue(), getApplicationContext()); Log.e(TAG, " Upload: Forbidden : Can't get syncedFileState, no remote path defined. Force folder to be rescan next time (row affected) :" + rowAffected); } else { Log.w(TAG, "result.getData() for UploadFileOperation returned null"); @@ -210,7 +213,6 @@ public class SynchronizationService extends Service implements OnRemoteOperation //Case specific to DownloadFileOperation Log.e(TAG, operationClassName+" : Sync_conflict: File is already up to date"); break; - } } }