Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Avoid printing exception for valid code execution path #13102

Merged
merged 1 commit into from
Oct 15, 2018

Conversation

tobrun
Copy link
Member

@tobrun tobrun commented Oct 15, 2018

This PR avoids printing the exception message as:

 java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.BaseBundle.getBoolean(java.lang.String, boolean)' on a null object reference
        at com.mapbox.mapboxsdk.storage.FileSource.getCachePath(FileSource.java:88)
        at com.mapbox.mapboxsdk.storage.FileSource$FileDirsPathsTask.doInBackground(FileSource.java:165)
        at com.mapbox.mapboxsdk.storage.FileSource$FileDirsPathsTask.doInBackground(FileSource.java:155)
        at android.os.AsyncTask$2.call(AsyncTask.java:304)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)

This occurs when the hosting app doesn't have any metadata setup in their AndroidManifest.xml. This is a valid use-case, this PR avoids throwing the exception, and the code change doesn't impact the business logic involved.

@tobrun tobrun added the Android Mapbox Maps SDK for Android label Oct 15, 2018
@tobrun tobrun added this to the android-v6.7.0 milestone Oct 15, 2018
@tobrun tobrun self-assigned this Oct 15, 2018
@tobrun tobrun requested review from zugaldia and osana October 15, 2018 09:40
@tobrun
Copy link
Member Author

tobrun commented Oct 15, 2018

This PR refs #13096 (comment)

@tobrun tobrun merged commit b9029e7 into master Oct 15, 2018
@tobrun tobrun deleted the tvn-external-storage-config branch October 15, 2018 16:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants