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

Handle empty string pattern in NumberConverter

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.0-beta-1
    • 2.0.0-beta-1
    • Components
    • None
    • environment independent

    Description

      "pattern" attribute of convertNumber component is defined of type String, thus if this attribute is bound to an EL expression, the value will be evaluated to an empty string if no value is obtained from that expression. Example: (here format property of Empno in bindings is not defined, thus null, the the whole expression is evaluated to be an empty string because the type is String)

      <af:inputText value="#

      {bindings.Empno.inputValue}

      " label="#

      {bindings.Empno.hints.label}

      "
      required="#

      {bindings.Empno.hints.mandatory}

      "
      columns="#

      {bindings.Empno.hints.displayWidth}

      "
      maximumLength="#

      {bindings.Empno.hints.precision}

      "
      shortDesc="#

      {bindings.Empno.hints.tooltip}

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

      {bindings.Empno.validator}

      "/>
      <af:attributeDragSource attribute="value"/>
      <af:convertNumber groupingUsed="false" pattern="#

      {bindings.Empno.format}

      "/>
      </af:inputText>

      Empty string of pattern causes all sorts of undesired behavior, we need to override getPattern() method on NumberConverter so that empty string is treated as null.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            gabrielle Gabrielle Crawford
            jingwu Jing Wu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment