Hey Use HttpClient connection class
org.apache.http.client.HttpClient
instead of normal HTTPURLConnection
Since org.apache will handle such redirects properly than java
Regards,
Venugopal.
On Monday, March 8, 2010 12:42:32 PM UTC+5:30, steVe wrote:
> Hi All,
>
> I get this protocol exception error when I try to read a rss feed. Its
> loading fine on the emulator. But when I test on my device (Droid), it
> throws the below error.
>
> ---------------------------------------------------
> 03-08 12:29:25.210: ERROR/AndroidRuntime(5108): Caused by:
> java.net.ProtocolException: Too many redirects
> 03-08 12:29:25.210: ERROR/AndroidRuntime(5108): at
>
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequestInternal(HttpURLConnection.java:
> 1626)
> 03-08 12:29:25.210: ERROR/AndroidRuntime(5108): at
>
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequest(HttpURLConnection.java:
> 1551)
> 03-08 12:29:25.210: ERROR/AndroidRuntime(5108): at
>
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:
> 1052)
> 03-08 12:29:25.210: ERROR/AndroidRuntime(5108): at
> com.aol.engadget.parser.BaseFeedParser.getInputStream(BaseFeedParser.java:
> 45)
> 03-08 12:29:25.210: ERROR/AndroidRuntime(5108): ... 9 more
> ---------------------------------------------------
>
> It stops here on getInputStream.
>
> At the same time I am reading another two feeds from the same server.
> It loads and parses fine...
>
> Here is the code
>
> Xml.parse(this.getInputStream(), Xml.Encoding.UTF_8,
> root.getContentHandler());
>
> protected InputStream getInputStream() {
> try {
> URLConnection feedCon = feedUrl.openConnection();
>
> return feedCon.getInputStream();
> } catch (IOException e) {
> throw new RuntimeException(e);
> }
> }
>
>
> Am I doing anything wrong ? Or is it a bug ?
>
>
>
--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.