Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.net.ProtocolException: cannot write to a URLConnection if doOutput=false - call setDoOutput(true) #2229

Closed
DariusL opened this issue Jan 26, 2016 · 1 comment

Comments

@DariusL
Copy link

DariusL commented Jan 26, 2016

I get this exception when I try to use the Facebook SDK in a Robolectric test.

java.net.ProtocolException: cannot write to a URLConnection if doOutput=false - call setDoOutput(true)

at com.facebook.GraphResponse.fromHttpConnection(GraphResponse.java:280)
at com.facebook.GraphRequest.executeConnectionAndWait(GraphRequest.java:1130)
at com.facebook.GraphRequest.executeBatchAndWait(GraphRequest.java:1032)
at com.facebook.GraphRequest.executeBatchAndWait(GraphRequest.java:999)
at com.facebook.GraphRequest.executeBatchAndWait(GraphRequest.java:983)
at com.facebook.GraphRequest.executeAndWait(GraphRequest.java:958)
at com.facebook.GraphRequest.executeAndWait(GraphRequest.java:854)
... my code

Caused by: java.net.ProtocolException: cannot write to a URLConnection if doOutput=false - call setDoOutput(true)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1263)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1256)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1465)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
at com.facebook.GraphResponse.fromHttpConnection(GraphResponse.java:253)
@jongerrish
Copy link
Contributor

Closing this as it hasn't been updated in a while. If its still an issue with Robolectric 4.0 please reopen with a reproducible test case and we'll prioritize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants