Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crash when uri is invalid (v.2.0.3) #71

Closed
lunf opened this issue Jun 12, 2014 · 4 comments
Closed

App crash when uri is invalid (v.2.0.3) #71

lunf opened this issue Jun 12, 2014 · 4 comments

Comments

@lunf
Copy link

lunf commented Jun 12, 2014

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)
@lunf lunf closed this as completed Jun 12, 2014
@lunf lunf reopened this Jun 12, 2014
@sjudd
Copy link
Collaborator

sjudd commented Jun 13, 2014

Interesting, is that the exact url that failed? http:// should be ok, was there some other prefix? Thanks for reporting this!

@sjudd
Copy link
Collaborator

sjudd commented Jun 15, 2014

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?

@lunf
Copy link
Author

lunf commented Jun 15, 2014

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

@sjudd
Copy link
Collaborator

sjudd commented Jun 18, 2014

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants