Problem reading from two separate InputStreams
- by Emil H
I'm building a Yammer client for Android in Scala and have encountered the following issue. When two AsyncTasks try to parse an XML response (not the same, each task has it's own InputStream) from the Yammer API the underlying stream throws a IOException with the message "null SSL pointer", as seen below:
Uncaught handler: thread AsyncTask #1 exiting due to uncaught exception
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:200)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:234)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:258)
at java.util.concurrent.FutureTask.run(FutureTask.java:122)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:648)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:673)
at java.lang.Thread.run(Thread.java:1060)
Caused by: java.io.IOException: null SSL pointer
at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.nativeread(Native Method)
at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.access$300(OpenSSLSocketImpl.java:55)
at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:524)
at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:103)
at org.apache.http.impl.io.AbstractSessionInputBuffer.read(AbstractSessionInputBuffer.java:134)
at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:174)
at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:188)
at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:178)
at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:504)
at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:467)
at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:329)
at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:286)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:361)
at org.mediocre.util.XMLParser$.loadXML(XMLParser.scala:28)
at org.mediocre.util.XMLParser$.loadXML(XMLParser.scala:12)
.....
Searching for the error didn't give much clarity. Does this have something to do with the response from the server? Or is it something else? Complete code can be found at: http://github.com/archevel/YammerTime
I get no error if I wait until the first repsponse is finished and then let the other complete. The request is made with the DefaultHttpClient, but this is supposedly thread safe. What am I missing? If anything needs to be clarified just ask :)
Cheers,
Emil H