Hi All!
I have posted comment to MYFACES-1452, but it was probably not a rigth place
for this issue. The bug is still present in current source code
(myfaces-shared-impl-2.0.6-SNAPSHOT) and was never discussed since 1.1.4.
My question is, whether it's really a bug?
The selectBooleanCheckbox consequently ignores provided custom converter and
don't try to get standard one for bound property's type but throws
IllegalArgumentException "Expected submitted value of type Boolean for
Component:" if bound MBean property is not an instance of Boolean.
Nevertheless description of attribute "value" in TLD says:
----------
The initial value of this component. This value is generally
set as a value-binding in the form #{myBean.myProperty}, where
myProperty can be any data-type of Java (also user-defined data-types),
if a converter for this data-type exists.
---------
I've tracked this issue in source and found, that this happens during
initial rendering of component (so the message itself is not exactly
correct). My first step was to implement own 'replacement' method, that
checks whether some converter is available and provide a path. It works
pretty well, but unfortunatelly the problem lays deeper - the converter is
ignored also at other lifecycle phases of component, so any non Boolean type
can't be handled correct.
I found additionally, that even if I bound the value to 'normal' boolean
property, it works not with AJAX request. During A4J request the posted
value is never assigned to the bound MBean property without any exception or
warning - the component state is just not restored or is restored
incorrectly. (I believe, it's just a minor consequence of some problem in
component itself.)
Would somebody please confirm, whether this behaviour is really a bug?
Should I provide a testcase or create new JIRA issue?
paul
P.S. Please ignore my source code in comment to MYFACES-1452 - it's bugy and
was written 'on the fly' without to compile it. If it's generally a right
way to correct the bug, I'll post the correct version of this method.