ClassCastException in ApacheHttpRequest.setContent #122
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
🚨
This issue needs some love.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
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
The text was updated successfully, but these errors were encountered: