Custom Validators do not lookup resources from their own .properties files
--------------------------------------------------------------------------

                 Key: WICKET-4456
                 URL: https://issues.apache.org/jira/browse/WICKET-4456
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.5.4
            Reporter: Juha Syrjälä


I have a custom MyValidator.java and corresponding MyValidator.properties that 
contains translations for errors. This is working with Wicket 1.4.18 and 
1.4.19. The same thing is not working with Wicket 1.5.4.

I get following message when MyValidator triggers in Wicket 1.5:

Could not locate error message for component: TextField@form:field and error: 
[ValidationError message=[null], keys=[MyValidator.invalid], variables=[null]]. 
Tried keys: field.MyValidator.invalid, MyValidator.invalid.

I get following message in Wicket 1.4:

This is MyValidator msg

-----

According the log, the MyValidator.properties is not read at all in Wicket 1.5:

DEBUG - Localizer                  - Locate property: key: 
'field.MyValidator.invalid'; Component: '[TextField [Component id = field]]'
DEBUG - ponentStringResourceLoader - component: '[TextField [Component id = 
field]]'; key: 'field.MyValidator.invalid'
DEBUG - ponentStringResourceLoader - key: 
'form.field.field.MyValidator.invalid'; class: 'com.mycompany.HomePage'; 
locale: 'fi_FI'; Style: 'null'; Variation: 'null'
DEBUG - ponentStringResourceLoader - key: 'field.MyValidator.invalid'; class: 
'com.mycompany.HomePage'; locale: 'fi_FI'; Style: 'null'; Variation: 'null'
DEBUG - ponentStringResourceLoader - key: 'field.field.MyValidator.invalid'; 
class: 'com.mycompany.HomePage$1'; locale: 'fi_FI'; Style: 'null'; Variation: 
'null'
DEBUG - ponentStringResourceLoader - key: 'field.MyValidator.invalid'; class: 
'com.mycompany.HomePage$1'; locale: 'fi_FI'; Style: 'null'; Variation: 'null'
DEBUG - ponentStringResourceLoader - key: 'field.MyValidator.invalid'; class: 
'org.apache.wicket.markup.html.form.TextField'; locale: 'fi_FI'; Style: 'null'; 
Variation: 'null'
DEBUG - ponentStringResourceLoader - component: '[TextField [Component id = 
field]]'; key: 'field.MyValidator.invalid'
DEBUG - ponentStringResourceLoader - component: '[TextField [Component id = 
field]]'; key: 'field.MyValidator.invalid'
DEBUG - ponentStringResourceLoader - key: 
'form.field.field.MyValidator.invalid'; class: 
'com.mycompany.WicketApplication'; locale: 'fi_FI'; Style: 'null'; Variation: 
'null'
INFO  - PropertiesFactory          - Loading properties files from 
jar:file:/C:/Users/K838349/.m2/repository/org/apache/wicket/wicket-core/1.5.4/wicket-core-1.5.4.jar!/org/apache/wicket/Application_fi.properties
 with loader 
org.apache.wicket.resource.IsoPropertiesFilePropertiesLoader@1fac852
INFO  - PropertiesFactory          - Loading properties files from 
jar:file:/C:/Users/K838349/.m2/repository/org/apache/wicket/wicket-core/1.5.4/wicket-core-1.5.4.jar!/org/apache/wicket/Application.properties
 with loader 
org.apache.wicket.resource.IsoPropertiesFilePropertiesLoader@1fac852
DEBUG - ponentStringResourceLoader - key: 'field.MyValidator.invalid'; class: 
'com.mycompany.WicketApplication'; locale: 'fi_FI'; Style: 'null'; Variation: 
'null'
DEBUG - ponentStringResourceLoader - key: 'field.field.MyValidator.invalid'; 
class: 'com.mycompany.WicketApplication'; locale: 'fi_FI'; Style: 'null'; 
Variation: 'null'
DEBUG - ponentStringResourceLoader - key: 'field.MyValidator.invalid'; class: 
'com.mycompany.WicketApplication'; locale: 'fi_FI'; Style: 'null'; Variation: 
'null'
DEBUG - ponentStringResourceLoader - key: 'field.MyValidator.invalid'; class: 
'com.mycompany.WicketApplication'; locale: 'fi_FI'; Style: 'null'; Variation: 
'null'
DEBUG - ponentStringResourceLoader - key: 'field.MyValidator.invalid'; class: 
'org.apache.wicket.validation.ValidatorAdapter'; locale: 'fi_FI'; Style: 
'null'; Variation: 'null'
DEBUG - ponentStringResourceLoader - key: 'field.MyValidator.invalid'; class: 
'org.apache.wicket.validation.validator.StringValidator$MaximumLengthValidator';
 locale: 'fi_FI'; Style: 'null'; Variation: 'null'
DEBUG - ponentStringResourceLoader - key: 'field.MyValidator.invalid'; class: 
'org.apache.wicket.Initializer'; locale: 'fi_FI'; Style: 'null'; Variation: 
'null'
DEBUG - Localizer                  - Property not found; key: 
'field.MyValidator.invalid'; Component: '[TextField [Component id = field]]'
DEBUG - Localizer                  - Property found in cache: 
'field.MyValidator.invalid'; Component: '[TextField [Component id = field]]'; 
value: 'null'
DEBUG - Localizer                  - Locate property: key: 
'MyValidator.invalid'; Component: '[TextField [Component id = field]]'
DEBUG - ponentStringResourceLoader - component: '[TextField [Component id = 
field]]'; key: 'MyValidator.invalid'
DEBUG - ponentStringResourceLoader - key: 'form.field.MyValidator.invalid'; 
class: 'com.mycompany.HomePage'; locale: 'fi_FI'; Style: 'null'; Variation: 
'null'
DEBUG - ponentStringResourceLoader - key: 'MyValidator.invalid'; class: 
'com.mycompany.HomePage'; locale: 'fi_FI'; Style: 'null'; Variation: 'null'
DEBUG - ponentStringResourceLoader - key: 'field.MyValidator.invalid'; class: 
'com.mycompany.HomePage$1'; locale: 'fi_FI'; Style: 'null'; Variation: 'null'
DEBUG - ponentStringResourceLoader - key: 'MyValidator.invalid'; class: 
'com.mycompany.HomePage$1'; locale: 'fi_FI'; Style: 'null'; Variation: 'null'
DEBUG - ponentStringResourceLoader - key: 'MyValidator.invalid'; class: 
'org.apache.wicket.markup.html.form.TextField'; locale: 'fi_FI'; Style: 'null'; 
Variation: 'null'
DEBUG - ponentStringResourceLoader - component: '[TextField [Component id = 
field]]'; key: 'MyValidator.invalid'
DEBUG - ponentStringResourceLoader - component: '[TextField [Component id = 
field]]'; key: 'MyValidator.invalid'
DEBUG - ponentStringResourceLoader - key: 'form.field.MyValidator.invalid'; 
class: 'com.mycompany.WicketApplication'; locale: 'fi_FI'; Style: 'null'; 
Variation: 'null'
DEBUG - ponentStringResourceLoader - key: 'MyValidator.invalid'; class: 
'com.mycompany.WicketApplication'; locale: 'fi_FI'; Style: 'null'; Variation: 
'null'
DEBUG - ponentStringResourceLoader - key: 'field.MyValidator.invalid'; class: 
'com.mycompany.WicketApplication'; locale: 'fi_FI'; Style: 'null'; Variation: 
'null'
DEBUG - ponentStringResourceLoader - key: 'MyValidator.invalid'; class: 
'com.mycompany.WicketApplication'; locale: 'fi_FI'; Style: 'null'; Variation: 
'null'
DEBUG - ponentStringResourceLoader - key: 'MyValidator.invalid'; class: 
'com.mycompany.WicketApplication'; locale: 'fi_FI'; Style: 'null'; Variation: 
'null'
DEBUG - ponentStringResourceLoader - key: 'MyValidator.invalid'; class: 
'org.apache.wicket.validation.ValidatorAdapter'; locale: 'fi_FI'; Style: 
'null'; Variation: 'null'
DEBUG - ponentStringResourceLoader - key: 'MyValidator.invalid'; class: 
'org.apache.wicket.validation.validator.StringValidator$MaximumLengthValidator';
 locale: 'fi_FI'; Style: 'null'; Variation: 'null'
DEBUG - ponentStringResourceLoader - key: 'MyValidator.invalid'; class: 
'org.apache.wicket.Initializer'; locale: 'fi_FI'; Style: 'null'; Variation: 
'null'
DEBUG - Localizer                  - Property not found; key: 
'MyValidator.invalid'; Component: '[TextField [Component id = field]]'
DEBUG - Localizer                  - Property found in cache: 
'MyValidator.invalid'; Component: '[TextField [Component id = field]]'; value: 
'null'
WARN  - FormComponent              - Could not locate error message for 
component: TextField@form:field and error: [ValidationError message=[null], 
keys=[MyValidator.invalid], variables=[null]]. Tried keys: 
field.MyValidator.invalid, MyValidator.invalid.
onerror


I will attach quickstarts from Wicket 1.4 and Wicket 1.5 versions.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to