Skip to content

Do not crash if mms part data is not exist #42

Closed
@keydon3

Description

When i export messages with "Include (encoded) binary MMS data", i get fatal error:

07-30 22:41:37.675  7582  7582 D MediaScannerReceiver: action: android.intent.action.MEDIA_SCANNER_SCAN_FILE path: /storage/emulated/0/backup/messages.json
07-30 22:41:37.715  5454  5454 E AndroidRuntime: FATAL EXCEPTION: main
07-30 22:41:37.715  5454  5454 E AndroidRuntime: Process: com.github.tmo1.sms_ie, PID: 5454
07-30 22:41:37.715  5454  5454 E AndroidRuntime: java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)
07-30 22:41:37.715  5454  5454 E AndroidRuntime:        at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:144)
07-30 22:41:37.715  5454  5454 E AndroidRuntime:        at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:698)
07-30 22:41:37.715  5454  5454 E AndroidRuntime:        at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1410)
07-30 22:41:37.715  5454  5454 E AndroidRuntime:        at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1247)
07-30 22:41:37.715  5454  5454 E AndroidRuntime:        at android.content.ContentResolver.openInputStream(ContentResolver.java:967)
07-30 22:41:37.715  5454  5454 E AndroidRuntime:        at com.github.tmo1.sms_ie.ImportExportKt.mmsToJSON(ImportExport.kt:374)
07-30 22:41:37.715  5454  5454 E AndroidRuntime:        at com.github.tmo1.sms_ie.ImportExportKt.access$mmsToJSON(ImportExport.kt:1)
07-30 22:41:37.715  5454  5454 E AndroidRuntime:        at com.github.tmo1.sms_ie.ImportExportKt$mmsToJSON$1.invokeSuspend(Unknown Source:17)
07-30 22:41:37.715  5454  5454 E AndroidRuntime:        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
07-30 22:41:37.715  5454  5454 E AndroidRuntime:        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
07-30 22:41:37.715  5454  5454 E AndroidRuntime:        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
07-30 22:41:37.715  5454  5454 E AndroidRuntime:        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
07-30 22:41:37.715  5454  5454 E AndroidRuntime:        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
07-30 22:41:37.715  5454  5454 E AndroidRuntime:        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
07-30 22:41:37.719  1243  2063 W ActivityManager:   Force finishing activity com.github.tmo1.sms_ie/.MainActivity
07-30 22:41:37.723  1243  2063 E LightsService: Light requested not available on this device. 2
07-30 22:41:37.726  1243  2063 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:966 com.android.server.am.AppErrors.crashApplicationInner:393 com.android.server.am.AppErrors.crashApplication:321 com.android.server.am.ActivityManagerService.handleApplicationCrashInner:14489 com.android.server.am.ActivityManagerService.handleApplicationCrash:14471 
07-30 22:41:37.728  1243  1262 I ActivityManager: Showing crash dialog for package com.github.tmo1.sms_ie u0

Tail in messages.json:

    "parts": [
      {
        "_id": "6",
        "mid": "5",
        "seq": "-1",
        "ct": "application/smil",
        "cid": "<smil>",
        "cl": "smil.xml",
        "text": "<smil>...</smil>"
      },
      {
        "_id": "7",
        "mid": "5",
        "seq": "0",
        "ct": "image/jpeg",
        "cid": "<image000000>",
        "cl": "image000000.jpg",
        "_data": "/data/user_de/0/com.android.providers.telephony/app_parts/PART_1617028091818_image000000.jpg"

Probably it's because the file doesn't exist:

/data/user_de/0/com.android.providers.telephony/app_parts # ls PART_1617028091818_image000000.jpg
ls: PART_1617028091818_image000000.jpg: No such file or directory

Without "Include (encoded) binary MMS data" all works fine.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions