Parcourir la source

codacy: Avoid declaring a variable if it is unreferenced before a possible exit point.

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger il y a 4 ans
Parent
commit
ccd05b51ba

+ 1 - 1
src/main/java/com/owncloud/android/ui/dialog/ChooseRichDocumentsTemplateDialogFragment.java

@@ -144,7 +144,6 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
         int accentColor = ThemeUtils.primaryAccentColor(getContext());
 
         parentFolder = arguments.getParcelable(ARG_PARENT_FOLDER);
-        Type type = Type.valueOf(arguments.getString(ARG_TYPE));
 
         // Inflate the layout for the dialog
         LayoutInflater inflater = activity.getLayoutInflater();
@@ -160,6 +159,7 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
             throw new RuntimeException(e); // we'll NPE without the client
         }
 
+        Type type = Type.valueOf(arguments.getString(ARG_TYPE));
         new FetchTemplateTask(this, client).execute(type);
 
         listView.setHasFixedSize(true);

+ 2 - 2
src/main/java/com/owncloud/android/ui/dialog/ChooseTemplateDialogFragment.java

@@ -252,8 +252,6 @@ public class ChooseTemplateDialogFragment extends DialogFragment implements Dial
                     return "";
                 }
 
-                OCFile temp = FileStorageUtils.fillOCFile((RemoteFile) newFileResult.getData().get(0));
-
                 final ChooseTemplateDialogFragment fragment = chooseTemplateDialogFragmentWeakReference.get();
                 if (fragment == null) {
                     return "";
@@ -267,6 +265,8 @@ public class ChooseTemplateDialogFragment extends DialogFragment implements Dial
 
                 FileDataStorageManager storageManager = new FileDataStorageManager(user.toPlatformAccount(),
                                                                                    context.getContentResolver());
+
+                OCFile temp = FileStorageUtils.fillOCFile((RemoteFile) newFileResult.getData().get(0));
                 storageManager.saveFile(temp);
                 file = storageManager.getFileByPath(path);