fdmirza
fdmirza

Reputation: 311

HttpURLConnection RuntimeException

I am having a strange problem. I am using HttpURLConnection and when I conn.readInputStream(), I get a RuntimeException. Its not always replicable but users have reported this stacktrace. In development I never faced this problem, so I personally don't know what caused the error. Please give any suggestions about this stacktracee.

java.lang.RuntimeException: java.util.NoSuchElementException
at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:692)
at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method)
at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:485)
at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:323)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.setupSecureSocket(HttpConnection.java:167)
at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:479)
at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnectionImpl$HttpsEngine.makeConnection(HttpsURLConnectionImpl.java:419)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl … veResponse(HttpURLConnectionImpl.java:1038)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:523)
at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnectionIm … nputStream(HttpsURLConnectionImpl.java:283)
at com.facebook.android.Util.openUrl(Util.java:245)
at com.facebook.android.Facebook.request(Facebook.java:730)
at com.facebook.android.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:313)
Caused by: java.util.NoSuchElementException
at java.util.LinkedList$LinkIterator.next(LinkedList.java:122)
at org.apache.harmony.security.x501.Name.getName0(Name.java:195)
at org.apache.harmony.security.x501.Name.getName(Name.java:135)
at javax.security.auth.x500.X500Principal.getCanonicalName(X500Principal.java:155)
at javax.security.auth.x500.X500Principal.hashCode(X500Principal.java:286)
at java.util.HashMap.get(HashMap.java:302)
at org.apache.harmony.xnet.provider.jsse.IndexedPKIXParameters.isTrustAnchor(IndexedPKIXParameters.java:113)
at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.cleanupCertChain(TrustManagerImpl.java:194)
at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:144)
at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:132)
at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:681)
... 12 more

Upvotes: 2

Views: 1013

Answers (2)

jeremy
jeremy

Reputation: 914

Probably a bit late, but this can happen if the resource you're trying to get doesn't exist. For example you're trying to get a user with id 500 (/user/500) but this one doesn't exist on the server you're calling.

Upvotes: 0

jeet
jeet

Reputation: 29199

This issue is due to you are creating an https connection from your app, and to open a secure connection you need to install necessary certificates on your device.

Upvotes: 4

Related Questions