Hello everyone,

Boy, this took some time to figure it out.
I wrote a custom converter for enums:

public class EnumConverter implements TypeConverter<Enum> {
    public Enum convert(String s, Class<? extends Enum> aClass, Collection<ValidationError> validationErrors) {
       ...
    }
    public void setLocale(Locale locale) {     
    }
}


I went back and forth for a while trying to understand why the hell is it not loaded using Extension.Packages filter parameter.
I dug through the whole flow and finally ran into this in net.sourceforge.stripes.validation.DefaultTypeConverterFactory:

protected Class<? extends TypeConverter<?>> findTypeConverterClass(Class<?> targetClass) {
        //...some stuff
        else if (targetClass.isEnum()) {
            Class<? extends TypeConverter<?>> converterClass = findTypeConverterClass(Enumeration.class);
        //...some other stuff
}

I believe this should be:
Class<? extends TypeConverter<?>> converterClass = findTypeConverterClass(Enum.class);

I gotta say I had a good laugh though :)

Regards,
Cosmin Marginean



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to