Glide throws error instead of using specified error image when loading bitmap
- Dominant language
- Java
- Stars
- 35k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 8
Description
**Glide Version**: 4.12.0
**Integration libraries**: com.github.bumptech.glide:okhttp3-integration:4.12.0
**Device/Android Version**: Android 11; any device
**Issue details / Repro steps / Use case background**:
Trying to load a contact image as a bitmap via content URI, with fallback in case contact has no contact image:
Expectation: If Glide is unable to load anything from the contact uri, the bitmap specified in `.error(...)` will be used.
Actual: `java.util.concurrent.ExecutionException`
**Glide load line / `GlideModule` (if any) / list Adapter code (if any)**:
```kotlin
Glide.with(context)
.asBitmap()
.load(contactUri)
.error(
Glide.with(context)
.asBitmap()
.load(defaultAvatar)
)
.submit(width, height)
.get()
.let { builder.setLargeIcon(it) }
```
**Stack trace / LogCat**:
```ruby
java.util.concurrent.ExecutionException: com.bumptech.glide.load.engine.GlideException: Failed to load resource
There were 3 root causes:
java.io.FileNotFoundException(InputStream is null for content://com.android.contacts/contacts/3)
java.io.FileNotFoundException(Stream I/O not supported on this URI.; URI: content://com.android.contacts/contacts/3, calling user: android.uid.shared:10069, calling package is one of: [com.android.calllogbackup, com.android.providers.userdictionary, com.android.providers.contacts, com.android.providers.blockednumber])
java.io.FileNotFoundException(Stream I/O not supported on this URI.; URI: content://com.android.contacts/contacts/3, calling user: android.uid.shared:10069, calling package is one of: [com.android.calllogbackup, com.android.providers.userdictionary, com.android.providers.contacts, com.android.providers.blockednumber])
call GlideException#logRootCauses(String) for more detail
at com.bumptech.glide.request.RequestFutureTarget.doGet(RequestFutureTarget.java:217)
at com.bumptech.glide.request.RequestFutureTarget.get(RequestFutureTarget.java:130)
```
Contributor guide
Research direction
Start with the RequestFutureTarget.doGet and get calls named in the stack trace, then trace how the provided Kotlin .error(...).submit(...).get() chain handles the failed contact URI. Reproduce it with the contact content URI and fallback bitmap; done means the fallback bitmap is returned instead of an ExecutionException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100