Skip to content

IllegalArgumentException when using fallback with FutureTarget #2487

Open
@moxie0

Description

@moxie0

It looks like fallback() and error() don't work with submit() to FutureTarget.

Code such as:

            Uri uri = null;
            Bitmap bitmap = Glide.with(MainActivity.this)
                                 .asBitmap()
                                 .load(uri)
                                 .apply(new RequestOptions().fallback(android.R.drawable.ic_delete))
                                 .submit(500, 500)
                                 .get();

Will always throw:

10-15 16:39:43.627 25771 25826 E AndroidRuntime: java.lang.RuntimeException: An error occurred while executing doInBackground()
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	at android.os.AsyncTask$3.done(AsyncTask.java:309)
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	at java.util.concurrent.FutureTask.run(FutureTask.java:242)
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:818)
10-15 16:39:43.627 25771 25826 E AndroidRuntime: Caused by: java.lang.AssertionError: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Load failed
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	at org.moxie.glitchycorners.MainActivity$1.doInBackground(MainActivity.java:45)
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	at org.moxie.glitchycorners.MainActivity$1.doInBackground(MainActivity.java:28)
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	at android.os.AsyncTask$2.call(AsyncTask.java:295)
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	... 4 more
10-15 16:39:43.627 25771 25826 E AndroidRuntime: Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Load failed
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	at com.bumptech.glide.request.RequestFutureTarget.doGet(RequestFutureTarget.java:206)
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	at com.bumptech.glide.request.RequestFutureTarget.get(RequestFutureTarget.java:108)
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	at org.moxie.glitchycorners.MainActivity$1.doInBackground(MainActivity.java:39)
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	... 7 more
10-15 16:39:43.627 25771 25826 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Load failed
10-15 16:39:43.627 25771 25826 E AndroidRuntime: 	... 10 more

Same code works fine with into() an ImageView instead.

I'm not sure whether this is supposed to work or not, but I think it'd be nice if it did, since then it'd be possible to reuse the same Glide fallback logic for situations where a controller needs to load a Bitmap (like for notifications) rather than having Glide talk to a view directly.

Glide Version: 4.2.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions