org.json.JSONTokener should close or provide option to close java.io.Reader
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- java
調査の方向性
Start by reading org.json.JSONTokener and the JavaDoc describing responsibility for closing the supplied Reader. Determine whether the intended change is automatic closing or an explicit close option, then inspect existing tests or add coverage for the chosen reader-lifecycle behavior.
索引モデルが issue の本文から書いたものです。
説明
Hi,
I spent a few days trying to fix an issue where I got the following error:
java.nio.file.FileSystemException: path/to/file: The process cannot access the file because it is being used by another process.
I started using FileLock to try to get a hold on the lock and wait until the lock was released, but unfortunately for this file, it would never be released.
That is because I was using a JSONTokener to tokenize a JSON file using an anonymous FileReader. This stream would never be closed, and therefor the error mentioned above.
Because JSONTokener doesn't provide an API to close the stream provided as parameter, I have to correct my implementation like this:
Obviously after reading the class it is clear how it should be used, since it is clearly written in the JavaDoc that the Reader must be closed by the caller.
I believe this implementation could be improved.
- Implement Closeable/AutoClosable on JSONTokener and make JSONTokener throw some sort of exception to explicitly tell the user that the Reader must be closed. And then we could have a cleaner and more explicit implementation like this:
Let me know if my suggestion is outrageous. But I feel at least I should bring it here.
Thank you for your attention. :)
- 主要言語
- Java
- スター
- 4.7k
- フォーク
- 2.6k
- 平均マージ
- 6日 20時間
- マージ済み PR(30日)
- 2
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
stleary/JSON-java のほかの issue
-
Fix before the next release
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
Fix before the next release
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
stleary/JSON-java の issue をすべて見る
似ている issue
-
area/plugin
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
kestra-io/plugin-kestra#190 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
integra-team-red/meet-map#249 ·
-
[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
apache/rocketmq-dashboard#5064 ·