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

ClassCastException in ApacheHttpRequest.setContent #122

Closed
wonderfly opened this issue Jan 9, 2015 · 2 comments

Comments

@wonderfly
Copy link
Contributor

commented Jan 9, 2015

From yan...@google.com on May 29, 2012 11:20:49

Version of google-http-java-client (e.g. 1.5.0-beta)? 1.9.0-beta Java environment (e.g. Java 6, Android 2.3, App Engine)? Android 2.2 (Froyo) Describe the problem. See: https://groups.google.com/forum/?fromgroups#!topic/google-http-java-client/32ZFWeaAyVM stack trace copied here:

05-23 13:15:00.526: W/System.err(1168): java.lang.ClassCastException: org.apache.http.client.methods.HttpGet
05-23 13:15:00.537: W/System.err(1168): at com.google.api.client.http.apache.ApacheHttpRequest.setContent(ApacheHttpRequest.java:66)
05-23 13:15:00.537: W/System.err(1168): at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:805) How would you expect it to be fixed? It is very rare to see an HTTP GET request with content. It is not strictly forbidden though, see: http://tech.groups.yahoo.com/group/rest-discuss/message/9962 Problem is that the Apache HTTP Client just doesn't support that use case. So at least we should throw a nice IllegalArgumentException with an explanation instead of a ClassCastException.

A nicer option is that we could actually work around the limitation like we've done with HttpPatch. It should be easy enough to implement, but given how rare it is, it might not be important enough to fix.

Original issue: http://code.google.com/p/google-http-java-client/issues/detail?id=122

@wonderfly

This comment has been minimized.

Copy link
Contributor Author

commented Jan 9, 2015

From rmis...@google.com on August 15, 2012 05:28:49

http://codereview.appspot.com/6450137/

Status: Started

@wonderfly wonderfly self-assigned this Jan 9, 2015

@wonderfly

This comment has been minimized.

Copy link
Contributor Author

commented Jan 9, 2015

From rmis...@google.com on August 22, 2012 13:40:30

Status: Fixed

@wonderfly wonderfly closed this Jan 9, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.