Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-4456

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 1.5.4
    • None
    • wicket

    Description

      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.

      Attachments

        1. wicket-version-15-with-bug.tar.gz
          20 kB
          Juha Syrjälä
        2. wicket-version-14-without-bug.tar.gz
          5 kB
          Juha Syrjälä

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jsyrjala Juha Syrjälä
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: