私はcom.google.api.client.http.HttpResponse
オブジェクトをクローズしようとしていますを閉じて、私は、Eclipseのエラーを取得する方法com.google.api.client.http.HttpResponseオブジェクトを適切
ライン上の未処理の例外タイプのIOException
response.disconnect();
ここでは、コードの例です:
HttpRequest request = null;
HttpResponse response = null;
try {
request = this.buildJsonApiRequest(apiUrl);
response = this.execute(request);
return response.parseAs(MyClass.class);
} catch (final IOException e) {
throw new DaoException(e);
} finally {
if (response != null) {
response.disconnect();
}
}
コードはfinally
ブロックなしで機能しますが、私は開いているクローズされていない多くの応答オブジェクトが心配です。これを行う適切な方法は何ですか?
私は本当に 'parseAs()' APIメソッドがストリームを閉じるかどうか知りたいです...私はこのメソッドの実装に関する情報を見つけることはできません。 – mhatch