fix(android): fix resource leak in FileUtils.readFileToByteArray()#4553
Open
hobostay wants to merge 1094 commits intoTencent:mainfrom
Open
fix(android): fix resource leak in FileUtils.readFileToByteArray()#4553hobostay wants to merge 1094 commits intoTencent:mainfrom
hobostay wants to merge 1094 commits intoTencent:mainfrom
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
* feat(react): add animation stop * feat(web): fix image local path * feat(web): remove unused code
* feat(react): add animation stop * feat(chore): romove security check * chore(react): remove unused code
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 |
Member
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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