Эх сурвалжийг харах

change call order to not create unneeded objects before the checks haven't succeeded

AndyScherzinger 6 жил өмнө
parent
commit
7d4a2ecfa8

+ 3 - 6
src/main/java/com/owncloud/android/files/services/FileUploader.java

@@ -533,9 +533,6 @@ public class FileUploader extends Service
             return Service.START_NOT_STICKY;
         }
 
-        boolean retry = intent.getBooleanExtra(KEY_RETRY, false);
-        AbstractList<String> requestedUploads = new Vector<String>();
-
         if (!intent.hasExtra(KEY_ACCOUNT)) {
             Log_OC.e(TAG, "Not enough information provided in intent");
             return Service.START_NOT_STICKY;
@@ -545,10 +542,11 @@ public class FileUploader extends Service
         if (!AccountUtils.exists(account, getApplicationContext())) {
             return Service.START_NOT_STICKY;
         }
-        OwnCloudVersion ocv = AccountUtils.getServerVersion(account);
 
-        boolean chunked = ocv.isChunkedUploadSupported();
+        boolean retry = intent.getBooleanExtra(KEY_RETRY, false);
+        AbstractList<String> requestedUploads = new Vector<>();
 
+        boolean chunked = AccountUtils.getServerVersion(account).isChunkedUploadSupported();
         boolean onWifiOnly = intent.getBooleanExtra(KEY_WHILE_ON_WIFI_ONLY, false);
         boolean whileChargingOnly = intent.getBooleanExtra(KEY_WHILE_CHARGING_ONLY, false);
 
@@ -629,7 +627,6 @@ public class FileUploader extends Service
                     ocUpload.setLocalAction(localAction);
                     ocUpload.setUseWifiOnly(onWifiOnly);
                     ocUpload.setWhileChargingOnly(whileChargingOnly);
-
                     ocUpload.setUploadStatus(UploadStatus.UPLOAD_IN_PROGRESS);