fix(android): fix resource leak in FileUtils.readFileToByteArray() - #4553
fix(android): fix resource leak in FileUtils.readFileToByteArray()#4553hobostay wants to merge 1094 commits into
Conversation
Tencent#2849) refactor(andr): prod remotedebug feature optimized fix(andr): prod remotedebug createDebugUrl fixed fix(andr): prod remotedebug optimize (cherry picked from commit 25cce417d76c8cc729e0be1c6909076e7cad79db) fix(andr): vue add tagName for debug in prod fix(andr): change variable mProdRemoteDebugMode to mPureDebugMode refactor(andr): add enum DebugMode to manage different mode fix(andr): optimize debugMode code fix(andr): logical judgment instead of instance variables to optimize fix(andr): fix No correct copyright header; fix(hippy-vue): fix unit test tagName fail
* feat(ios): add and correct some entries in performance logger * docs(performance): update performance guide * feat(android): record separate event for `TimeMonitor` * feat(docs): add android time monitor docs * feat(docs): add startup performance guide * feat(ios): add performanceLogger module * fix(android,js): update performance api * refactor(android): load time report * fix(android): code style problems * refactor(android): change monitor api * refactor(ios): update performance module with turbo imp * chore(android): add copyright header * refactor(android,ios): remove instanceId implement * feat(docs): add minimum support version * refactor(android): rename nativeCallback method * refactor(android): use single payload param in nativeCallback method * feat(bridge): revert style changed --------- Co-authored-by: iPel <pel20121221@gmail.com> Co-authored-by: OpenHippy <124017524+open-hippy@users.noreply.github.com>
…ng (Tencent#2521) * feat(ios): rich text images support vertical alignment setting * feat(ios): add rich text's vertical align offset support * feat(ios): margin support for nested component in richText * feat(android): add `verticalAlign` for `Image` in rich text * fix(android): backgroundColor not working in nested text * feat(android): add properties for `Image` in rich text `tintColor`, `backgroundColor`, `margin` and `padding` * feat(ios): text in rich text support verticalAlign setting * feat(android): verticalAlign for textnode * feat(android): add backgroundColor in legacy mode * fix(android): baseline align offset wrong * feat(ios): support nested text verticalAlign style setting * fix(android): verticalAlign for boringLayout * chore(docs): add verticalAlign docs * chore(ios): make verticalAlign default value baseline * feat(vue): update text demo * chore(ios): add verticalAlign and update demo * chore(docs): update verticalAlign minimum supported version --------- Co-authored-by: iPel <pel20121221@gmail.com> Co-authored-by: luomy <ozonelmy@163.com> Co-authored-by: OpenHippy <124017524+open-hippy@users.noreply.github.com>
* fix(android): textInput may throw IllegalStateException * fix(android): textInput may throw IllegalStateException --------- Co-authored-by: OpenHippy <124017524+open-hippy@users.noreply.github.com>
* fix(android): fix unit test case * fix(android): add license header
feat(docs): add en docs for UserLocal debug mode;
and fix build error
The readFileToByteArray() method did not properly close FileInputStream and ByteArrayOutputStream when exceptions occurred. If reading threw an exception, the inner catch block swallowed it and then fileReader.close() could also throw, leaving byteArrayOutputStream unclosed. Refactored to use try-finally pattern consistent with the sibling readFile() method, ensuring both streams are always closed. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Hi, @hobostay. Thanks for your PR! 👏 🏷️ You can leave a comment in this PR with |
|
Test User seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
Pay attention 🛎️ !! |
|
Sorry, closing this PR because it has stalled for over 4 months. |
Summary
FileUtils.readFileToByteArray()whereFileInputStreamandByteArrayOutputStreammay not be properly closed if an exception occurs during readingclose()outside the inner catch — but ifclose()itself threw, the second stream would leakreadFile()method, ensuring both streams are always closed in thefinallyblockBefore (buggy)
Test plan
🤖 Generated with Claude Code