Closed lukstbit closed 1 week ago
It does expose the filenames. I removed the exceptions instances and instead added some messages about what is happening as additional info to the report.
Huh. Took one of these on 2.19.2 and it looks like:
11-19 17:26:41.861 E/AnkiDroid(18162): java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)
11-19 17:26:41.861 E/AnkiDroid(18162): at android.os.ParcelFileDescriptor.openInternal(ParcelFileDescriptor.java:351)
11-19 17:26:41.861 E/AnkiDroid(18162): at android.os.ParcelFileDescriptor.open(ParcelFileDescriptor.java:230)
11-19 17:26:41.861 E/AnkiDroid(18162): at androidx.core.content.FileProvider.openFile(SourceFile:84)
11-19 17:26:41.861 E/AnkiDroid(18162): at android.content.ContentProvider.openAssetFile(ContentProvider.java:2310)
11-19 17:26:41.861 E/AnkiDroid(18162): at android.content.ContentProvider.openTypedAssetFile(ContentProvider.java:2488)
11-19 17:26:41.861 E/AnkiDroid(18162): at android.content.ContentProvider.openTypedAssetFile(ContentProvider.java:2555)
11-19 17:26:41.861 E/AnkiDroid(18162): at android.content.ContentProvider$Transport.openTypedAssetFile(ContentProvider.java:672)
11-19 17:26:41.861 E/AnkiDroid(18162): at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:2043)
11-19 17:26:41.861 E/AnkiDroid(18162): at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1858)
11-19 17:26:41.861 E/AnkiDroid(18162): at android.content.ContentResolver.openInputStream(ContentResolver.java:1528)
FileNotFoundException 🤔
Purpose / Description
We have a lot of reports in the form of:
coming from:
https://github.com/ankidroid/Anki-Android/blob/f4b08261418fca31293629a55d341b861c0fbb73/AnkiDroid/src/main/java/com/ichi2/utils/ImportUtils.kt#L203-L211
which are a front for problems in the ImportUtils.copyToCache() method:
https://github.com/ankidroid/Anki-Android/blob/f4b08261418fca31293629a55d341b861c0fbb73/AnkiDroid/src/main/java/com/ichi2/utils/ImportUtils.kt#L306-L327
This PR "extracts" any exception happening in that method and sends it to acra instead of the current useless RuntimeException we are sending. Having the real exceptions could helps us to see what's really happening.
Checklist