Uploaded image for project: 'MyFaces Trinidad'
  1. MyFaces Trinidad
  2. TRINIDAD-1524

i18n issue with (German) format pattern

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.11-core
    • 1.2.12-core
    • None
    • None

    Description

      This is not only a bug in Trinidad... It is mainly an issue in the core date_time_converter as well:

      <h:form>
      <h:messages/>
      <h:inputText value="#

      {input.date}

      " immediate="true">
      <f:convertDateTime type="both" timeStyle="full"
      timeZone="America/New_York"
      pattern="dd.MM.yyyy HH:mm' Uhr '"
      locale="de"
      />
      </h:inputText>
      <h:commandButton value="Submit" type="submit"/>
      </h:form>

      Note that the pattern is like this: dd.MM.yyyy HH:mm' Uhr '
      After the word "Uhr" there is an empty space (required by the pattern).

      Now when you enter this String "30.06.09 12:11 Uhr " (notice the empty String at the end),
      we run into the problem, that the spec wants the converter to trim leading/trailing whitespaces before proceeding. Makes sense....
      but gives us a (neat) error.

      See this JavaDoc section:
      http://java.sun.com/javaee/javaserverfaces/1.2_MR1/docs/api/javax/faces/convert/DateTimeConverter.html

      <snip>
      If the specified String is null, return a null. Otherwise, trim leading and trailing whitespace before proceeding.
      </snip>

      However, when the pattern requires an empty space at the end, we (the converter) should honor that...

      possible change in the converter code (after the trim() has been called):
      if(pattern.endsWith(" '"))

      { value += " "; }

      Attachments

        1. TRINIDAD-1524.patch
          2 kB
          Matthias Wessendorf

        Activity

          People

            matzew Matthias Wessendorf
            matzew Matthias Wessendorf
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: