Using the following code fails with a NullPointerException and the attached stacktrace. At this step I have successfully authenticated with google and try to access the following URL: https://spreadsheets.google.com/feeds/spreadsheets/private/full
The call to getResponseCode fails (also the getInputStream call would fail)
Any help appreciated, thanks in advance.
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Authorization", "GoogleLogin auth=" + auth);
conn.connect();
BufferedReader reader = null;
int rc = conn.getResponseCode();
if (rc != 200) {
throw new IOException("code " + rc + " '" + conn.getResponseMessage() + "'");
}
reader = new BufferedReader(new InputStreamReader(conn.getInputStream()), 512);
java.lang.NullPointerException at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.readln(HttpURLConnection.java:1178) at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection$ChunkedInputStream.readChunkSize(HttpURLConnection.java:389) at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection$ChunkedInputStream.(HttpURLConnection.java:341) at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getContentStream(HttpURLConnection.java:1074) at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequestInternal(HttpURLConnection.java:1661) at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequest(HttpURLConnection.java:1556) at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1052) at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection.getInputStream(HttpsURLConnection.java:252)