App crash when uri is invalid (v.2.0.3)
Glide should handle exception when download invalid image_url.
java.lang.IllegalArgumentException: No stream loader for uri=http://inalid_image_url.com/images/no_image.png?size=100
at com.bumptech.glide.loader.model.UriLoader.getStreamLoader(UriLoader.java:62)
at com.bumptech.glide.loader.model.UriLoader.getStreamLoader(UriLoader.java:17)
at com.bumptech.glide.loader.model.StringLoader.getStreamLoader(StringLoader.java:51)
at com.bumptech.glide.loader.model.StringLoader.getStreamLoader(StringLoader.java:14)
at com.bumptech.glide.presenter.ImagePresenter.fetchImage(ImagePresenter.java:441)
at com.bumptech.glide.presenter.ImagePresenter.access$1200(ImagePresenter.java:34)
at com.bumptech.glide.presenter.ImagePresenter$1.onSizeReady(ImagePresenter.java:400)
at com.bumptech.glide.presenter.target.ImageViewTarget$SizeDeterminer.getSize(ImageViewTarget.java:122)
at com.bumptech.glide.presenter.target.ImageViewTarget.getSize(ImageViewTarget.java:45)
at com.bumptech.glide.presenter.ImagePresenter.setModel(ImagePresenter.java:397)
at com.bumptech.glide.Glide$Request.finish(Glide.java:681)
at com.bumptech.glide.Glide$Request.into(Glide.java:658)
at com.generic.view.screen.util.AsyncImageView.loadImage(AsyncImageView.java:509)
Interesting, is that the exact url that failed? http:// should be ok, was there some other prefix? Thanks for reporting this!
I just tested the url you gave just to be sure and the following works as I'd expect for me:
Glide.load("http://invalid_image_url.com/images/no_image.png?size=100")
.error(android.R.drawable.arrow_up_float)
.into(viewHolder.imageView);
If you can provide a sample url that fails definitely let me know. As long as it starts with http:// or https:// it should be fine?
Here is the actual URL
http://myserver_url.com:80http://myserver_url.com/webapp/images/no_image.png?size=100
I don't know why server return this URL, but it does. Hope this help
I'd guess it's because android's Uri class parses out http://myserver_url:80http:// as the content type. Glide registers a class to handle http://, but not that whole url. I can probably add a check if the content type fails to just see if the url starts with http:// or https://, though it's a shame android's uri parsing doesn't catch this weirdness.
Thanks for the update!