Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid url.openstream gives too many redirects IOException
    primarykey
    data
    text
    <p>I can't seem to figure this out. I'm loading a URL that has a single redirect, and Android is throwing "Too many redirects" when there is only a single redirect, and it works in a browser. Here's a simplified code snippet:</p> <pre><code>URL url = null; InputStream in; String pic_url = "http://www.cdn.sherdog.com/image_crop/200/300/_images/fighter/20100221121302_bader.JPG"; try { url = new URL(pic_url); } catch (MalformedURLException e1) { Log.d("iTrackMMA","URL had exception malformedURLEx on: " + pic_url); } try { in = url.openStream(); } catch (IOException ioe) { Log.d("iTrackMMA","URL had IOException on: " + pic_url + " with error: " + ioe.getMessage()); } </code></pre> <p>Error:</p> <pre><code>07-28 21:57:38.017: URL had IOException on: http://www.cdn.sherdog.com/image_crop/200/300/_images/fighter/20100221121302_bader.JPG with error: Too many redirects </code></pre> <p>If I use the URL that this redirects to, to cut out any redirects, I still get the same error, even though there doesn't seem to be any redirect?</p> <pre><code>URL url = null; InputStream in; String pic_url = "http://m.sherdog.com/image_crop.php?image=http://www.cdn.sherdog.com/_images/fighter/20100221121302_bader.JPG&amp;&amp;width=200&amp;&amp;height=300"; try { url = new URL(pic_url); } catch (MalformedURLException e1) { Log.d("iTrackMMA","URL had exception malformedURLEx on: " + pic_url); } try { in = url.openStream(); } catch (IOException ioe) { Log.d("iTrackMMA","URL had IOException on: " + pic_url + " with error: " + ioe.getMessage()); } </code></pre> <p>Error:</p> <pre><code>07-28 21:48:31.337: URL had IOException on: http://m.sherdog.com/image_crop.php?image=http://www.cdn.sherdog.com/_images/fighter/20100221121302_bader.JPG&amp;&amp;width=200&amp;&amp;height=300 with error: Too many redirects </code></pre> <p>What am I missing? Does it do this for others as well? I'm wondering if there's something non-HTML compliant about this URL, and if so, I hope to find a workaround so that Android will play nice with it.</p> <p>Thanks for any insight.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload