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

AbstractRangeValidator looks up string with the wrong key if locale is Turkish

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 7.6.0
    • 7.11.0, 8.2.0, 9.0.0-M1
    • wicket-core
    • None

    Description

      If you run your Wicket application on a system with Turkish locale, and you're using `StringValidator`, the string key you end up looking up is `"StringValidator.mınımum"`, when it should be `"StringValidator.minimum"`. This results in either an empty message or an exception, depending on the resource settings for the application.

      `AbstractRangeValidator` turns out to have this:

      	public static enum Mode {
      		MINIMUM, MAXIMUM, RANGE, EXACT;
      
      		public String getVariation()
      		{
      			return name().toLowerCase();
      		}
      	}
      

      This `toLowerCase()` should probably be `toLowerCase(Locale.ROOT)`.

      I'd also recommend setting up forbidden-apis or similar to catch similar issues at build-time.

      Attachments

        1. WICKET-6614.patch
          0.9 kB
          Trejkaz
        2. report.txt
          331 kB
          Trejkaz

        Activity

          People

            svenmeier Sven Meier
            trejkaz Trejkaz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: