exchange: SerializeUtil.deserialize の後始末(未クローズと getNextEntry の未検査)

Open Beginner friendly
#1,884 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java
Domain
backend

Research direction

Open com.microproject.exchange.serialize.SerializeUtil.deserialize around the cited lines, then inspect the microproject_exchange test layout and add a test for an empty ZIP. Confirm the current exception, then check that the revised behavior reports an explicit error and that the streams are closed with try-with-resources. Run .\gradlew.bat :microproject_exchange:test --console=plain; done means the test and module checks pass.

Written by the indexing model from the issue text.

Description

area: exchange bug priority: low

概要

com.microproject.exchange.serialize.SerializeUtil.deserialize(master b14ae24 時点、L94 以降)の後始末が不完全である。入力ストリームと Zip ストリームが閉じられず、zin.getNextEntry() の戻り値(L99)が検査されないため、空の ZIP では後続処理で分かりにくい例外になる。メモリ上のストリームが対象のため実害は小さいが、入力の入口としての作法の問題である。コードの静的確認で見つけた指摘で、行番号は master b14ae24 時点。

作業手順

  1. 空の ZIP を渡すテストを書き、現在の例外の出方を確認する。
  2. try-with-resources で閉じるよう直し、getNextEntry() の null を明示的なエラーにする。

検証

.\gradlew.bat :microproject_exchange:test --console=plain

完了条件

  • 空の ZIP で明示的なエラーになるテストがあり、修正前に失敗し、修正後に通る
  • ストリームが try-with-resources で閉じられる
  • :microproject_exchange:test が通る
  • git diff --check が空である
  • PR の build と GUI acceptance が通る

範囲外

  • デシリアライズ形式の変更
Dominant language
Java
Stars
2
Forks
1
Avg merge
4h 20m
Merged PRs (30d)
409

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tetsuji16/microProject

All issues in tetsuji16/microProject

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.