Following up from our brief in-person conversation @dnkoutso I wanted to log this issue here for discussion.
BitmapHunter.forRequest iterates through the registered request handlers and throws an IllegalStateException if no request handlers can handle the request which can't really be caught, forcing a crash.
This is problematic for two reasons:
- Many apps show images from third party sources with no guarantee they can be handled (e.g. typos in scheme, see example below).
- There's no way for client code to determine whether or not a request can be handled at runtime without digging through Picasso source to determine which request handlers can handle which URIs.
For example, if you try to load a URI with a scheme of 'htp' rather than 'http', your app will crash with this exception:
E/AndroidRuntime﹕ FATAL EXCEPTION: Picasso-Dispatcher
java.lang.IllegalStateException: Unrecognized type of request: Request{htp://google.com/google.jpg resize(1080,1080) centerCrop}
at com.squareup.picasso.BitmapHunter.forRequest(BitmapHunter.java:292)
at com.squareup.picasso.Dispatcher.performSubmit(Dispatcher.java:159)
at com.squareup.picasso.Dispatcher$DispatcherHandler.handleMessage(Dispatcher.java:345)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.os.HandlerThread.run(HandlerThread.java:61)
Following up from our brief in-person conversation @dnkoutso I wanted to log this issue here for discussion.
BitmapHunter.forRequestiterates through the registered request handlers and throws anIllegalStateExceptionif no request handlers can handle the request which can't really be caught, forcing a crash.This is problematic for two reasons:
For example, if you try to load a URI with a scheme of 'htp' rather than 'http', your app will crash with this exception: