Skip to content

Refactor: surface static-init failures as ExceptionInInitializerError - #51

Merged
garydgregory merged 3 commits into
apache:mainfrom
ppkarwasz:refactor/static-init-error-wrapping
Aug 26, 2026
Merged

Refactor: surface static-init failures as ExceptionInInitializerError#51
garydgregory merged 3 commits into
apache:mainfrom
ppkarwasz:refactor/static-init-error-wrapping

Conversation

@ppkarwasz

Copy link
Copy Markdown
Member

The JVM wraps any exception thrown during static initialization in ExceptionInInitializerError, so the HardeningException wrapper in the two resolver floors never reached callers as IllegalStateException. The helpers now declare the checked exceptions they naturally throw, and the static initializer rethrows ExceptionInInitializerError directly.

These exceptions are very unlikely to ever occur, but if they occur, they'll have one less level of nesting.

ppkarwasz and others added 3 commits August 26, 2026 18:27
The JVM wraps any exception thrown during static initialization in
ExceptionInInitializerError, so the HardeningException wrapper in the
two resolver floors never reached callers as IllegalStateException. The
helpers now declare the checked exceptions they naturally throw, and the
static initializer rethrows ExceptionInInitializerError directly.

Assisted-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jvd3SdALeiMvRPBe3Y7Cdp
…error-wrapping

# Conflicts:
#	src/main/java/org/apache/commons/xml/FallbackIgnoreURIResolver.java
@garydgregory garydgregory changed the title refactor: surface static-init failures as ExceptionInInitializerError Refactor: surface static-init failures as ExceptionInInitializerError Aug 26, 2026
@garydgregory
garydgregory merged commit 41ce0d4 into apache:main Aug 26, 2026
@ppkarwasz
ppkarwasz deleted the refactor/static-init-error-wrapping branch August 26, 2026 16:53
@garydgregory

Copy link
Copy Markdown
Member

Ah, crud, the GH conflict resolution I tried bombed.

garydgregory added a commit that referenced this pull request Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants