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

Null pattern handling in DateTimeConverter is inconsistent

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.0.0-beta-1
    • 2.0.0-beta-1
    • Components
    • None
    • Linux x86

    Description

      For null patterns, the getPattern() method in DateTimeConverter returns null in non-Facelets and empty string in Facelets due to TRINIDAD-381. This is causing inconsistent behavior depending on whether Facelets or non-Facelets is used. Some of the code in DateTimeConverter does attempt to handle both null and empty string patters such as in _getDateFormat() but most of the methods simply check if the pattern is null. It is better to modify getPattern() to always return null when pattern is either null or empty string.
      One example of a problem this inconsistent handling of pattern is causing is that when we have a DateTime component such as:

      <af:inputDate value="#

      {bindings.Hiredate.inputValue}

      "
      label="#

      {bindings.Hiredate.hints.label}

      "
      required="#

      {bindings.Hiredate.hints.mandatory}

      "
      shortDesc="#

      {bindings.Hiredate.hints.tooltip}

      " id="id1">
      <f:validator binding="#

      {bindings.Hiredate.validator}

      "/>
      <af:convertDateTime pattern="#

      {bindings.Hiredate.format}

      "/>
      </af:inputDate>

      And pattern is null then depending on whether we are using Facelets or non-Facelets when the user picks a date value it ends up getting formatted differently. And it's happening because getJSPattern() in DateTimeConverter only checks for null.

      Attachments

        1. bug08927847.patch
          0.8 kB
          Kentaro Kinebuchi

        Activity

          People

            gabrielle Gabrielle Crawford
            kentarokinebuchi Kentaro Kinebuchi
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: