[
https://issues.apache.org/jira/browse/MYFACES-2827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12889870#action_12889870
]
Jan-Kees van Andel commented on MYFACES-2827:
---------------------------------------------
I see I made a mistake. I guess that's what you get when looking at code
through a web interface instead of an IDE... ;-)
valueProperty must be a String because we need to pass it to the
validateValue() method as a String. This is the JSR303 API, so we can't change
this.
For reference:
http://download.oracle.com/docs/cd/E17410_01/javaee/6/api/javax/validation/Validator.html#validateValue(java.lang.Class,
java.lang.String, java.lang.Object, java.lang.Class...)
With regards ot Jakob's comment: "check if reference.getProperty() is a String
before doing the whole initialisation"
We can do this, but what do we do in this case? Just skip the call to
validateValue()?
I must say, it sounds reasonable on first thought, because we can't validate it
anyway. Also, this situation should never occur in the case of a Bean, since
the property name in a Bean is always a String.
If it's not a String ==> it's not a Bean ==> we don't have to "Bean-validate"
it...
So +1, but I'm probably not seeing all consequences right now. I guess we
should just fix it this way and see how it turns out in practice.
Mark can do the regression testing. ;-)
> CCE if component values are not of type String
> ----------------------------------------------
>
> Key: MYFACES-2827
> URL: https://issues.apache.org/jira/browse/MYFACES-2827
> Project: MyFaces Core
> Issue Type: Bug
> Affects Versions: 2.0.1
> Reporter: Mark Struberg
> Assignee: Jakob Korherr
> Attachments: MYFACES-2827.patch
>
>
> Somehow I did get a Long into my component. This leads to the following
> Exception:
> java.lang.ClassCastException: java.lang.Long cannot be cast to
> java.lang.String
> at javax.faces.validator.BeanValidator.validate(BeanValidator.java:145)
> at
> javax.faces.component._ComponentUtils.callValidators(_ComponentUtils.java:173)
> at javax.faces.component.UIInput.validateValue(UIInput.java:425)
> at javax.faces.component.UIInput.validate(UIInput.java:537)
> at javax.faces.component.UIInput.processValidators(UIInput.java:240)
> at javax.faces.component.UIData.process(UIData.java:1043)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.