TeeInputStream.close skips source cleanup when closing the destination fails

未關閉 適合新手
#329 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
83/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
java
領域
backend

研究方向

閱讀 org.eclipse.jgit/src/org/eclipse/jgit/util/io/TeeInputStream.java,尤其是連結行附近的 close(),並檢查相鄰串流的測試,了解現有的關閉與例外處理模式。重現目標串流關閉時擲出例外的回報案例,並檢查排空時的失敗。完成條件是:發生失敗後仍會嘗試呼叫兩個委派物件;第一個例外會傳遞給呼叫端,後續例外會以 suppressed 形式附加;測試涵蓋這些情況。

由索引模型根據 Issue 內容生成。

描述

Version

JGit 7.8.1.202611041320-r, OpenJDK 21, macOS.

Bug description

When a caller closes a TeeInputStream, it drains the remaining input, closes the destination, and then closes the source. An exception from the destination's close() skips the source's close(). An exception during the drain skips both close calls. TeeInputStream.close() in 7.8.1

Actual behavior

I checked the public wrapper directly using an empty in-memory input and an in-memory output. With both delegates closing normally, each received one close call. When the output's close method threw an IOException, the wrapper propagated that exception and the input received zero close calls.

Expected behavior

After attempting the drain, the wrapper should attempt to close both delegates even if an earlier operation failed. The first failure should reach the caller, with any later close failures available as suppressed exceptions.

AI assistance was used to prepare this report.

主要語言
Java
星號
427
分支
116
PR 合併指標
30 天內沒有已合併 PR

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

eclipse-jgit/jgit 的其他 Issue

查看 eclipse-jgit/jgit 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。