Igor Vaynberg wrote:
can you show us some code please?
The code is below.
The MessageValidationResult.isOk() returns false leading to a conversion exception being thrown by the converter. I can make a standalone example as well if you like.

Cheers
  Erik




package nl.jmonks.bonloon.app.components;

import java.util.Locale;

import nl.jmonks.bonloon.app.dataobjects.SofiNummerData;
import nl.jmonks.generic.validation.MessageValidationResult;
import nl.jmonks.tax.domain.SofiNummerValidator;
import nl.jmonks.wicket.components.AbstractConverter;
import wicket.WicketRuntimeException;
import wicket.util.convert.ConversionException;

public class SofiNummerConverter extends AbstractConverter<SofiNummerData> {
   
    private static final int REQUIRED_DIGIT_COUNT = 9;
   
    public SofiNummerConverter() {
        // Empty.
    }

    @Override
    public SofiNummerData convertToObject(String aValue, Locale aLocale) {
        aValue = aValue.replaceAll("\\s", "");
        aValue = aValue.replaceAll("\\.", "");
        SofiNummerValidator validator = new SofiNummerValidator();
        MessageValidationResult<String> result = validator.validate(aValue);
        if (!result.isOk()) {
            throw new ConversionException(result.getMessage());
        }
        SofiNummerData sofi =  new SofiNummerData();
        sofi.value = aValue;
        return sofi;
    }

    @Override
    public String convertToString(SofiNummerData aValue, Locale aLocale) {
        return aValue.value;
    }

}




-Igor


On 9/13/06, Erik Brakkee <[EMAIL PROTECTED]> wrote:
Hi,


When I throw a wicket.util.convert.ConversionException in my custom
IConverter, I don't see a message on the form, but instead I get to see
the stacktrace for the conversion exception on screen.

The wiki page
(http://www.wicket-wiki.org.uk/wiki/index.php/Using_custom_converters )
on custom converters says
"if conversion fails, you'll get a feedback message instead of a
stacktrace", so this seems to be an error.

This occurs in wicket 1.2.2.

Cheers
  Erik

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to