Skip to content

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

Open
runningcode wants to merge 1 commit into
9.x.xfrom
no/java-552-remove-unneeded-throwable-catches
Open

runningcode wants to merge 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

This branch has not been deployed

No deployments
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.

1 participant