Skip to content

fix: Drop TypeMapper from exception and security paths#85

Merged
thced merged 1 commit into
masterfrom
fix/exception-handler-type-mapper
May 21, 2026
Merged

fix: Drop TypeMapper from exception and security paths#85
thced merged 1 commit into
masterfrom
fix/exception-handler-type-mapper

Conversation

@thced

@thced thced commented May 20, 2026

Copy link
Copy Markdown
Contributor

Mirror PR #76's approach (HealthRenderer) for the problem+json wire shape. The default exception handler and SecurityFilter no longer route ProblemDetail through a TypeMapper; a hand-rolled ProblemDetailRenderer writes the fixed RFC 7807 shape directly, so the library emits problem responses without a JSON library on the classpath and without record-accessor reflection that GraalVM Native Image would otherwise need configured.

Also replace the reflective GsonJsonMapper newInstance with a direct constructor call, still gated by the existing Class.forName Gson-presence probe. Drops the matching reflect-config entry for the constructor.

Extract the shared JSON string-escape into internal/JsonStrings, used by both HealthRenderer and ProblemDetailRenderer.

BREAKING CHANGE: Handlers.defaultExceptionHandler(TypeMapper) becomes defaultExceptionHandler(). SecurityFilter constructor drops its TypeMapper parameter.

Mirror PR #76's approach (HealthRenderer) for the problem+json wire shape.
The default exception handler and SecurityFilter no longer route ProblemDetail
through a TypeMapper; a hand-rolled ProblemDetailRenderer writes the fixed
RFC 7807 shape directly, so the library emits problem responses without a
JSON library on the classpath and without record-accessor reflection that
GraalVM Native Image would otherwise need configured.

Also replace the reflective GsonJsonMapper newInstance with a direct
constructor call, still gated by the existing Class.forName Gson-presence
probe. Drops the matching reflect-config entry for the constructor.

Extract the shared JSON string-escape into internal/JsonStrings, used by
both HealthRenderer and ProblemDetailRenderer.

BREAKING CHANGE: Handlers.defaultExceptionHandler(TypeMapper) becomes
defaultExceptionHandler(). SecurityFilter constructor drops its
TypeMapper parameter.
@thced thced force-pushed the fix/exception-handler-type-mapper branch from c606fde to fee86f9 Compare May 20, 2026 18:11
@sonarqubecloud

Copy link
Copy Markdown

@sasjo sasjo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perfect for GraalVM native image!

@thced thced merged commit d61095a into master May 21, 2026
5 checks passed
@thced thced deleted the fix/exception-handler-type-mapper branch May 21, 2026 05:46
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