Repository navigation
ref: Narrow Throwable catches to the exceptions they guard (JAVA-552) - #6669
Draft
runningcode wants to merge 6 commits into
Draft
runningcode wants to merge 6 commits into
runningcode wants to merge 6 commits into
Conversation
Replace catch (Throwable) with the exceptions the guarded code can throw, so SDK bugs and fatal errors at these sites are no longer swallowed. Most are RejectedExecutionException around executor submit and schedule, IOException or SecurityException around file I/O, and the specific parsing exceptions. Several tests only passed because these catches hid mocks that don't behave like the real objects. They now do. Refs #5513 Refs JAVA-552 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 18, 2026
This was referenced Nov 18, 2026
Contributor
🚨 Detected changes in high risk code 🚨High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 18, 2026
Closed
📲 Install BuildsAndroid
|
The fixes to existing tests whose mocks only passed behind broad catches stay. Refs #5513 Refs JAVA-552 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
SentryEnvelopeItem.fromClientReport only throws IOException. The name is fully qualified so this PR doesn't touch the import block, where #6665 adds ExceptionUtils right next to it. Refs #5513 Refs JAVA-552 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eny file access FileOutputStream and File.isFile throw SecurityException when a JVM SecurityManager denies access, so the narrowed catches around the crash marker, the session file and the config file catch it too. Refs #5513 Refs JAVA-552 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 19, 2026
This branch has not been deployed
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.
📜 Description
Replaces
catch (Throwable)with the exceptions the guarded code can actually throw, so SDK bugs and fatal errors at these sites are no longer swallowed.Exceptions:
ExceptionorRuntimeException, because the guarded code is declared to throwException, throws a plainRuntimeException, or is the app's class loader. Each has a comment saying why.Buildfield reads catchNullPointerException, because those fields are only null off-device, such as in unit tests.CanvasStrategy.postSafelydrops its catch and checks the result ofHandler.post, which returnsfalseinstead of throwing when the looper is quitting.Future.get()catches inDefaultAndroidEventProcessoralso restore the interrupt flag.ClientReportRecorderuses a fully qualifiedjava.io.IOExceptionto avoid an import conflict with fix: Rethrow fatal errors at the SDK's boundary catches (JAVA-552) #6665.💡 Motivation and Context
This is part of the
catch (Throwable)audit. It's independent of the other JAVA-552 PRs, so it can merge in any order.💚 How did you test it?
No new tests. Some existing tests only passed because these catches hid mocks and fakes that don't behave like the real code, so those are fixed.
📝 Checklist
sendDefaultPIIis enabled.#skip-changelog
🤖 Generated with Claude Code