abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Falkner (JIRA)" <j...@apache.org>
Subject [jira] Created: (ABDERA-249) Abdera fails to completely read streams using GZIP compression
Date Mon, 19 Oct 2009 20:22:59 GMT
Abdera fails to completely read streams using GZIP compression
--------------------------------------------------------------

                 Key: ABDERA-249
                 URL: https://issues.apache.org/jira/browse/ABDERA-249
             Project: Abdera
          Issue Type: Bug
    Affects Versions: 1.0
         Environment: Mac OS X, Java 1.6
            Reporter: James Falkner


Test code:

{code:java}
Abdera abdera = new Abdera();
AbderaClient client = new AbderaClient(abdera);
ClientResponse resp = client.get("http://www.facebook.com/activitystreams/feed.php?source_id=499225640");
Document<Feed> doc = resp.getDocument();
doc.complete();
{code}

When reading a stream that is gzip-compressed (such as the sample facebook stream above),
Abdera throws an exception:

{code}
Exception in thread "main" org.apache.abdera.parser.ParseException: java.lang.RuntimeException:
[was class java.io.EOFException] Unexpected end of ZLIB input stream
	at org.apache.abdera.parser.stax.FOMBuilder.next(FOMBuilder.java:260)
	at org.apache.axiom.om.impl.llom.OMNodeImpl.build(OMNodeImpl.java:318)
	at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:614)
	at org.apache.abdera.parser.stax.FOMElement.complete(FOMElement.java:845)
	at org.apache.abdera.parser.stax.FOMFeed.sortEntries(FOMFeed.java:167)
	at FacebookStreamReader.main(FacebookStreamReader.java:42)
Caused by: java.lang.RuntimeException: [was class java.io.EOFException] Unexpected end of
ZLIB input stream
	at com.ctc.wstx.util.ExceptionUtil.throwRuntimeException(ExceptionUtil.java:18)
	at com.ctc.wstx.sr.StreamScanner.throwLazyError(StreamScanner.java:706)
	at com.ctc.wstx.sr.BasicStreamReader.safeFinishToken(BasicStreamReader.java:3655)
	at com.ctc.wstx.sr.BasicStreamReader.getText(BasicStreamReader.java:809)
	at org.apache.axiom.om.impl.builder.StAXBuilder.createOMText(StAXBuilder.java:245)
	at org.apache.axiom.om.impl.builder.StAXBuilder.createOMText(StAXBuilder.java:216)
	at org.apache.abdera.parser.stax.FOMBuilder.applyTextFilter(FOMBuilder.java:158)
	at org.apache.abdera.parser.stax.FOMBuilder.next(FOMBuilder.java:206)
	... 5 more
Caused by: java.io.EOFException: Unexpected end of ZLIB input stream
	at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:223)
	at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:141)
	at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:92)
	at java.io.FilterInputStream.read(FilterInputStream.java:116)
	at org.apache.abdera.protocol.client.util.AutoReleasingInputStream.read(AutoReleasingInputStream.java:56)
	at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
	at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
	at java.io.InputStreamReader.read(InputStreamReader.java:167)
	at com.ctc.wstx.io.MergedReader.read(MergedReader.java:101)
	at com.ctc.wstx.io.ReaderSource.readInto(ReaderSource.java:84)
	at com.ctc.wstx.io.BranchingReaderSource.readInto(BranchingReaderSource.java:57)
	at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:967)
	at com.ctc.wstx.sr.BasicStreamReader.readTextSecondary(BasicStreamReader.java:4626)
	at com.ctc.wstx.sr.BasicStreamReader.readCoalescedText(BasicStreamReader.java:4124)
	at com.ctc.wstx.sr.BasicStreamReader.finishToken(BasicStreamReader.java:3699)
	at com.ctc.wstx.sr.BasicStreamReader.safeFinishToken(BasicStreamReader.java:3647)
	... 10 more
{code}

If I force the stream to be un-compressed, via this code, it works:

{code:java}
Abdera abdera = new Abdera();
AbderaClient client = new AbderaClient(abdera);
RequestOptions options = client.getDefaultRequestOptions();
options.setAcceptEncoding((String)null);
ClientResponse resp = client.get("http://www.facebook.com/activitystreams/feed.php?source_id=499225640",
options);
Document<Feed> doc = resp.getDocument();
doc.complete();
{code}

There is some code in org.apache.abdera.protocol.client.util.AutoReleasingInputStream that
is not properly handling the EOFException.  If I modify that code to also catch the EOFException
and behave as though it had gotten back a -1 from the read() method, then it also starts working.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message