PhenoApps / Field-Book

https://fieldbook.phenoapps.org
GNU General Public License v2.0
52 stars 54 forks source link

[BUG]: Database export task after deleting storage directory #1060

Open kamathprasad9 opened 1 month ago

kamathprasad9 commented 1 month ago

Description

After deleting the Field Book directory in the device and trying to export database in settings/database, a toast pops up - "Export complete".

android.os.ParcelableException: java.io.FileNotFoundException: Missing file for primary:FieldBook at /storage/emulated/0/FieldBook
                                at android.os.ParcelableException$1.createFromParcel(ParcelableException.java:82)
                                at android.os.ParcelableException$1.createFromParcel(ParcelableException.java:79)
                                at android.os.Parcel.readParcelableInternal(Parcel.java:5075)
                                at android.os.Parcel.readParcelable(Parcel.java:5057)
                                at android.os.Parcel.createExceptionOrNull(Parcel.java:3237)
                                at android.os.Parcel.createException(Parcel.java:3226)
                                at android.os.Parcel.readException(Parcel.java:3209)
                                at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:203)
                                at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:155)
                                at android.content.ContentProviderProxy.call(ContentProviderNative.java:764)
                                at android.content.ContentResolver.call(ContentResolver.java:2466)
                                at android.provider.DocumentsContract.createDocument(DocumentsContract.java:1380)
                                at androidx.documentfile.provider.TreeDocumentFile.createFile(TreeDocumentFile.java:53)
                                at androidx.documentfile.provider.TreeDocumentFile.createDirectory(TreeDocumentFile.java:63)
                                at org.phenoapps.utils.BaseDocumentTreeUtil$Companion.getOrCreate(BaseDocumentTreeUtil.kt:439)
                                at org.phenoapps.utils.BaseDocumentTreeUtil$Companion.createDir(BaseDocumentTreeUtil.kt:476)
                                at org.phenoapps.utils.BaseDocumentTreeUtil$Companion.getDirectory(BaseDocumentTreeUtil.kt:296)
                                at com.fieldbook.tracker.preferences.DatabasePreferencesFragment$ExportDBTask.doInBackground(DatabasePreferencesFragment.java:302)
                                at com.fieldbook.tracker.preferences.DatabasePreferencesFragment$ExportDBTask.doInBackground(DatabasePreferencesFragment.java:278)
                                at android.os.AsyncTask$3.call(AsyncTask.java:394)
                                at java.util.concurrent.FutureTask.run(FutureTask.java:264)
                                at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
                                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
                                at java.lang.Thread.run(Thread.java:1012)
                            Caused by: java.io.FileNotFoundException: Missing file for primary:Temp at /storage/emulated/0/Temp
                                at java.lang.reflect.Constructor.newInstance0(Native Method)
                                at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
                                at android.os.ParcelableException.readFromParcel(ParcelableException.java:56)
                                ... 25 more

Expected behavior

No response

Field Book version

5.6.25