javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-1935

converter attribute injection from faces-config.xml configuration does not work

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Works as designed
    • Affects Version/s: 2.0.3, 2.0.9, 2.1.16
    • Fix Version/s: None
    • Component/s: conversion
    • Labels:
      None
    • Status Whiteboard:
      Hide

      importance_high size_medium triage

      Show
      importance_high size_medium triage

      Description

      Assume converter configuration like this:

      <converter>
      <converter-id>bigDecimalConverterRoundingDown</converter-id>
      <converter-class>com.csg.jsf.converter.BigDecimalConverter</converter-class>
      <attribute>
      <attribute-name>roundingMode</attribute-name>
      <attribute-class>java.math.RoundingMode</attribute-class>
      <default-value>DOWN</default-value>
      </attribute>
      <attribute>
      <attribute-name>maxFractionDigits</attribute-name>
      <attribute-class>int</attribute-class>
      <default-value>1</default-value>
      </attribute>
      </converter>

      Now it should be possible to use this converter on any component:

      <h:inputText value="#

      {...}

      " converter="bigDecimalConverterRoundingDown" />

      Unfortunately the configured attributes are not getting applied to the converter instance that is applied to the component.

      Reading faces-config schema definition reveals:

      <xsd:complexType name="faces-config-default-valueType">
      <xsd:annotation>
      <xsd:documentation>
      The "default-value" contains the value for the property or
      attribute in which this element resides. This value differs
      from the "suggested-value" in that the property or attribute
      must take the value, whereas in "suggested-value" taking the
      value is optional.
      </xsd:documentation>
      </xsd:annotation>
      <xsd:simpleContent>
      <xsd:restriction base="javaee:string"/>
      </xsd:simpleContent>
      </xsd:complexType>

      The schema says: "the property or attribute must take the value"

      But the attributes are not applied to the freshly created converter. From the schema description for the attribute faces-default-value-type I suspect this to be an implementation bug.

        Activity

        Hide
        Ed Burns added a comment -

        Bulk assign all impl issues to Roger.

        Show
        Ed Burns added a comment - Bulk assign all impl issues to Roger.
        Hide
        Manfred Riem added a comment -

        Can you please attach a simple example application (with sources) that demonstrates the problem?

        Show
        Manfred Riem added a comment - Can you please attach a simple example application (with sources) that demonstrates the problem?
        Hide
        Hanspeter Duennenberger added a comment -

        Hi Manfred,
        attached you find a little example application showing this case. The test page (URL http://localhost:8080/jsftest-1935/validator1935.jsf) shows 3 input controls, each has a length validator with minimum=3/ maximum=20 attached.

        1. input uses a preconfigured javax.faces.validator.LengthValidator (see faces-config.xml validator-id=min3max20
        2. uses standard f:validateLength with minimum=3 and maximum=20
        3. uses a custom validator extending LengthValidator and setting minimum=3 and maximum=20 in it's default constructor, see faces-config.xml validator-id=length3to20

        Why I brought this up - well, in faces-config.xml the validator configuration allows to specify attributes - it seems these attribute configurations are never used or applied.

        Best regards
        Hanspeter

        Show
        Hanspeter Duennenberger added a comment - Hi Manfred, attached you find a little example application showing this case. The test page (URL http://localhost:8080/jsftest-1935/validator1935.jsf ) shows 3 input controls, each has a length validator with minimum=3/ maximum=20 attached. 1. input uses a preconfigured javax.faces.validator.LengthValidator (see faces-config.xml validator-id=min3max20 2. uses standard f:validateLength with minimum=3 and maximum=20 3. uses a custom validator extending LengthValidator and setting minimum=3 and maximum=20 in it's default constructor, see faces-config.xml validator-id=length3to20 Why I brought this up - well, in faces-config.xml the validator configuration allows to specify attributes - it seems these attribute configurations are never used or applied. Best regards Hanspeter
        Hide
        Manfred Riem added a comment -

        Can you verify if this is still an issue on the latest 2.1 release?

        Show
        Manfred Riem added a comment - Can you verify if this is still an issue on the latest 2.1 release?
        Hide
        Hanspeter Duennenberger added a comment -

        Hi Manfred,
        I tested with the following JSF RI versions:

        None of these JSF RI versions applies attributes configured in faces-config.xml validator configuration to the validator.

        Show
        Hanspeter Duennenberger added a comment - Hi Manfred, I tested with the following JSF RI versions: 2.2.0-SNAPSHOT/2.2.0-M06 2.1.16/2.1.17-SNAPSHOT 2.0.9 (all RI taken from https://maven.java.net/content/groups/public ) None of these JSF RI versions applies attributes configured in faces-config.xml validator configuration to the validator.
        Hide
        Manfred Riem added a comment -

        Hi Hanspeter,

        Looking at the schema it states the following in the converterType: "Nested "property" elements identify JavaBeans properties of the Converter implementation class that may be configured to affect the operation of the Converter. This attribute is primarily for design-time tools and is not specified to have any meaning at runtime."

        So I am closing this "Works as designed".

        Show
        Manfred Riem added a comment - Hi Hanspeter, Looking at the schema it states the following in the converterType: "Nested "property" elements identify JavaBeans properties of the Converter implementation class that may be configured to affect the operation of the Converter. This attribute is primarily for design-time tools and is not specified to have any meaning at runtime." So I am closing this "Works as designed".

          People

          • Assignee:
            Unassigned
            Reporter:
            Hanspeter Duennenberger
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: