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

Component.getConverter is ignored by PropertyConverter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.3.0-beta1
    • 1.3.0-beta3
    • wicket
    • None
    • jdk1.4 wicket-1.3.0-incubating-beta1

    Description

      I have a FormComponent with custom Converter:

      item.setModel(new CompoundPropertyModel(data));
      final TextField quantityField = new TextField("quantity") {
      public IConverter getConverter(Class aClass)

      { return Converters.QUANTITY; }

      };
      item.add(quantityField );

      but when form submitted my QUANTITY converter wasn't used for converting right value.
      PropertyResolver uses PropertyResolverConverter with current session converter implementation and ignores custom converter:

      org.apache.wicket.util.convert.ConversionException: Cannot parse '3.2' using format java.text.DecimalFormat@674dc at org.apache.wicket.util.convert.converters.AbstractConverter.newConversionException(AbstractConverter.java:74) at org.apache.wicket.util.convert.converters.AbstractConverter.parse(AbstractConverter.java:54) at org.apache.wicket.util.convert.converters.AbstractNumberConverter.parse(AbstractNumberConverter.java:71) at org.apache.wicket.util.convert.converters.DoubleConverter.convertToObject(DoubleConverter.java:44) at org.apache.wicket.util.lang.PropertyResolverConverter.convert(PropertyResolverConverter.java:67) at org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(PropertyResolver.java:839) at org.apache.wicket.util.lang.PropertyResolver$ObjectAndGetSetter.setValue(PropertyResolver.java:458) at org.apache.wicket.util.lang.PropertyResolver.setValue(PropertyResolver.java:133) at org.apache.wicket.model.AbstractPropertyModel.setObject(AbstractPropertyModel.java:152) at org.apache.wicket.Component.setModelObject(Component.java:2061) at org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:724)

      Attachments

        Activity

          People

            knopp Matej Knopp
            idm Ivlev Dmitry
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: