You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Custom reason is overwritten by i18n message in ResponseStatusException.updateAndGetBody()Â #36984
In cases where reason on ResponseStatusException is not manually set, I expect localization key equal to problemDetail.org.springframework.web.server.ResponseStatusException to act as a fallback; but since super.updateAndGetBody() is called before instead of after custom logic, this localization acts as an overwrite instead.
Hi team! I think I've spotted the issue hereâit looks like the call to super.updateAndGetBody() is overriding the custom logic. Reordering this should resolve the fallback issue, and Iâd be happy to put together a PR if you're open to it!
changed the title [-]Wrong localization order in ResponseStatusException.updateAndGetBody()[/-][+]Custom reason is overwritten by i18n message in ResponseStatusException.updateAndGetBody()[/+]on Sep 22, 2026
After having a proper look, I don't think reordering is enough. Taking a step back, the main problem is that the order of preference for the detail message is not strictly enforced; it should be:
If a custom reason is defined, it should be used
if the reason is a message code and it can be resolved, we should use
if no reason is provided, we should use the message resolved from the default message code
The issue here is that ResponseStatusException#updateAndGetBody can override custom reason messages and only 2 and 3 are covered.
Activity
Mhmoud803 commentedon Jun 30, 2026
Hi team! I think I've spotted the issue hereâit looks like the call to super.updateAndGetBody() is overriding the custom logic. Reordering this should resolve the fallback issue, and Iâd be happy to put together a PR if you're open to it!
[-]Wrong localization order in ResponseStatusException.updateAndGetBody()[/-][+]Custom reason is overwritten by i18n message in ResponseStatusException.updateAndGetBody()[/+]bclozel commentedon Sep 22, 2026
After having a proper look, I don't think reordering is enough. Taking a step back, the main problem is that the order of preference for the detail message is not strictly enforced; it should be:
The issue here is that
ResponseStatusException#updateAndGetBodycan override custom reason messages and only 2 and 3 are covered.github-actions commentedon Sep 22, 2026
Fixed via 7be3a61
ResponseStatusException should not override custom reason