GZipEncoding should throw IOException from close

オープン 初心者向け
#868 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
java
領域
api

調査の方向性

Issue に示されている GZipEncoding.encode メソッドから始め、匿名クラスでの BufferedOutputStream.close のオーバーライドと、その IOException の処理に重点を置いてください。close からの IOException が握りつぶされずに伝播することを確認し、その後プロジェクトに関連するテストを実行して、呼び出し元からエラーを確認できることを検証してください。

索引モデルが issue の本文から書いたものです。

説明

type: cleanup

The close method below swallows IOExceptions. That seems unnecessary and dangerous.

public class GZipEncoding implements HttpEncoding {

  public String getName() {
    return "gzip";
  }

  public void encode(StreamingContent content, OutputStream out) throws IOException {
    // must not close the underlying output stream
    OutputStream out2 =
        new BufferedOutputStream(out) {
          @Override
          public void close() throws IOException {
            // copy implementation of super.close(), except do not close the underlying output
            // stream
            try {
              flush();
            } catch (IOException ignored) {
                // Nothing else we can do here
            }
          }
        };
    GZIPOutputStream zipper = new GZIPOutputStream(out2);
    content.writeTo(zipper);
    // cannot call just zipper.finish() because that would cause a severe memory leak
    zipper.close();
  }
}
主要言語
Java
スター
1.4k
フォーク
473
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

googleapis/google-http-java-client のほかの issue

googleapis/google-http-java-client の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。