2

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
0

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

1 Comment

How wud me do that? I mean where I can get the certificates.
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.