fix: remove try-catch blocks that swallow exceptions#232
Merged
codebutler merged 2 commits intomasterfrom Feb 17, 2026
Merged
Conversation
- Replace deprecated compose.foundation/material3/materialIconsExtended with version catalog entries (libs.compose.*) - Add @OptIn for ExperimentalWasmDsl in app/web and ExperimentalKotlinGradlePluginApi in tools/mdst - Remove unnecessary elvis operators on non-null UnauthorizedException.message - Remove unnecessary !! on non-null exception messages in DesfireProtocolTest - Remove redundant type checks (assertTrue(x is T)) where compiler already knows the type from generic return types - Remove unnecessary casts after smart casts from assertTrue contracts - Remove unnecessary safe calls on non-null receivers - Clean up unused imports via ktlintFormat Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace exception-swallowing catch blocks with proper root cause fixes: - En1545 parsers (FixedInteger, FixedHex, Bitmap, Repeat, FixedString): Replace try-catch around bitParser with bounds checking (off + len <= b.size * 8) before calling bitParser. The root cause was ArrayIndexOutOfBoundsException on truncated card data. - Oyster (Transaction, Refill, TravelPass): Replace try-catch with block bounds checking (block < sector.blocks.size). The root cause was potential IndexOutOfBoundsException on partially-read cards. - SmartRiderTagRecord: Remove dead try-catch around readASCII(). After isASCII() returns true, readASCII() cannot throw. - App.kt: Remove try-catch around sample import so errors bubble up to the user instead of being silently swallowed. - ByteUtils.getHexString: Remove dead try-catch. getHexString(b) only iterates bytes and appends hex chars — it cannot throw. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
bitParserwith bounds checking (off + len <= b.size * 8). Root cause wasArrayIndexOutOfBoundsExceptionon truncated card data.block < sector.blocks.size). Root cause was potentialIndexOutOfBoundsExceptionon partially-read cards.readASCII()— afterisASCII()returns true,readASCII()cannot throw.getHexString(b)only iterates bytes and appends hex chars, it cannot throw.Test plan
allTests)🤖 Generated with Claude Code