fix(android): close hash and random-access files before settling - #158
Closed
OskarEichler wants to merge 1 commit into
Closed
fix(android): close hash and random-access files before settling#158OskarEichler wants to merge 1 commit into
OskarEichler wants to merge 1 commit into
Conversation
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.
Fixes
Close hash/read and random-access write handles before promise completion. Preserve the original error when closing also fails, and avoid double-close paths. Replace a per-call six-entry hash-algorithm map and per-byte String.format with direct dispatch and hexadecimal character lookup. Accept extensionless raw-resource names; preserve existing extension-based routing and document it.
Compatibility / observable changes
No public signatures, algorithms or digest output change. Close failures now reject instead of resolving first or escaping after settlement. Extensionless names resolve through res/raw rather than throwing a substring-index error.
Verification
Actual Kotlin method bodies with real temporary file data and instrumented I/O constructors: all six digest algorithms at 0, 1, 255 and 20,000 bytes match Java MessageDigest/HexFormat; append/random-access writes cover success, write failure, close failure and combined errors. Thirty of 33 baseline lifetime/error checks fail; all 33 fixed cases pass. Four actual resource-name mapping cases pass (one baseline failure). Fewer formatting/map allocations follow directly from the code change; no app-wide speedup is claimed.
Shared checks and limits
Combined upstream lint/TypeScript and whitespace checks pass. Full Android Kotlin compilation against RN 0.87.1 and all six Apple implementation compilations against the iOS Simulator SDK pass. No checked-in tests/specs changed; diagnostic harnesses live outside the repository. Simulated/native-API-double checks are not physical-device verification. Consumer pin 99772cc: immutable install/lint, both Android Debug flavors and both iOS Simulator schemes pass. All 72 installed non-metadata files match reviewed source/build artifacts. JS/declarations are unchanged from the preceding verified pin, which passed four Metro bundles, 13 web builds and four extensions. Windows runtime and physical devices remain unverified.