You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2013/08/01 09:45:49 UTC

[jira] [Commented] (WICKET-5293) MessageSource resource key traversal logic short-circuited and throws exception when useDefaultOnMissingResource is false and throwExceptionOnMissingResource is true

    [ https://issues.apache.org/jira/browse/WICKET-5293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13726180#comment-13726180 ] 

Martin Grigorov commented on WICKET-5293:
-----------------------------------------

The patch breaks the conversion messages.

See org.apache.wicket.markup.html.form.LocalizedErrorMessageTest

Caused by: java.util.MissingResourceException: Unable to find any matching property for component: form:field [class=org.apache.wicket.markup.html.form.TextField] Tried keys: 'field.IConverter.Double', 'IConverter.Double'
	at org.apache.wicket.markup.html.form.FormComponent$MessageSource.createMissingResourceException(FormComponent.java:207)
	at org.apache.wicket.markup.html.form.FormComponent$MessageSource.getMessage(FormComponent.java:172)
	at org.apache.wicket.validation.ValidationError.getErrorMessage(ValidationError.java:230)
	at org.apache.wicket.markup.html.form.FormComponent.error(FormComponent.java:710)
	at org.apache.wicket.markup.html.form.FormComponent.convertInput(FormComponent.java:1237)
	at org.apache.wicket.markup.html.form.AbstractTextComponent.convertInput(AbstractTextComponent.java:130)
	at org.apache.wicket.markup.html.form.FormComponent.validate(FormComponent.java:1183)
	....
                
> MessageSource resource key traversal logic short-circuited and throws exception when useDefaultOnMissingResource is false and throwExceptionOnMissingResource is true
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-5293
>                 URL: https://issues.apache.org/jira/browse/WICKET-5293
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.10, 6.9.1
>         Environment: OS X
>            Reporter: Liam Clarke
>            Assignee: Martin Grigorov
>            Priority: Minor
>         Attachments: fix-WICKET-5-5293.patch, fix-WICKET-6-5293.patch, quickstartWicket1.5.10.zip, quickstartWicket6.9.1.zip
>
>
> MessageSource, when dealing with a validation error, will traverse resource keys from most specific to most general. This mechanism allows you to use one resource across multiple validators.
> However, as it uses a Localizer to check for the existence of the most specific message, it will never try any more general resource keys when getApplication().getResourceSettings().getUseDefaultOnMissingResource is false and getApplication().getResourceSettings().getThrowExceptionOnMissingResource is true - the Localizer throws the exception which MessageSource.getMessage does not handle.
> This means that you cannot reuse resources by giving them generalised keys. 
> Please see the attached quick starts for working demonstrations.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira