Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid HttpUrlConnection getInputStream throws NullPointerException
    primarykey
    data
    text
    <p>I am trying to download the image from this url:</p> <p><a href="https://hme_player_pictures.s3.amazonaws.com/test-512813ed3b83286c72f376c7-thumb100.jpg" rel="nofollow">https://hme_player_pictures.s3.amazonaws.com/test-512813ed3b83286c72f376c7-thumb100.jpg</a></p> <p>here is stack trace:</p> <pre><code>03-21 12:58:04.040: W/System.err(7084): java.lang.NullPointerException 03-21 12:58:04.040: W/System.err(7084): at libcore.net.http.HttpConnection$Address.hashCode(HttpConnection.java:343) 03-21 12:58:04.045: W/System.err(7084): at java.util.HashMap.get(HashMap.java:298) 03-21 12:58:04.050: W/System.err(7084): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:67) 03-21 12:58:04.050: W/System.err(7084): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128) 03-21 12:58:04.050: W/System.err(7084): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308) 03-21 12:58:04.055: W/System.err(7084): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:460) 03-21 12:58:04.055: W/System.err(7084): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:432) 03-21 12:58:04.055: W/System.err(7084): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282) 03-21 12:58:04.060: W/System.err(7084): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232) 03-21 12:58:04.065: W/System.err(7084): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:273) 03-21 12:58:04.065: W/System.err(7084): at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:168) 03-21 12:58:04.070: W/System.err(7084): at libcore.net.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:270) 03-21 12:58:04.070: W/System.err(7084): ... </code></pre> <p>code:</p> <pre><code>URL imageUrl = new URL(url); HttpURLConnection c = (HttpURLConnection)imageUrl.openConnection(); InputStream in = c.getInputStream(); // Nullpointer exception on this line, c is definitely not null, I debugged </code></pre> <p>Can't figure out why it is throwing NullPointerException. The above url does work in the browser. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload