Pārlūkot izejas kodu

data:files Return descriptive error message if null is returned.

TODO: Use string resources instead of hardcoded strings.
ardevd 7 gadi atpakaļ
vecāks
revīzija
855e06c912

+ 14 - 10
src/main/java/com/owncloud/android/ui/activities/data/files/FilesServiceApiImpl.java

@@ -47,16 +47,6 @@ public class FilesServiceApiImpl implements FilesServiceApi {
         private final boolean mIsSharingSupported;
         private final String mFileUrl;
 
-        @Override
-        protected void onPostExecute(Boolean success) {
-            super.onPostExecute(success);
-            if (success && remoteOcFile != null) {
-                mCallback.onLoaded(remoteOcFile);
-            } else {
-                mCallback.onError(errorMessage);
-            }
-        }
-
         private ReadRemoteFileTask(String fileUrl, BaseActivity baseActivity,
                                    boolean isSharingSupported,
                                    FilesServiceCallback<OCFile> callback) {
@@ -114,5 +104,19 @@ public class FilesServiceApiImpl implements FilesServiceApi {
 
             return false;
         }
+
+        @Override
+        protected void onPostExecute(Boolean success) {
+            super.onPostExecute(success);
+            if (success && remoteOcFile != null) {
+                mCallback.onLoaded(remoteOcFile);
+                return;
+            } else if (success && remoteOcFile == null) {
+                errorMessage = "File not found";
+            }
+
+            mCallback.onError(errorMessage);
+        }
     }
+
 }