Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpringNonCacheableMessageResolver swallows NoSuchMessageException #31

Open
andris-rauda opened this issue Sep 11, 2013 · 1 comment
Open

Comments

@andris-rauda
Copy link

org.springframework.context.support.AbstractMessageSource allows you to choose the way missing message resources are handled by setting setUseCodeAsDefaultMessage(boolean)
true - message's code is returned instead of message
false - NoSuchMessageException is thrown

Usually in production environment you would choose the second option (fail-fast) instead of displaying page incorrectly, which is confirmed by their javadoc: "In general, it is recommended to just use "useCodeAsDefaultMessage" during development and not rely on it in production.."

However, SpringNonCacheableMessageResolver catches NoSuchMessageException and returns null, which is replaced by message code in question marks in MessageResolutionUtils.getAbsentMessageRepresentation() thus messing up the fail-fast option.

@opensource21
Copy link

As an addition it would be good to have the possibility to set a default-text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants