Skip to content

ref: Remove Throwable catches that guard nothing (JAVA-552) - #6565

Merged
runningcode merged 1 commit into
9.x.xfrom
no/java-552-remove-unneeded-throwable-catches
Nov 12, 2026
Merged

runningcode merged 1 commit into
9.x.xfrom
no/java-552-remove-unneeded-throwable-catches

Conversation

@runningcode

@runningcode runningcode commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

📜 Description

Remove catch (Throwable) around code that can't throw anything. I had my agent check the history and it couldn't find anything as to why these exist except that they covered different versions of the code that may have needed it before.

  • CheckInUtils, SpanUtils and TracingUtils: FilterString.matches uses a pattern that
    FilterString already compiled, so the "invalid regex" catch can't trigger.

💡 Motivation and Context

This is part of the catch (Throwable) audit. #6564 narrows the catches whose failures are known,
and this PR removes the ones that guard nothing. It doesn't depend on #6564.

💚 How did you test it?

Ran the unit tests of sentry, sentry-android-core and sentry-jdbc.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

🤖 Generated with Claude Code

#skip-changelog

Nothing in these try blocks can throw, other than an SDK bug or a fatal error that should
not be swallowed: FilterString.matches with its precompiled pattern, the StatFs getters, the
log and metrics attribute setters, the SHA-1 hash, a substring that is already bounds checked,
Baggage's outer header loop, and a submit whose RejectedExecutionException is already caught.

Refs JAVA-552

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Nov 11, 2026

Copy link
Copy Markdown

JAVA-552

@sentry

sentry Bot commented Nov 11, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.63.0 (1) release

⚙️ sentry-android Build Distribution Settings

@runningcode
runningcode marked this pull request as ready for review November 11, 2026 15:28
@runningcode
runningcode requested review from a team and adinauer as code owners November 11, 2026 15:28
@runningcode
runningcode requested review from markushi and romtsn and removed request for a team November 11, 2026 15:28
@runningcode runningcode added the ship-it PR is ready to merge from a reviewer perspective label Nov 11, 2026

@markushi markushi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one, LGTM!

@runningcode
runningcode merged commit d28f388 into 9.x.x Nov 12, 2026
49 of 52 checks passed
@runningcode
runningcode deleted the no/java-552-remove-unneeded-throwable-catches branch November 12, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ship-it PR is ready to merge from a reviewer perspective

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants