artiya4u / google-http-java-client

Automatically exported from code.google.com/p/google-http-java-client
0 stars 0 forks source link

Bug in parseAs when NetHttpTransport is used #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
public <T> T parseAs(Class<T> dataClass) throws IOException {
    HttpParser parser = getParser();
    if (parser == null) {
      InputStream content = getContent(); <-- !!!!!!!! THIS WON"T BE NULL FOR EMPTY RESPONSE WHEN NetHttpTransport is USED. WORKS FINE FOR ApacheHttpTransport !!!!!!!
      if (contentType == null) {
        if (content != null) {
          throw new IllegalArgumentException(
              "Missing Content-Type header in response: " + parseAsString());
        }
        return null;
      }
      throw new IllegalArgumentException("No parser defined for Content-Type: " + contentType);
    }
    return parser.parse(this, dataClass);
  }

Original issue reported on code.google.com by alexey.v...@gmail.com on 24 Sep 2011 at 9:14

GoogleCodeExporter commented 9 years ago
http://codereview.appspot.com/5128052/

Original comment by yan...@google.com on 31 Oct 2011 at 6:27