[
http://issues.apache.org/jira/browse/MYFACES-736?page=comments#action_12355920
]
Keijo Nurmes commented on MYFACES-736:
--------------------------------------
I was testing 1.1.1RC3 and noticed that h:inputText with f:convertNumber
didn't work any more. As Sylvain described, it throws
'Conversion Error "XXX: Error during model data update.'
Stack trace shows that code breaks in
org.apache.myfaces.el.ValueBindingImpl.setValue
This is easy to reproduce with sample1.jsp in simple example.
Just throw <f:convertNumber/> inside <h:inputText id="number1"...
What seems to happen is:
In javax.faces.component.UIInput.validate the submittedValue is converted to
Object convertedValue = getConvertedValue(context, submittedValue);
In org.apache.myfaces.renderkit._SharedRendererUtils. findUIOutputConverter
If you have convertNumber, converter is retrieved by
Converter converter = component.getConverter();
and is javax.faces.convert.NumberConverter
If you don't have convertNumber the converter is retrieved by
ValueBinding vb = component.getValueBinding("value");
Class valueType = vb.getType(facesContext);
facesContext.getApplication().createConverter(valueType);
in my application the backing bean contains field of type short
so javax.faces.convert.ShortConverter is returned.
The type of convertedValue (in UIInput) is java.lang.long if NumberConverter
is used and
java.lang.short if Short.Converter is used.
If the field type in backing bean is short and convertedValue is long,
then later org.apache.myfaces.el.ValueBindingImpl.setValue can't find a setter
to the field.
I run out of time now, so I continue debugging later if necessary.
(Hope somebody can solve this before :) )
Regards, Keijo
Stack trace from simple example .........
javax.faces.el.EvaluationException: Cannot set value for expression
'#{calcForm.number1}' to a new value of type java.lang.Long
at
org.apache.myfaces.el.ValueBindingImpl.setValue(ValueBindingImpl.java:304)
at javax.faces.component.UIInput.updateModel(UIInput.java:226)
at javax.faces.component.UIInput.processUpdates(UIInput.java:165)
at javax.faces.component.UIForm.processUpdates(UIForm.java:85)
at
javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:428)
at
javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:428)
at javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:153)
at
org.apache.myfaces.lifecycle.LifecycleImpl.updateModelValues(LifecycleImpl.java:277)
at
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:81)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
> Number converter not working with Number
> ----------------------------------------
>
> Key: MYFACES-736
> URL: http://issues.apache.org/jira/browse/MYFACES-736
> Project: MyFaces
> Type: Bug
> Components: Implementation
> Versions: Nightly
> Reporter: Sylvain Vieujot
>
> If the backing bean setter takes a Number argument (Integer, Float, ...), the
> converter fails :
> Conversion Error "XXX: Error during model data update.
> If the setter uses a primitive type, then it works fine.
> This worked with the trunk version from September 30.
> There must have been a change that broke it since.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira