Red schrieb:
Hello.
I decided to upgrade to MyFaces 1.2.4 (from 1.1.something) today, and I
noticed something odd - some of my converters stopped working. I traced
the problem to ApplicationImpl.internalCreateConverter, which appears to
have a bug.
My converter is bound in faces-config.xml to an interface type called
EnumCoded. My enum classes implement EnumCoded, like this:
public enum PickListActionType implements EnumCoded {
..... etc...
}
I have a converter called a GenericEnumTypeConverter, which knows how to
deal with these and is declared like this:
<converter>
<converter-for-class>EnumCoded</converter-for-class>
<converter-class>GenericEnumTypeConverter</converter-class>
</converter>
This used to work in MyFaces 1.1, but in 1.2 it looks like the fact that
my type is an enum takes precedence over the fact that it implements
EnumCoded interface, so I end up with the built-in EnumConverter instead
of my GenericEnumTypeConverter.
The solution seems to be to simply reverse the checks on lines 757 and
763 in ApplicationImpl.internalCreateConverter(), so that we check for
interfaces before defaulting to EnumConverter.
Does this look right? Thank you for you help.
Your suggestion looks like a good idea to me.
Of course this issue was not relevant in JSF1.1, as java1.5 native enums
were not supported (JSF1.1 is java1.4-compatible). But for JSF1.2, it
makes a lot of sense to check for an optional interface first.
I suggest you create a JIRA issue for this. If you can provide a patch
(and even better a simple unit test) that would be even better..
Regards,
Simon